fix: reset dimension defaults when company changedin test

This commit is contained in:
Gursheen Anand 2023-07-19 18:15:59 +05:30
parent 23e56d3ec1
commit 3f5afb9cac
2 changed files with 7 additions and 8 deletions

View File

@ -1750,7 +1750,7 @@ class TestPurchaseInvoice(unittest.TestCase, StockTestMixin):
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"

View File

@ -84,14 +84,14 @@ def create_company(**args):
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 @@ def create_accounting_dimension(**args):
},
)
accounting_dimension.save()
return accounting_dimension.name
def disable_dimension(**args):