Validate currency of default receivable/payable accounts
This commit is contained in:
parent
64fd970a8a
commit
2873f2e7de
@ -217,11 +217,19 @@ def validate_party_accounts(doc):
|
||||
|
||||
for account in doc.get("accounts"):
|
||||
if account.company in companies:
|
||||
frappe.throw(_("There can only be 1 Account per Company in {0} {1}").format(doc.doctype, doc.name),
|
||||
DuplicatePartyAccountError)
|
||||
frappe.throw(_("There can only be 1 Account per Company in {0} {1}")
|
||||
.format(doc.doctype, doc.name), DuplicatePartyAccountError)
|
||||
else:
|
||||
companies.append(account.company)
|
||||
|
||||
party_account_currency = frappe.db.get_value("Account", account.account, "account_currency")
|
||||
existing_gle_currency = get_party_gle_currency(doc.doctype, doc.name, account.company)
|
||||
|
||||
if party_account_currency != existing_gle_currency:
|
||||
frappe.throw(_("Accounting Entry against company: {0} can only be made in currency: {1}, please check default {2} account")
|
||||
.format(account.company, existing_gle_currency,
|
||||
"receivable" if doc.doctype=="Customer" else "payable"))
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_due_date(posting_date, party_type, party, company):
|
||||
"""Set Due Date = Posting Date + Credit Days"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user