Skip to content

Commit

Permalink
refactor: use reconciliation date, if set
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Jan 9, 2025
1 parent 57d8ed2 commit 0e443f7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions erpnext/accounts/doctype/payment_entry/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1506,16 +1506,18 @@ 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"
posting_date = frappe.db.get_value(invoice.reference_doctype, invoice.reference_name, date_field)

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
Expand Down

0 comments on commit 0e443f7

Please sign in to comment.