mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-26 01:58:31 +00:00
fix: handle duplicate acctount row for the same company
This commit is contained in:
@@ -210,26 +210,29 @@ class TestAssetRepair(IntegrationTestCase):
|
||||
self.assertRaises(frappe.ValidationError, asset_repair2.save)
|
||||
|
||||
def test_gl_entries_with_perpetual_inventory(self):
|
||||
set_depreciation_settings_in_company(company="_Test Company with perpetual inventory")
|
||||
company = "_Test Company with perpetual inventory"
|
||||
set_depreciation_settings_in_company(company)
|
||||
|
||||
asset_category = frappe.get_doc("Asset Category", "Computers")
|
||||
asset_category.append(
|
||||
"accounts",
|
||||
{
|
||||
"company_name": "_Test Company with perpetual inventory",
|
||||
"fixed_asset_account": "_Test Fixed Asset - TCP1",
|
||||
"accumulated_depreciation_account": "_Test Accumulated Depreciations - TCP1",
|
||||
"depreciation_expense_account": "_Test Depreciations - TCP1",
|
||||
"capital_work_in_progress_account": "CWIP Account - TCP1",
|
||||
},
|
||||
)
|
||||
asset_category.save()
|
||||
|
||||
if not any(row.company_name == company for row in asset_category.accounts):
|
||||
asset_category.append(
|
||||
"accounts",
|
||||
{
|
||||
"company_name": company,
|
||||
"fixed_asset_account": "_Test Fixed Asset - TCP1",
|
||||
"accumulated_depreciation_account": "_Test Accumulated Depreciations - TCP1",
|
||||
"depreciation_expense_account": "_Test Depreciations - TCP1",
|
||||
"capital_work_in_progress_account": "CWIP Account - TCP1",
|
||||
},
|
||||
)
|
||||
asset_category.save()
|
||||
|
||||
asset_repair = create_asset_repair(
|
||||
capitalize_repair_cost=1,
|
||||
stock_consumption=1,
|
||||
warehouse="Stores - TCP1",
|
||||
company="_Test Company with perpetual inventory",
|
||||
company=company,
|
||||
pi_expense_account1="Administrative Expenses - TCP1",
|
||||
pi_expense_account2="Legal Expenses - TCP1",
|
||||
item="_Test Non Stock Item",
|
||||
|
||||
Reference in New Issue
Block a user