refactor: add guard clause in for loop
Reduce overly indented code/improve readability.
This commit is contained in:
parent
43bf82b58b
commit
5e4fbba753
@ -986,14 +986,17 @@ class AccountsController(TransactionBase):
|
|||||||
total_overbilled_amt = 0.0
|
total_overbilled_amt = 0.0
|
||||||
|
|
||||||
for item in self.get("items"):
|
for item in self.get("items"):
|
||||||
if item.get(item_ref_dn):
|
if not item.get(item_ref_dn):
|
||||||
|
continue
|
||||||
|
|
||||||
ref_amt = flt(frappe.db.get_value(ref_dt + " Item",
|
ref_amt = flt(frappe.db.get_value(ref_dt + " Item",
|
||||||
item.get(item_ref_dn), based_on), self.precision(based_on, item))
|
item.get(item_ref_dn), based_on), self.precision(based_on, item))
|
||||||
if not ref_amt:
|
if not ref_amt:
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_("Warning: System will not check overbilling since amount for Item {0} in {1} is zero")
|
_("Warning: System will not check overbilling since amount for Item {0} in {1} is zero")
|
||||||
.format(item.item_code, ref_dt))
|
.format(item.item_code, ref_dt))
|
||||||
else:
|
continue
|
||||||
|
|
||||||
already_billed = frappe.db.sql("""
|
already_billed = frappe.db.sql("""
|
||||||
select sum(%s)
|
select sum(%s)
|
||||||
from `tab%s`
|
from `tab%s`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user