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):
|
class ERPNextAddress(Address):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_reference()
|
self.validate_reference()
|
||||||
|
self.update_compnay_address()
|
||||||
super(ERPNextAddress, self).validate()
|
super(ERPNextAddress, self).validate()
|
||||||
|
|
||||||
def link_address(self):
|
def link_address(self):
|
||||||
@ -19,6 +20,11 @@ class ERPNextAddress(Address):
|
|||||||
|
|
||||||
return super(ERPNextAddress, self).link_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):
|
def validate_reference(self):
|
||||||
if self.is_your_company_address and not [
|
if self.is_your_company_address and not [
|
||||||
row for row in self.links if row.link_doctype == "Company"
|
row for row in self.links if row.link_doctype == "Company"
|
||||||
|
Loading…
Reference in New Issue
Block a user