From 8e8ef1602e5b72d203f546adda85082ea94aa916 Mon Sep 17 00:00:00 2001 From: Henil Maru Date: Wed, 5 Aug 2026 18:00:26 +0530 Subject: [PATCH] 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. --- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 1c6a99edb03..688be5946d9 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -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() {