mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 06:29:20 +00:00
fix: tests
This commit is contained in:
@@ -23,19 +23,20 @@ class AssetCategory(Document):
|
|||||||
account_type_map = {
|
account_type_map = {
|
||||||
'fixed_asset_account': { 'account_type': 'Fixed Asset' },
|
'fixed_asset_account': { 'account_type': 'Fixed Asset' },
|
||||||
'accumulated_depreciation_account': { 'account_type': 'Accumulated Depreciation' },
|
'accumulated_depreciation_account': { 'account_type': 'Accumulated Depreciation' },
|
||||||
'depreciation_expense_account': { 'account_type': 'Expense' },
|
'depreciation_expense_account': { 'root_type': 'Expense' },
|
||||||
'capital_work_in_progress_account': { 'account_type': 'Capital Work in Progress' }
|
'capital_work_in_progress_account': { 'account_type': 'Capital Work in Progress' }
|
||||||
}
|
}
|
||||||
for d in self.accounts:
|
for d in self.accounts:
|
||||||
for fieldname in account_type_map.keys():
|
for fieldname in account_type_map.keys():
|
||||||
if d.get(fieldname):
|
if d.get(fieldname):
|
||||||
selected_account = d.get(fieldname)
|
selected_account = d.get(fieldname)
|
||||||
selected_account_type = frappe.db.get_value('Account', selected_account, 'account_type')
|
key_to_match = account_type_map[fieldname].keys()[0]
|
||||||
expected_account_type = account_type_map[fieldname]['account_type']
|
selected_key_type = frappe.db.get_value('Account', selected_account, key_to_match)
|
||||||
|
expected_key_type = account_type_map[fieldname][key_to_match]
|
||||||
|
|
||||||
if selected_account_type != expected_account_type:
|
if selected_key_type != expected_key_type:
|
||||||
frappe.throw(_("Row #{}: Account Type of {} should be {}. Please modify the account type or select a different account."
|
frappe.throw(_("Row #{}: {} of {} should be {}. Please modify the account or select a different account."
|
||||||
.format(d.idx, frappe.bold(selected_account), frappe.bold(expected_account_type))),
|
.format(d.idx, frappe.unscrub(key_to_match), frappe.bold(selected_account), frappe.bold(expected_key_type))),
|
||||||
title=_("Invalid Account"))
|
title=_("Invalid Account"))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user