fix: Validate income/expense account in sales and purchase invoice

(cherry picked from commit 06936cf1c0)
This commit is contained in:
Deepesh Garg
2022-03-16 09:02:04 +05:30
committed by mergify-bot
parent face53ae8e
commit 935d2e3d64
3 changed files with 16 additions and 3 deletions

View File

@@ -1567,12 +1567,12 @@ def validate_taxes_and_charges(tax):
tax.rate = None
def validate_account_head(idx, account, company):
def validate_account_head(idx, account, company, context=''):
account_company = frappe.get_cached_value('Account', account, 'company')
if account_company != company:
frappe.throw(_('Row {0}: Account {1} does not belong to Company {2}')
.format(idx, frappe.bold(account), frappe.bold(company)), title=_('Invalid Account'))
frappe.throw(_('Row {0}: {3} Account {1} does not belong to Company {2}')
.format(idx, frappe.bold(account), frappe.bold(company), context), title=_('Invalid Account'))
def validate_cost_center(tax, doc):