mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-14 04:15:10 +00:00
fix: make amount and percent field read only when distribute equally is enabled
This commit is contained in:
@@ -42,6 +42,8 @@ frappe.ui.form.on("Budget", {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
toggle_distribution_fields(frm);
|
||||
},
|
||||
|
||||
budget_against: function (frm) {
|
||||
@@ -58,6 +60,12 @@ frappe.ui.form.on("Budget", {
|
||||
}
|
||||
},
|
||||
|
||||
distribute_equally: function (frm) {
|
||||
console.log("here");
|
||||
|
||||
toggle_distribution_fields(frm);
|
||||
},
|
||||
|
||||
set_null_value: function (frm) {
|
||||
if (frm.doc.budget_against == "Cost Center") {
|
||||
frm.set_value("project", null);
|
||||
@@ -111,3 +119,13 @@ frappe.ui.form.on("Budget Distribution", {
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
function toggle_distribution_fields(frm) {
|
||||
const grid = frm.fields_dict.budget_distribution.grid;
|
||||
|
||||
["amount", "percent"].forEach((field) => {
|
||||
grid.update_docfield_property(field, "read_only", frm.doc.distribute_equally);
|
||||
});
|
||||
|
||||
grid.refresh();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user