perf: pull latest details only for referenced vouchers
This commit is contained in:
parent
e023e33a15
commit
deb0d71294
@ -230,6 +230,9 @@ class PaymentEntry(AccountsController):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def validate_allocated_amount_with_latest_data(self):
|
def validate_allocated_amount_with_latest_data(self):
|
||||||
|
if self.references:
|
||||||
|
uniq_vouchers = set([(x.reference_doctype, x.reference_name) for x in self.references])
|
||||||
|
vouchers = [frappe._dict({"voucher_type": x[0], "voucher_no": x[1]}) for x in uniq_vouchers]
|
||||||
latest_references = get_outstanding_reference_documents(
|
latest_references = get_outstanding_reference_documents(
|
||||||
{
|
{
|
||||||
"posting_date": self.posting_date,
|
"posting_date": self.posting_date,
|
||||||
@ -240,6 +243,7 @@ class PaymentEntry(AccountsController):
|
|||||||
"party_account": self.paid_from if self.payment_type == "Receive" else self.paid_to,
|
"party_account": self.paid_from if self.payment_type == "Receive" else self.paid_to,
|
||||||
"get_outstanding_invoices": True,
|
"get_outstanding_invoices": True,
|
||||||
"get_orders_to_be_billed": True,
|
"get_orders_to_be_billed": True,
|
||||||
|
"vouchers": vouchers,
|
||||||
},
|
},
|
||||||
validate=True,
|
validate=True,
|
||||||
)
|
)
|
||||||
@ -1587,6 +1591,7 @@ def get_outstanding_reference_documents(args, validate=False):
|
|||||||
min_outstanding=args.get("outstanding_amt_greater_than"),
|
min_outstanding=args.get("outstanding_amt_greater_than"),
|
||||||
max_outstanding=args.get("outstanding_amt_less_than"),
|
max_outstanding=args.get("outstanding_amt_less_than"),
|
||||||
accounting_dimensions=accounting_dimensions_filter,
|
accounting_dimensions=accounting_dimensions_filter,
|
||||||
|
vouchers=args.get("vouchers") or None,
|
||||||
)
|
)
|
||||||
|
|
||||||
outstanding_invoices = split_invoices_based_on_payment_terms(
|
outstanding_invoices = split_invoices_based_on_payment_terms(
|
||||||
|
|||||||
@ -908,6 +908,7 @@ def get_outstanding_invoices(
|
|||||||
min_outstanding=None,
|
min_outstanding=None,
|
||||||
max_outstanding=None,
|
max_outstanding=None,
|
||||||
accounting_dimensions=None,
|
accounting_dimensions=None,
|
||||||
|
vouchers=None,
|
||||||
):
|
):
|
||||||
|
|
||||||
ple = qb.DocType("Payment Ledger Entry")
|
ple = qb.DocType("Payment Ledger Entry")
|
||||||
@ -933,6 +934,7 @@ def get_outstanding_invoices(
|
|||||||
|
|
||||||
ple_query = QueryPaymentLedger()
|
ple_query = QueryPaymentLedger()
|
||||||
invoice_list = ple_query.get_voucher_outstandings(
|
invoice_list = ple_query.get_voucher_outstandings(
|
||||||
|
vouchers=vouchers,
|
||||||
common_filter=common_filter,
|
common_filter=common_filter,
|
||||||
posting_date=posting_date,
|
posting_date=posting_date,
|
||||||
min_outstanding=min_outstanding,
|
min_outstanding=min_outstanding,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user