Skip to content

Commit

Permalink
Merge pull request #40460 from frappe/mergify/bp/version-15-hotfix/pr…
Browse files Browse the repository at this point in the history
…-40420

fix: advance journal fetching logic in Advances section (backport #40420)
  • Loading branch information
ruthra-kumar authored Mar 14, 2024
2 parents 54b5064 + bfa78aa commit 3fe4540
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions erpnext/controllers/accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2669,14 +2669,20 @@ def get_advance_journal_entries(
else:
q = q.where(journal_acc.debit_in_account_currency > 0)

reference_or_condition = []

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:
q = q.where(
reference_or_condition.append(
(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)

journal_entries = q.run(as_dict=True)
Expand Down

0 comments on commit 3fe4540

Please sign in to comment.