fix due date disable bug

This commit is contained in:
tunde 2017-09-05 00:21:54 +01:00
parent 60aecd87b1
commit 2fdb857fed
2 changed files with 4 additions and 2 deletions

View File

@ -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);
},

View File

@ -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);
},