refactor: handle dynamic dimension in order query

This commit is contained in:
ruthra kumar 2024-01-22 12:06:07 +05:30
parent ec0f17ca8b
commit 7c2cb70387

View File

@ -1925,6 +1925,12 @@ def get_orders_to_be_billed(
if doc and hasattr(doc, "cost_center") and doc.cost_center:
condition = " and cost_center='%s'" % cost_center
# dynamic dimension filters
active_dimensions = get_dimensions()[0]
for dim in active_dimensions:
if filters.get(dim.fieldname):
condition += " and {0}='{1}'".format(dim.fieldname, filters.get(dim.fieldname))
if party_account_currency == company_currency:
grand_total_field = "base_grand_total"
rounded_total_field = "base_rounded_total"