fix: Auto update company address check on linking with company
This commit is contained in:
parent
2849297471
commit
c6d06816cf
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user