diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 8d4d2d4284a..36ca5287e9e 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -379,7 +379,8 @@ frappe.ui.form.on("Purchase Invoice", { }, disable_due_date: function() { - const disable = !cur_frm.doc.payment_terms_template && cur_frm.doc.payment_schedule.length == 0; + const disable = cur_frm.doc.payment_terms_template || ( + cur_frm.doc.payment_schedule && cur_frm.doc.payment_schedule.length == 0); cur_frm.set_df_property("due_date", "read_only", disable ? 1 : 0); }, diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 2c11e1701ec..5432b4c4500 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -571,7 +571,8 @@ frappe.ui.form.on("Sales Invoice", { }, disable_due_date: function() { - const disable = !cur_frm.doc.payment_terms_template && cur_frm.doc.payment_schedule.length == 0; + const disable = cur_frm.doc.payment_terms_template || ( + cur_frm.doc.payment_schedule && cur_frm.doc.payment_schedule.length == 0); cur_frm.set_df_property("due_date", "read_only", disable ? 1 : 0); },