From 74f00bb51b9a40fb8b1b4b3879cd56183c940a19 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 9 Jan 2025 20:09:20 +0530 Subject: [PATCH] refactor: payment entry to handle posting date on configuation (cherry picked from commit bb8d2c994cd445308d7da66f89cca18043cbf793) --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index acc0b55b158..48ed975cf37 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1493,9 +1493,9 @@ class PaymentEntry(AccountsController): "voucher_detail_no": invoice.name, } - if self.reconcile_on_advance_payment_date: + if self.advance_reconciliation_takes_effect_on == "Advance Payment Date": posting_date = self.posting_date - else: + elif self.advance_reconciliation_takes_effect_on == "Oldest Of Invoice Or Advance": date_field = "posting_date" if invoice.reference_doctype in ["Sales Order", "Purchase Order"]: date_field = "transaction_date" @@ -1503,6 +1503,8 @@ class PaymentEntry(AccountsController): if getdate(posting_date) < getdate(self.posting_date): posting_date = self.posting_date + elif self.advance_reconciliation_takes_effect_on == "Reconciliation Date": + posting_date = nowdate() dr_or_cr, account = self.get_dr_and_account_for_advances(invoice) args_dict["account"] = account