mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 19:29:10 +00:00
refactor: early return is always better
validate_advance_entries() has a heavy IO bound operation. Early
return on unwanted cases is always better.
(cherry picked from commit 0589fa7f3e)
# Conflicts:
# erpnext/controllers/accounts_controller.py
This commit is contained in:
@@ -424,6 +424,9 @@ class AccountsController(TransactionBase):
|
|||||||
self.payment_terms_template = ""
|
self.payment_terms_template = ""
|
||||||
self.payment_schedule = []
|
self.payment_schedule = []
|
||||||
|
|
||||||
|
if self.is_return:
|
||||||
|
return
|
||||||
|
|
||||||
self.validate_payment_schedule_dates()
|
self.validate_payment_schedule_dates()
|
||||||
self.set_due_date()
|
self.set_due_date()
|
||||||
self.set_payment_schedule()
|
self.set_payment_schedule()
|
||||||
@@ -2181,6 +2184,9 @@ class AccountsController(TransactionBase):
|
|||||||
dates = []
|
dates = []
|
||||||
li = []
|
li = []
|
||||||
|
|
||||||
|
if self.doctype == "Sales Invoice" and self.is_pos:
|
||||||
|
return
|
||||||
|
|
||||||
for d in self.get("payment_schedule"):
|
for d in self.get("payment_schedule"):
|
||||||
if self.doctype == "Sales Order" and getdate(d.due_date) < getdate(self.transaction_date):
|
if self.doctype == "Sales Order" and getdate(d.due_date) < getdate(self.transaction_date):
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
@@ -2197,12 +2203,18 @@ class AccountsController(TransactionBase):
|
|||||||
frappe.throw(_("Rows with duplicate due dates in other rows were found: {0}").format(duplicates))
|
frappe.throw(_("Rows with duplicate due dates in other rows were found: {0}").format(duplicates))
|
||||||
|
|
||||||
def validate_payment_schedule_amount(self):
|
def validate_payment_schedule_amount(self):
|
||||||
|
<<<<<<< HEAD
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
if self.doctype == "Sales Invoice" and self.is_pos:
|
if self.doctype == "Sales Invoice" and self.is_pos:
|
||||||
return
|
return
|
||||||
|
|
||||||
=======
|
=======
|
||||||
>>>>>>> e1fc239f3d (fix: clear payment schedule in purchase invoice for is_paid)
|
>>>>>>> e1fc239f3d (fix: clear payment schedule in purchase invoice for is_paid)
|
||||||
|
=======
|
||||||
|
if (self.doctype == "Sales Invoice" and self.is_pos) or self.get("is_opening") == "Yes":
|
||||||
|
return
|
||||||
|
|
||||||
|
>>>>>>> 0589fa7f3e (refactor: early return is always better)
|
||||||
party_account_currency = self.get("party_account_currency")
|
party_account_currency = self.get("party_account_currency")
|
||||||
if not party_account_currency:
|
if not party_account_currency:
|
||||||
party_type, party = self.get_party()
|
party_type, party = self.get_party()
|
||||||
|
|||||||
Reference in New Issue
Block a user