mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 04:09:11 +00:00
disable due date field if form has payment schedule data
This commit is contained in:
@@ -372,3 +372,22 @@ frappe.ui.form.on("Purchase Invoice", {
|
|||||||
frm.toggle_reqd("supplier_warehouse", frm.doc.is_subcontracted==="Yes");
|
frm.toggle_reqd("supplier_warehouse", frm.doc.is_subcontracted==="Yes");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
frappe.ui.form.on("Purchase Invoice", {
|
||||||
|
payment_terms_template: function() {
|
||||||
|
cur_frm.trigger("disable_due_date");
|
||||||
|
},
|
||||||
|
|
||||||
|
disable_due_date: function() {
|
||||||
|
const disable = !cur_frm.doc.payment_terms_template && cur_frm.doc.payment_schedule.length == 0;
|
||||||
|
cur_frm.set_df_property("due_date", "read_only", disable ? 1 : 0);
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
frappe.ui.form.on("Payment Schedule", {
|
||||||
|
payment_schedule_remove: function() {
|
||||||
|
cur_frm.trigger("disable_due_date");
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
@@ -564,3 +564,22 @@ var calculate_total_billing_amount = function(frm) {
|
|||||||
|
|
||||||
refresh_field('total_billing_amount')
|
refresh_field('total_billing_amount')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frappe.ui.form.on("Sales Invoice", {
|
||||||
|
payment_terms_template: function() {
|
||||||
|
cur_frm.trigger("disable_due_date");
|
||||||
|
},
|
||||||
|
|
||||||
|
disable_due_date: function() {
|
||||||
|
const disable = !cur_frm.doc.payment_terms_template && cur_frm.doc.payment_schedule.length == 0;
|
||||||
|
cur_frm.set_df_property("due_date", "read_only", disable ? 1 : 0);
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
frappe.ui.form.on("Payment Schedule", {
|
||||||
|
payment_schedule_remove: function() {
|
||||||
|
cur_frm.trigger("disable_due_date");
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user