mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-19 21:19:19 +00:00
fix: make amount and percent field read only when distribute equally is enabled
(cherry picked from commit 75999a7ae4)
This commit is contained in:
@@ -42,6 +42,8 @@ frappe.ui.form.on("Budget", {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggle_distribution_fields(frm);
|
||||||
},
|
},
|
||||||
|
|
||||||
budget_against: function (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) {
|
set_null_value: function (frm) {
|
||||||
if (frm.doc.budget_against == "Cost Center") {
|
if (frm.doc.budget_against == "Cost Center") {
|
||||||
frm.set_value("project", null);
|
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