From c6d06816cfbafef05d79c26df166cc6cd7c18b48 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Thu, 21 Oct 2021 15:37:59 +0530 Subject: [PATCH] fix: Auto update company address check on linking with company --- erpnext/accounts/custom/address.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/accounts/custom/address.py b/erpnext/accounts/custom/address.py index a6d08d8ff6..551048e50b 100644 --- a/erpnext/accounts/custom/address.py +++ b/erpnext/accounts/custom/address.py @@ -10,6 +10,7 @@ from frappe.contacts.doctype.address.address import ( class ERPNextAddress(Address): def validate(self): self.validate_reference() + self.update_compnay_address() super(ERPNextAddress, self).validate() def link_address(self): @@ -19,6 +20,11 @@ class ERPNextAddress(Address): return super(ERPNextAddress, self).link_address() + def update_compnay_address(self): + for link in self.get('links'): + if link.link_doctype == 'Company': + self.is_your_company_address = 1 + def validate_reference(self): if self.is_your_company_address and not [ row for row in self.links if row.link_doctype == "Company"