Merge pull request #28052 from deepeshgarg007/company_address_update

fix: Auto update company address check on linking with company
This commit is contained in:
Deepesh Garg 2021-10-26 20:40:13 +05:30 committed by GitHub
commit 6b22894275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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