mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-24 21:52:21 +01:00
fix: handle missing liability account scenario in set_liability_account
(cherry picked from commit ee7ab4b065)
This commit is contained in:
@@ -145,9 +145,21 @@ class PaymentEntry(AccountsController):
|
|||||||
self.is_opening = "No"
|
self.is_opening = "No"
|
||||||
return
|
return
|
||||||
|
|
||||||
liability_account = get_party_account(
|
accounts = get_party_account(self.party_type, self.party, self.company, include_advance=True)
|
||||||
self.party_type, self.party, self.company, include_advance=True
|
|
||||||
)[1]
|
liability_account = accounts[1] if len(accounts) > 1 else None
|
||||||
|
fieldname = (
|
||||||
|
"default_advance_received_account"
|
||||||
|
if self.party_type == "Customer"
|
||||||
|
else "default_advance_paid_account"
|
||||||
|
)
|
||||||
|
|
||||||
|
if not liability_account:
|
||||||
|
throw(
|
||||||
|
_("Please set default {0} in Company {1}").format(
|
||||||
|
frappe.bold(frappe.get_meta("Company").get_label(fieldname)), frappe.bold(self.company)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
self.set(self.party_account_field, liability_account)
|
self.set(self.party_account_field, liability_account)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user