From 0abfd82688751bfa13e7a684533d8fc96ce6de0b Mon Sep 17 00:00:00 2001 From: Sagar Vora <16315650+sagarvora@users.noreply.github.com> Date: Tue, 9 Sep 2025 11:34:49 +0530 Subject: [PATCH 1/3] fix: use the new `extend_doctype_class` hook --- erpnext/accounts/custom/address.py | 18 +++++++++++++++++- erpnext/hooks.py | 10 ++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/custom/address.py b/erpnext/accounts/custom/address.py index 184a979e080..6839b018f96 100644 --- a/erpnext/accounts/custom/address.py +++ b/erpnext/accounts/custom/address.py @@ -11,7 +11,9 @@ class ERPNextAddress(Address): def validate(self): self.validate_reference() self.update_company_address() - super().validate() + + if hasattr(super(), "validate"): + super().validate() def on_update(self): """ @@ -44,6 +46,20 @@ class ERPNextAddress(Address): title=_("Company Not Linked"), ) + def on_update(self): + """ + After Address is updated, update the related 'Primary Address' on Customer. + """ + + if hasattr(super(), "on_update"): + super().on_update() + + address_display = get_address_display(self.as_dict()) + filters = {"customer_primary_address": self.name} + customers = frappe.db.get_all("Customer", filters=filters, as_list=True) + for customer_name in customers: + frappe.db.set_value("Customer", customer_name[0], "primary_address", address_display) + @frappe.whitelist() def get_shipping_address(company, address=None): diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 0d6bd7da52b..3bb662a4238 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -155,13 +155,7 @@ doctype_list_js = { ], } -doctype_css = { - "Event": "public/css/event.css", -} - -override_doctype_class = { - "Address": "erpnext.accounts.custom.address.ERPNextAddress", -} +extend_doctype_class = {"Address": "erpnext.accounts.custom.address.ERPNextAddress"} override_whitelisted_methods = {"frappe.www.contact.send_message": "erpnext.templates.utils.send_message"} @@ -485,7 +479,7 @@ doc_events = { "Sales Invoice": { "on_submit": [ "erpnext.regional.italy.utils.sales_invoice_on_submit", - "erpnext.accounts.doctype.subscription.subscription.update_subscription_state", # @dokos + "erpnext.accounts.doctype.subscription.subscription.update_subscription_state", # @dokos ], "on_cancel": [ "erpnext.regional.italy.utils.sales_invoice_on_cancel", -- GitLab From 26bb6eb455f5b1a39b96414d5ce5fcbb74bccd3c Mon Sep 17 00:00:00 2001 From: Sagar Vora <16315650+sagarvora@users.noreply.github.com> Date: Tue, 9 Sep 2025 06:21:19 +0000 Subject: [PATCH 2/3] Merge pull request #49506 from sagarvora/extend-not-override fix: use the new `extend_doctype_class` hook --- erpnext/accounts/custom/address.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/erpnext/accounts/custom/address.py b/erpnext/accounts/custom/address.py index 6839b018f96..5ea8b1d1ca8 100644 --- a/erpnext/accounts/custom/address.py +++ b/erpnext/accounts/custom/address.py @@ -15,16 +15,6 @@ class ERPNextAddress(Address): if hasattr(super(), "validate"): super().validate() - def on_update(self): - """ - After Address is updated, update the related 'Primary Address' on Customer. - """ - address_display = get_address_display(self.as_dict()) - filters = {"customer_primary_address": self.name} - customers = frappe.db.get_all("Customer", filters=filters, as_list=True) - for customer_name in customers: - frappe.db.set_value("Customer", customer_name[0], "primary_address", address_display) - def link_address(self): """Link address based on owner""" if self.is_your_company_address: -- GitLab From 3d4e65ca08fceafa75994612c9701b0c61a18488 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Tue, 9 Sep 2025 18:38:07 +0200 Subject: [PATCH 3/3] fix: keep css override --- erpnext/hooks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 3bb662a4238..36c0aa718df 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -155,6 +155,9 @@ doctype_list_js = { ], } +doctype_css = { + "Event": "public/css/event.css", +} extend_doctype_class = {"Address": "erpnext.accounts.custom.address.ERPNextAddress"} override_whitelisted_methods = {"frappe.www.contact.send_message": "erpnext.templates.utils.send_message"} -- GitLab