From a028d856bc0fb25bbc951fcecfb932909dee2a22 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] fix: use the new `extend_doctype_class` hook --- erpnext/accounts/custom/address.py | 12 +++++++++--- erpnext/hooks.py | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/custom/address.py b/erpnext/accounts/custom/address.py index ef57a632506..5ea8b1d1ca8 100644 --- a/erpnext/accounts/custom/address.py +++ b/erpnext/accounts/custom/address.py @@ -10,8 +10,10 @@ from frappe.contacts.doctype.address.address import ( class ERPNextAddress(Address): def validate(self): self.validate_reference() - self.update_compnay_address() - super().validate() + self.update_company_address() + + if hasattr(super(), "validate"): + super().validate() def link_address(self): """Link address based on owner""" @@ -20,7 +22,7 @@ class ERPNextAddress(Address): return super().link_address() - def update_compnay_address(self): + def update_company_address(self): for link in self.get("links"): if link.link_doctype == "Company": self.is_your_company_address = 1 @@ -38,6 +40,10 @@ class ERPNextAddress(Address): """ 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) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 00e01c5bba4..22bff524dea 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -51,7 +51,7 @@ doctype_list_js = { ], } -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"}