mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +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)
|
self.assertRaises(frappe.ValidationError, asset_repair2.save)
|
||||||
|
|
||||||
def test_gl_entries_with_perpetual_inventory(self):
|
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 = frappe.get_doc("Asset Category", "Computers")
|
||||||
asset_category.append(
|
|
||||||
"accounts",
|
if not any(row.company_name == company for row in asset_category.accounts):
|
||||||
{
|
asset_category.append(
|
||||||
"company_name": "_Test Company with perpetual inventory",
|
"accounts",
|
||||||
"fixed_asset_account": "_Test Fixed Asset - TCP1",
|
{
|
||||||
"accumulated_depreciation_account": "_Test Accumulated Depreciations - TCP1",
|
"company_name": company,
|
||||||
"depreciation_expense_account": "_Test Depreciations - TCP1",
|
"fixed_asset_account": "_Test Fixed Asset - TCP1",
|
||||||
"capital_work_in_progress_account": "CWIP Account - 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_category.save()
|
||||||
|
|
||||||
asset_repair = create_asset_repair(
|
asset_repair = create_asset_repair(
|
||||||
capitalize_repair_cost=1,
|
capitalize_repair_cost=1,
|
||||||
stock_consumption=1,
|
stock_consumption=1,
|
||||||
warehouse="Stores - TCP1",
|
warehouse="Stores - TCP1",
|
||||||
company="_Test Company with perpetual inventory",
|
company=company,
|
||||||
pi_expense_account1="Administrative Expenses - TCP1",
|
pi_expense_account1="Administrative Expenses - TCP1",
|
||||||
pi_expense_account2="Legal Expenses - TCP1",
|
pi_expense_account2="Legal Expenses - TCP1",
|
||||||
item="_Test Non Stock Item",
|
item="_Test Non Stock Item",
|
||||||
|
|||||||
Reference in New Issue
Block a user