mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-17 00:18:39 +00:00
test(stock): isolate warehouse account fixtures from class-level state
FrappeTestCase on this branch rolls back per class, not per test, so sibling tests leak state. test_new_warehouse_can_inherit_inventory_account left an explicit account on the root group, which made later ambiguous fixtures resolve through the root: the insert validation stopped raising and the unresolved warehouse stayed in the map. The fixture helper now clears group warehouse accounts so every call re-establishes ambiguity. The fallback test also clears the account of the warehouse it picks, since a leftover explicit account skips the single-account fallback it asserts.
This commit is contained in:
@@ -112,6 +112,7 @@ class TestWarehouse(FrappeTestCase):
|
||||
frappe.delete_doc("Account", "Extra Inventory Account - _TCIF")
|
||||
|
||||
warehouse = frappe.get_doc("Warehouse", {"company": company, "is_group": 0})
|
||||
warehouse.db_set("account", None)
|
||||
single_account = frappe.db.get_value(
|
||||
"Account", {"account_type": "Stock", "is_group": 0, "company": company}, "name"
|
||||
)
|
||||
@@ -250,6 +251,11 @@ def create_ambiguous_inventory_account_warehouse():
|
||||
for warehouse_name in warehouses:
|
||||
frappe.db.set_value("Warehouse", warehouse_name, "account", single_account)
|
||||
|
||||
for group_warehouse in frappe.get_all(
|
||||
"Warehouse", filters={"company": company, "is_group": 1}, pluck="name"
|
||||
):
|
||||
frappe.db.set_value("Warehouse", group_warehouse, "account", None)
|
||||
|
||||
warehouse = frappe.get_doc("Warehouse", warehouses[0])
|
||||
warehouse.db_set({"account": None, "disabled": 0})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user