fix: advance journal fetching logic in Advances section

(cherry picked from commit e786a93c2e)
This commit is contained in:
ruthra kumar
2024-03-12 21:29:44 +05:30
committed by Mergify
parent 54b5064f76
commit bfa78aaf74

View File

@@ -2669,14 +2669,20 @@ def get_advance_journal_entries(
else: else:
q = q.where(journal_acc.debit_in_account_currency > 0) q = q.where(journal_acc.debit_in_account_currency > 0)
reference_or_condition = []
if include_unallocated: if include_unallocated:
q = q.where((journal_acc.reference_name.isnull()) | (journal_acc.reference_name == "")) reference_or_condition.append(journal_acc.reference_name.isnull())
reference_or_condition.append(journal_acc.reference_name == "")
if order_list: if order_list:
q = q.where( reference_or_condition.append(
(journal_acc.reference_type == order_doctype) & ((journal_acc.reference_name).isin(order_list)) (journal_acc.reference_type == order_doctype) & ((journal_acc.reference_name).isin(order_list))
) )
if reference_or_condition:
q = q.where(Criterion.any(reference_or_condition))
q = q.orderby(journal_entry.posting_date) q = q.orderby(journal_entry.posting_date)
journal_entries = q.run(as_dict=True) journal_entries = q.run(as_dict=True)