mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-19 06:45:11 +00:00
fix(ux): refresh grid to correctly persist the state of fields
This commit is contained in:
@@ -247,13 +247,16 @@ frappe.ui.form.on("Work Order", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
toggle_items_editable(frm) {
|
toggle_items_editable(frm) {
|
||||||
if (!frm.doc.__onload?.allow_editing_items) {
|
let allow_edit = true;
|
||||||
frm.set_df_property("required_items", "cannot_delete_rows", true);
|
if (!frm.doc.__onload?.allow_editing_items) allow_edit = false;
|
||||||
frm.set_df_property("required_items", "cannot_add_rows", true);
|
|
||||||
frm.fields_dict["required_items"].grid.update_docfield_property("item_code", "read_only", 1);
|
frm.set_df_property("required_items", "cannot_delete_rows", !allow_edit);
|
||||||
frm.fields_dict["required_items"].grid.update_docfield_property("required_qty", "read_only", 1);
|
frm.set_df_property("required_items", "cannot_add_rows", !allow_edit);
|
||||||
frm.fields_dict["required_items"].grid.refresh();
|
|
||||||
}
|
const grid = frm.fields_dict["required_items"].grid;
|
||||||
|
grid.update_docfield_property("item_code", "read_only", !allow_edit);
|
||||||
|
grid.update_docfield_property("required_qty", "read_only", !allow_edit);
|
||||||
|
grid.refresh();
|
||||||
},
|
},
|
||||||
|
|
||||||
add_custom_button_to_return_components: function (frm) {
|
add_custom_button_to_return_components: function (frm) {
|
||||||
|
|||||||
Reference in New Issue
Block a user