From 2fdb857fed99ed3265a05d01416562eb3cd2731c Mon Sep 17 00:00:00 2001 From: tunde Date: Tue, 5 Sep 2017 00:21:54 +0100 Subject: [PATCH] fix due date disable bug --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js | 3 ++- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 8d4d2d4284..36ca5287e9 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 2c11e1701e..5432b4c450 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); },