From 0e443f7c74c6ed2aa004a95ff6811b9db260aa1c Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 9 Jan 2025 14:19:42 +0530 Subject: [PATCH] refactor: use reconciliation date, if set --- 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 78a62cd4d5eee..a89293b2844fe 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1506,9 +1506,9 @@ def add_advance_gl_for_reference(self, gl_entries, invoice): "voucher_detail_no": invoice.name, } - if self.reconcile_on_advance_payment_date: + if self.advance_payment_reconciliation_takes_effect_on == "Advance Payment Date": posting_date = self.posting_date - else: + elif self.advance_payment_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" @@ -1516,6 +1516,8 @@ def add_advance_gl_for_reference(self, gl_entries, invoice): if getdate(posting_date) < getdate(self.posting_date): posting_date = self.posting_date + elif self.advance_payment_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