refactor: handle dynamic dimension in order query

(cherry picked from commit 7c2cb70387)
This commit is contained in:
ruthra kumar
2024-01-22 12:06:07 +05:30
committed by Mergify
parent 9a3bde9350
commit e70f0f6d8d

View File

@@ -1688,6 +1688,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"