[Fix] Division by zero issue (#13362)

This commit is contained in:
rohitwaghchaure 2018-03-22 11:16:00 +05:30 committed by Nabin Hait
parent a3714e1678
commit 23fa8893a8
2 changed files with 3 additions and 2 deletions

View File

@ -285,7 +285,7 @@ class StatusUpdater(Document):
ifnull((select
ifnull(sum(if(%(target_ref_field)s > %(target_field)s, abs(%(target_field)s), abs(%(target_ref_field)s))), 0)
/ sum(abs(%(target_ref_field)s)) * 100
from `tab%(target_dt)s` where parent="%(name)s"), 0), 2)
from `tab%(target_dt)s` where parent="%(name)s" having sum(abs(%(target_ref_field)s)) > 0), 0), 2)
%(update_modified)s
where name='%(name)s'""" % args)

View File

@ -309,7 +309,8 @@ class DeliveryNote(SellingController):
for dn in set(updated_delivery_notes):
dn_doc = self if (dn == self.name) else frappe.get_doc("Delivery Note", dn)
dn_doc.update_billing_percentage(update_modified=update_modified)
if dn_doc.net_total > 0:
dn_doc.update_billing_percentage(update_modified=update_modified)
self.load_from_db()