fix: use the new extend_doctype_class hook

This commit is contained in:
Sagar Vora
2025-09-09 11:34:49 +05:30
parent ddc97df31a
commit a028d856bc
2 changed files with 10 additions and 4 deletions

View File

@@ -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)

View File

@@ -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"}