fix: reset dimension defaults when company changedin test
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index 4180bef..d2f19a1 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -1750,7 +1750,7 @@
parent_account="Temporary Accounts - _TC",
)
- create_accounting_dimension()
+ create_accounting_dimension(company="_Test Company", offsetting_account="Offsetting - _TC")
branch1 = frappe.new_doc("Branch")
branch1.branch = "Location 1"
diff --git a/erpnext/accounts/report/trial_balance/test_trial_balance.py b/erpnext/accounts/report/trial_balance/test_trial_balance.py
index 732035d..cd0429b 100644
--- a/erpnext/accounts/report/trial_balance/test_trial_balance.py
+++ b/erpnext/accounts/report/trial_balance/test_trial_balance.py
@@ -84,14 +84,14 @@
def create_accounting_dimension(**args):
args = frappe._dict(args)
document_type = args.document_type or "Branch"
- if not frappe.db.exists("Accounting Dimension", {"document_type": "Branch"}):
- accounting_dimension = frappe.get_doc(
- {"doctype": "Accounting Dimension", "document_type": document_type}
- ).insert()
- else:
+ if frappe.db.exists("Accounting Dimension", document_type):
accounting_dimension = frappe.get_doc("Accounting Dimension", document_type)
accounting_dimension.disabled = 0
-
+ else:
+ accounting_dimension = frappe.new_doc("Accounting Dimension")
+ accounting_dimension.document_type = document_type
+ accounting_dimension.insert()
+ accounting_dimension.save()
accounting_dimension.append(
"dimension_defaults",
{
@@ -101,7 +101,6 @@
},
)
accounting_dimension.save()
- return accounting_dimension.name
def disable_dimension(**args):