Skip to content

Commit

Permalink
fix: reset dimension defaults when company changedin test
Browse files Browse the repository at this point in the history
(cherry picked from commit 3f5afb9)
  • Loading branch information
GursheenK authored and mergify[bot] committed Aug 18, 2023
1 parent 2a467a9 commit 37ef6e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,7 @@ def test_offsetting_entries_for_accounting_dimensions(self):
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"
Expand Down
13 changes: 6 additions & 7 deletions erpnext/accounts/report/trial_balance/test_trial_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
{
Expand All @@ -101,7 +101,6 @@ def create_accounting_dimension(**args):
},
)
accounting_dimension.save()
return accounting_dimension.name


def disable_dimension(**args):
Expand Down

0 comments on commit 37ef6e9

Please sign in to comment.