mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-18 20:49:19 +00:00
chore: simplify repeated condition checks
This commit is contained in:
@@ -1571,15 +1571,12 @@ class PaymentEntry(AccountsController):
|
|||||||
else:
|
else:
|
||||||
# For backwards compatibility
|
# For backwards compatibility
|
||||||
# Supporting reposting on payment entries reconciled before select field introduction
|
# Supporting reposting on payment entries reconciled before select field introduction
|
||||||
if (
|
reconciliation_takes_effect_on = frappe.get_cached_value(
|
||||||
frappe.get_cached_value("Company", self.company, "reconciliation_takes_effect_on")
|
"Company", self.company, "reconciliation_takes_effect_on"
|
||||||
== "Advance Payment Date"
|
)
|
||||||
):
|
if reconciliation_takes_effect_on == "Advance Payment Date":
|
||||||
posting_date = self.posting_date
|
posting_date = self.posting_date
|
||||||
elif (
|
elif reconciliation_takes_effect_on == "Oldest Of Invoice Or Advance":
|
||||||
frappe.get_cached_value("Company", self.company, "reconciliation_takes_effect_on")
|
|
||||||
== "Oldest Of Invoice Or Advance"
|
|
||||||
):
|
|
||||||
date_field = "posting_date"
|
date_field = "posting_date"
|
||||||
if invoice.reference_doctype in ["Sales Order", "Purchase Order"]:
|
if invoice.reference_doctype in ["Sales Order", "Purchase Order"]:
|
||||||
date_field = "transaction_date"
|
date_field = "transaction_date"
|
||||||
@@ -1589,10 +1586,7 @@ class PaymentEntry(AccountsController):
|
|||||||
|
|
||||||
if getdate(posting_date) < getdate(self.posting_date):
|
if getdate(posting_date) < getdate(self.posting_date):
|
||||||
posting_date = self.posting_date
|
posting_date = self.posting_date
|
||||||
elif (
|
elif reconciliation_takes_effect_on == "Reconciliation Date":
|
||||||
frappe.get_cached_value("Company", self.company, "reconciliation_takes_effect_on")
|
|
||||||
== "Reconciliation Date"
|
|
||||||
):
|
|
||||||
posting_date = nowdate()
|
posting_date = nowdate()
|
||||||
frappe.db.set_value("Payment Entry Reference", invoice.name, "reconcile_effect_on", posting_date)
|
frappe.db.set_value("Payment Entry Reference", invoice.name, "reconcile_effect_on", posting_date)
|
||||||
|
|
||||||
|
|||||||
@@ -731,16 +731,13 @@ def update_reference_in_payment_entry(
|
|||||||
update_advance_paid = []
|
update_advance_paid = []
|
||||||
|
|
||||||
# Update Reconciliation effect date in reference
|
# Update Reconciliation effect date in reference
|
||||||
|
reconciliation_takes_effect_on = frappe.get_cached_value(
|
||||||
|
"Company", payment_entry.company, "reconciliation_takes_effect_on"
|
||||||
|
)
|
||||||
if payment_entry.book_advance_payments_in_separate_party_account:
|
if payment_entry.book_advance_payments_in_separate_party_account:
|
||||||
if (
|
if reconciliation_takes_effect_on == "Advance Payment Date":
|
||||||
frappe.get_cached_value("Company", payment_entry.company, "reconciliation_takes_effect_on")
|
|
||||||
== "Advance Payment Date"
|
|
||||||
):
|
|
||||||
reconcile_on = payment_entry.posting_date
|
reconcile_on = payment_entry.posting_date
|
||||||
elif (
|
elif reconciliation_takes_effect_on == "Oldest Of Invoice Or Advance":
|
||||||
frappe.get_cached_value("Company", payment_entry.company, "reconciliation_takes_effect_on")
|
|
||||||
== "Oldest Of Invoice Or Advance"
|
|
||||||
):
|
|
||||||
date_field = "posting_date"
|
date_field = "posting_date"
|
||||||
if d.against_voucher_type in ["Sales Order", "Purchase Order"]:
|
if d.against_voucher_type in ["Sales Order", "Purchase Order"]:
|
||||||
date_field = "transaction_date"
|
date_field = "transaction_date"
|
||||||
@@ -748,10 +745,7 @@ def update_reference_in_payment_entry(
|
|||||||
|
|
||||||
if getdate(reconcile_on) < getdate(payment_entry.posting_date):
|
if getdate(reconcile_on) < getdate(payment_entry.posting_date):
|
||||||
reconcile_on = payment_entry.posting_date
|
reconcile_on = payment_entry.posting_date
|
||||||
elif (
|
elif reconciliation_takes_effect_on == "Reconciliation Date":
|
||||||
frappe.get_cached_value("Company", payment_entry.company, "reconciliation_takes_effect_on")
|
|
||||||
== "Reconciliation Date"
|
|
||||||
):
|
|
||||||
reconcile_on = nowdate()
|
reconcile_on = nowdate()
|
||||||
|
|
||||||
reference_details.update({"reconcile_effect_on": reconcile_on})
|
reference_details.update({"reconcile_effect_on": reconcile_on})
|
||||||
|
|||||||
Reference in New Issue
Block a user