mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-16 07:58:38 +00:00
fix(sales-invoice): respect Customize Form hidden setting on Update Stock (#57818)
set_dynamic_labels() unconditionally forced update_stock's hidden property based only on is_debit_note/has_subcontracted, overwriting whatever Customize Form had set on every refresh. OR it with the field's original (property-setter-driven) hidden value instead.
This commit is contained in:
@@ -587,7 +587,12 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends (
|
||||
super.set_dynamic_labels();
|
||||
this.frm.events.hide_fields(this.frm);
|
||||
const hide_update_stock = cint(this.frm.doc.is_debit_note) || cint(this.frm.doc.has_subcontracted);
|
||||
this.frm.set_df_property("update_stock", "hidden", hide_update_stock);
|
||||
// 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
|
||||
);
|
||||
this.frm.set_df_property("update_stock", "hidden", hide_update_stock || hidden_by_customization);
|
||||
}
|
||||
|
||||
items_on_form_rendered() {
|
||||
|
||||
Reference in New Issue
Block a user