mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 20:29:09 +00:00
fix: tests
This commit is contained in:
@@ -69,6 +69,7 @@ class TestAccount(unittest.TestCase):
|
|||||||
acc.account_name = "Accumulated Depreciation"
|
acc.account_name = "Accumulated Depreciation"
|
||||||
acc.parent_account = "Fixed Assets - _TC"
|
acc.parent_account = "Fixed Assets - _TC"
|
||||||
acc.company = "_Test Company"
|
acc.company = "_Test Company"
|
||||||
|
acc.account_type = "Accumulated Depreciation"
|
||||||
acc.insert()
|
acc.insert()
|
||||||
|
|
||||||
doc = frappe.get_doc("Account", "Securities and Deposits - _TC")
|
doc = frappe.get_doc("Account", "Securities and Deposits - _TC")
|
||||||
@@ -149,8 +150,8 @@ def _make_test_records(verbose):
|
|||||||
|
|
||||||
# fixed asset depreciation
|
# fixed asset depreciation
|
||||||
["_Test Fixed Asset", "Current Assets", 0, "Fixed Asset", None],
|
["_Test Fixed Asset", "Current Assets", 0, "Fixed Asset", None],
|
||||||
["_Test Accumulated Depreciations", "Current Assets", 0, None, None],
|
["_Test Accumulated Depreciations", "Current Assets", 0, "Accumulated Depreciation", None],
|
||||||
["_Test Depreciations", "Expenses", 0, None, None],
|
["_Test Depreciations", "Expenses", 0, "Expense", None],
|
||||||
["_Test Gain/Loss on Asset Disposal", "Expenses", 0, None, None],
|
["_Test Gain/Loss on Asset Disposal", "Expenses", 0, None, None],
|
||||||
|
|
||||||
# Receivable / Payable Account
|
# Receivable / Payable Account
|
||||||
|
|||||||
@@ -27,12 +27,16 @@ class AssetCategory(Document):
|
|||||||
'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 account in account_type_map.keys():
|
for fieldname in account_type_map.keys():
|
||||||
if d.get(account):
|
if d.get(fieldname):
|
||||||
account_type = frappe.db.get_value('Account', d.get(account), 'account_type')
|
selected_account = d.get(fieldname)
|
||||||
if account_type != account_type_map[account]['account_type']:
|
selected_account_type = frappe.db.get_value('Account', selected_account, 'account_type')
|
||||||
frappe.throw(_("Row {}: Account Type of {} should be {} account".format(d.idx, frappe.bold(frappe.unscrub(account)),
|
expected_account_type = account_type_map[fieldname]['account_type']
|
||||||
frappe.bold(account_type_map[account]['account_type']))), title=_("Invalid Account"))
|
|
||||||
|
if selected_account_type != expected_account_type:
|
||||||
|
frappe.throw(_("Row #{}: Account Type of {} should be {}. Please modify the account type or select a different account."
|
||||||
|
.format(d.idx, frappe.bold(selected_account), frappe.bold(expected_account_type))),
|
||||||
|
title=_("Invalid Account"))
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|||||||
@@ -355,8 +355,8 @@ class TestPurchaseReceipt(unittest.TestCase):
|
|||||||
'accounts': [{
|
'accounts': [{
|
||||||
'company_name': '_Test Company',
|
'company_name': '_Test Company',
|
||||||
'fixed_asset_account': '_Test Fixed Asset - _TC',
|
'fixed_asset_account': '_Test Fixed Asset - _TC',
|
||||||
'accumulated_depreciation_account': 'Depreciation - _TC',
|
'accumulated_depreciation_account': '_Test Accumulated Depreciations - _TC',
|
||||||
'depreciation_expense_account': 'Depreciation - _TC'
|
'depreciation_expense_account': '_Test Depreciation - _TC'
|
||||||
}]
|
}]
|
||||||
}).insert()
|
}).insert()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user