fix: reset dimension defaults when company changedin test
This commit is contained in:
parent
23e56d3ec1
commit
3f5afb9cac
@ -1750,7 +1750,7 @@ class TestPurchaseInvoice(unittest.TestCase, StockTestMixin):
|
|||||||
parent_account="Temporary Accounts - _TC",
|
parent_account="Temporary Accounts - _TC",
|
||||||
)
|
)
|
||||||
|
|
||||||
create_accounting_dimension()
|
create_accounting_dimension(company="_Test Company", offsetting_account="Offsetting - _TC")
|
||||||
|
|
||||||
branch1 = frappe.new_doc("Branch")
|
branch1 = frappe.new_doc("Branch")
|
||||||
branch1.branch = "Location 1"
|
branch1.branch = "Location 1"
|
||||||
|
|||||||
@ -84,14 +84,14 @@ def create_company(**args):
|
|||||||
def create_accounting_dimension(**args):
|
def create_accounting_dimension(**args):
|
||||||
args = frappe._dict(args)
|
args = frappe._dict(args)
|
||||||
document_type = args.document_type or "Branch"
|
document_type = args.document_type or "Branch"
|
||||||
if not frappe.db.exists("Accounting Dimension", {"document_type": "Branch"}):
|
if frappe.db.exists("Accounting Dimension", document_type):
|
||||||
accounting_dimension = frappe.get_doc(
|
|
||||||
{"doctype": "Accounting Dimension", "document_type": document_type}
|
|
||||||
).insert()
|
|
||||||
else:
|
|
||||||
accounting_dimension = frappe.get_doc("Accounting Dimension", document_type)
|
accounting_dimension = frappe.get_doc("Accounting Dimension", document_type)
|
||||||
accounting_dimension.disabled = 0
|
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(
|
accounting_dimension.append(
|
||||||
"dimension_defaults",
|
"dimension_defaults",
|
||||||
{
|
{
|
||||||
@ -101,7 +101,6 @@ def create_accounting_dimension(**args):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
accounting_dimension.save()
|
accounting_dimension.save()
|
||||||
return accounting_dimension.name
|
|
||||||
|
|
||||||
|
|
||||||
def disable_dimension(**args):
|
def disable_dimension(**args):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user