From 4f9242d699e8aa5c5595a12cafe763737978b01b Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Thu, 27 Jul 2023 15:45:48 +0530 Subject: [PATCH] fix: dimension name in remark --- erpnext/accounts/general_ledger.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py index eacb318d04..a348911f03 100644 --- a/erpnext/accounts/general_ledger.py +++ b/erpnext/accounts/general_ledger.py @@ -66,15 +66,16 @@ def make_acc_dimensions_offsetting_entry(gl_map): offsetting_entries = [] for gle in gl_map: for dimension in accounting_dimensions_to_offset: - offsetting_account = dimension.offsetting_account offsetting_entry = gle.copy() + debit = flt(gle.credit) / no_of_dimensions if gle.credit != 0 else 0 + credit = flt(gle.debit) / no_of_dimensions if gle.debit != 0 else 0 offsetting_entry.update( { - "account": offsetting_account, - "debit": flt(gle.credit) / no_of_dimensions if gle.credit != 0 else 0, - "credit": flt(gle.debit) / no_of_dimensions if gle.debit != 0 else 0, - "debit_in_account_currency": flt(gle.credit) / no_of_dimensions if gle.credit != 0 else 0, - "credit_in_account_currency": flt(gle.debit) / no_of_dimensions if gle.debit != 0 else 0, + "account": dimension.offsetting_account, + "debit": debit, + "credit": credit, + "debit_in_account_currency": debit, + "credit_in_account_currency": credit, "remarks": _("Offsetting for Accounting Dimension") + " - {0}".format(dimension.name), "against_voucher": None, } @@ -91,7 +92,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.fieldname, dimension_detail.offsetting_account) + .select(acc_dimension.fieldname, acc_dimension.name, dimension_detail.offsetting_account) .where( (acc_dimension.disabled == 0) & (dimension_detail.company == company)