fix: Use update flag for company dependant fixtures

This commit is contained in:
Deepesh Garg
2021-07-12 18:29:52 +05:30
parent 7be9f8dab1
commit fea29ae8cb
2 changed files with 8 additions and 5 deletions

View File

@@ -291,7 +291,7 @@ class Company(NestedSet):
cash = frappe.db.get_value('Mode of Payment', {'type': 'Cash'}, 'name')
if cash and self.default_cash_account \
and not frappe.db.get_value('Mode of Payment Account', {'company': self.name, 'parent': cash}):
mode_of_payment = frappe.get_doc('Mode of Payment', cash)
mode_of_payment = frappe.get_doc('Mode of Payment', cash, for_update=True)
mode_of_payment.append('accounts', {
'company': self.name,
'default_account': self.default_cash_account