refactor: pull remarks only if needed on AR/AP report

(cherry picked from commit eb73017798eed964e8f019db4cef3513162855f6)
This commit is contained in:
ruthra kumar 2023-10-31 17:30:42 +05:30 committed by Mergify
parent 59e67cd384
commit 0589232d3b

View File

@ -718,6 +718,7 @@ class ReceivablePayableReport(object):
query = ( query = (
qb.from_(ple) qb.from_(ple)
.select( .select(
ple.name,
ple.account, ple.account,
ple.voucher_type, ple.voucher_type,
ple.voucher_no, ple.voucher_no,
@ -731,13 +732,15 @@ class ReceivablePayableReport(object):
ple.account_currency, ple.account_currency,
ple.amount, ple.amount,
ple.amount_in_account_currency, ple.amount_in_account_currency,
ple.remarks,
) )
.where(ple.delinked == 0) .where(ple.delinked == 0)
.where(Criterion.all(self.qb_selection_filter)) .where(Criterion.all(self.qb_selection_filter))
.where(Criterion.any(self.or_filters)) .where(Criterion.any(self.or_filters))
) )
if self.filters.get("show_remarks"):
query = query.select(ple.remarks)
if self.filters.get("group_by_party"): if self.filters.get("group_by_party"):
query = query.orderby(self.ple.party, self.ple.posting_date) query = query.orderby(self.ple.party, self.ple.posting_date)
else: else: