From 4e09de4db2d13fc251d36378cc9aaff775ff910c Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Mon, 17 Jul 2023 11:47:33 +0530 Subject: [PATCH] fix: fetch accounting dimension details specific to company --- .../accounts/doctype/journal_entry/journal_entry.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index ed6122c57d..334e8b002c 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -915,10 +915,11 @@ class JournalEntry(AccountsController): for dimension in accounting_dimensions: dimension_details = frappe.db.get_values( "Accounting Dimension Detail", - {"parent": dimension}, + {"parent": dimension, "company": self.company}, ["automatically_post_balancing_accounting_entry", "offsetting_account"], - )[0] - if dimension_details[0] == 1: + ) + dimension_details = dimension_details[0] if len(dimension_details) > 0 else None + if dimension_details and dimension_details[0] == 1: offsetting_account = dimension_details[1] gl_map.append( self.get_gl_dict( @@ -939,9 +940,7 @@ class JournalEntry(AccountsController): ), "against_voucher_type": d.reference_type, "against_voucher": d.reference_name, - "remarks": _( - "Offsetting for Accounting Dimension - {dimension}".format(dimension=dimension) - ), + "remarks": _("Offsetting for Accounting Dimension") + " - {0}".format(dimension), "voucher_detail_no": d.reference_detail_no, "cost_center": d.cost_center, "project": d.project,