end date should reset if start date is changed
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 32195dd..619c0ed 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -757,6 +757,13 @@
frappe.throw(__("Service Stop Date cannot be after Service End Date"));
}
}
+ },
+ service_start_date: function(frm, cdt, cdn) {
+ var child = locals[cdt][cdn];
+
+ if(child.service_start_date) {
+ frappe.model.set_value(cdt, cdn, "service_end_date", "");
+ }
}
})
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 420d9d8..caafcdc 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -274,11 +274,12 @@
})
if item.enable_deferred_revenue:
- service_end_date = add_months(args.transaction_date, item.no_of_months)
+ service_start_date = args.service_start_date if args.service_start_date else args.transaction_date
+ service_end_date = add_months(service_start_date, item.no_of_months)
out.update({
"enable_deferred_revenue": item.enable_deferred_revenue,
"deferred_revenue_account": get_default_deferred_revenue_account(args, item),
- "service_start_date": args.transaction_date,
+ "service_start_date": service_start_date,
"service_end_date": service_end_date
})