mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-15 15:38:39 +00:00
fix(sales-invoice): respect Customize Form hidden setting on Update Stock (#57819)
frm.toggle_display("update_stock", ...) unconditionally forced the
field visible based only on has_subcontracted, overwriting whatever
Customize Form had set on every refresh. OR it with the field's
original (property-setter-driven) hidden value instead.
Backport of #57818.
This commit is contained in:
@@ -1180,7 +1180,16 @@ frappe.ui.form.on("Sales Invoice", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
frm.set_df_property("update_stock", "read_only", frm.doc.has_subcontracted);
|
frm.set_df_property("update_stock", "read_only", frm.doc.has_subcontracted);
|
||||||
frm.toggle_display("update_stock", !frm.doc.has_subcontracted);
|
// frm.set_df_property mutates a per-document copy, not the doctype's shared field
|
||||||
|
// metadata, so this always reflects the original (Customize Form) hidden value.
|
||||||
|
const hidden_by_customization = cint(
|
||||||
|
frappe.meta.get_docfield("Sales Invoice", "update_stock")?.hidden
|
||||||
|
);
|
||||||
|
frm.set_df_property(
|
||||||
|
"update_stock",
|
||||||
|
"hidden",
|
||||||
|
cint(frm.doc.has_subcontracted) || hidden_by_customization
|
||||||
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user