Skip to content

Commit

Permalink
fix: fetch acc dimensions correctly when fieldname is different from …
Browse files Browse the repository at this point in the history
…name

(cherry picked from commit e19a6f5)
  • Loading branch information
GursheenK authored and mergify[bot] committed Aug 18, 2023
1 parent cdb66bf commit 7ac35b4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions erpnext/accounts/general_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def get_accounting_dimensions_for_offsetting_entry(gl_map, company):
frappe.qb.from_(acc_dimension)
.inner_join(dimension_detail)
.on(acc_dimension.name == dimension_detail.parent)
.select(acc_dimension.name, dimension_detail.offsetting_account)
.select(acc_dimension.fieldname, dimension_detail.offsetting_account)
.where(
(acc_dimension.disabled == 0)
& (dimension_detail.company == company)
Expand All @@ -97,8 +97,7 @@ def get_accounting_dimensions_for_offsetting_entry(gl_map, company):
).run(as_dict=True)
accounting_dimensions_to_offset = []
for acc_dimension in acc_dimensions:
fieldname = acc_dimension.name.lower().replace(" ", "_")
values = set([entry.get(fieldname) for entry in gl_map])
values = set([entry.get(acc_dimension.fieldname) for entry in gl_map])
if len(values) > 1:
accounting_dimensions_to_offset.append(acc_dimension)
return accounting_dimensions_to_offset
Expand Down

0 comments on commit 7ac35b4

Please sign in to comment.