fix: update linked Customer on Patient update only if Link Customer to Patient is enabled (#25926)

This commit is contained in:
Anoop 2021-06-12 14:17:04 +05:30 committed by GitHub
parent cf349aadf9
commit 28cdff10cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,7 @@ class Patient(Document):
self.reload() # self.notify_update() self.reload() # self.notify_update()
def on_update(self): def on_update(self):
if frappe.db.get_single_value('Healthcare Settings', 'link_customer_to_patient'):
if self.customer: if self.customer:
customer = frappe.get_doc('Customer', self.customer) customer = frappe.get_doc('Customer', self.customer)
if self.customer_group: if self.customer_group:
@ -47,7 +48,6 @@ class Patient(Document):
customer.ignore_mandatory = True customer.ignore_mandatory = True
customer.save(ignore_permissions=True) customer.save(ignore_permissions=True)
else: else:
if frappe.db.get_single_value('Healthcare Settings', 'link_customer_to_patient'):
create_customer(self) create_customer(self)
def set_full_name(self): def set_full_name(self):