refactor: show advance payments in AR/AP report

This commit is contained in:
ruthra kumar 2022-05-30 18:49:17 +05:30
parent dfe3082596
commit cd9d70d6ee

View File

@ -7,6 +7,7 @@ from collections import OrderedDict
import frappe
from frappe import _, qb, scrub
from frappe.query_builder import Criterion
from frappe.query_builder.functions import Date
from frappe.utils import cint, cstr, flt, getdate, nowdate
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
@ -654,7 +655,18 @@ class ReceivablePayableReport(object):
self.prepare_conditions()
self.qb_selection_filter.append(self.ple.posting_date.lte(self.filters.report_date))
if self.filters.show_future_payments:
self.qb_selection_filter.append(
(
self.ple.posting_date.lte(self.filters.report_date)
| (
(self.ple.voucher_no == self.ple.against_voucher_no)
& (Date(self.ple.creation).lte(self.filters.report_date))
)
)
)
else:
self.qb_selection_filter.append(self.ple.posting_date.lte(self.filters.report_date))
ple = qb.DocType("Payment Ledger Entry")
query = (