From 41c8cfac733104c69c1f30b921c667031c146024 Mon Sep 17 00:00:00 2001 From: UmakanthKaspa Date: Mon, 11 Nov 2024 09:18:09 +0000 Subject: [PATCH 1/2] fix: apply posting date sorting to invoices in Payment Reconciliation similar to payments (cherry picked from commit 0bd83d920d42f461ced04a1ca3a35307b9796d16) --- .../payment_reconciliation/payment_reconciliation.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index 35d268accace..b08afc02c01f 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -370,7 +370,11 @@ def get_invoice_entries(self): if self.invoice_limit: non_reconciled_invoices = non_reconciled_invoices[: self.invoice_limit] - + + non_reconciled_invoices = sorted( + non_reconciled_invoices, key=lambda k: k["posting_date"] or getdate(nowdate()) + ) + self.add_invoice_entries(non_reconciled_invoices) def add_invoice_entries(self, non_reconciled_invoices): From 5bd633b40f86d46ebc3bce68e0dc65c88489d81e Mon Sep 17 00:00:00 2001 From: UmakanthKaspa Date: Mon, 11 Nov 2024 18:06:53 +0530 Subject: [PATCH 2/2] fix: remove trailing whitespace (cherry picked from commit d6703eb88b08e358d66bf43a24225db318e1ddc7) --- .../doctype/payment_reconciliation/payment_reconciliation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index b08afc02c01f..bbbb3c978ff9 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -370,11 +370,11 @@ def get_invoice_entries(self): if self.invoice_limit: non_reconciled_invoices = non_reconciled_invoices[: self.invoice_limit] - + non_reconciled_invoices = sorted( non_reconciled_invoices, key=lambda k: k["posting_date"] or getdate(nowdate()) ) - + self.add_invoice_entries(non_reconciled_invoices) def add_invoice_entries(self, non_reconciled_invoices):