fix: fetch accounting dimension details specific to company

This commit is contained in:
Gursheen Anand 2023-07-17 11:47:33 +05:30
parent d3759b3971
commit 4e09de4db2

View File

@ -915,10 +915,11 @@ class JournalEntry(AccountsController):
for dimension in accounting_dimensions: for dimension in accounting_dimensions:
dimension_details = frappe.db.get_values( dimension_details = frappe.db.get_values(
"Accounting Dimension Detail", "Accounting Dimension Detail",
{"parent": dimension}, {"parent": dimension, "company": self.company},
["automatically_post_balancing_accounting_entry", "offsetting_account"], ["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] offsetting_account = dimension_details[1]
gl_map.append( gl_map.append(
self.get_gl_dict( self.get_gl_dict(
@ -939,9 +940,7 @@ class JournalEntry(AccountsController):
), ),
"against_voucher_type": d.reference_type, "against_voucher_type": d.reference_type,
"against_voucher": d.reference_name, "against_voucher": d.reference_name,
"remarks": _( "remarks": _("Offsetting for Accounting Dimension") + " - {0}".format(dimension),
"Offsetting for Accounting Dimension - {dimension}".format(dimension=dimension)
),
"voucher_detail_no": d.reference_detail_no, "voucher_detail_no": d.reference_detail_no,
"cost_center": d.cost_center, "cost_center": d.cost_center,
"project": d.project, "project": d.project,