Skip to content

Commit

Permalink
fix: handle division by zero error (backport #45966) (#46015)
Browse files Browse the repository at this point in the history
fix: handle division by zero error (#45966)

Co-authored-by: Sanket322 <shahsanket322003.com>
(cherry picked from commit 2439476)

Co-authored-by: Sanket Shah <113279972+Sanket322@users.noreply.github.com>
  • Loading branch information
mergify[bot] and Sanket322 authored Feb 19, 2025
1 parent 452e4dc commit 15106b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions erpnext/controllers/status_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import comma_or, flt, get_link_to_form, getdate, now, nowdate
from frappe.utils import comma_or, flt, get_link_to_form, getdate, now, nowdate, safe_div


class OverAllowanceError(frappe.ValidationError):
Expand Down Expand Up @@ -543,7 +543,7 @@ def update_billing_status(self, zero_amount_refdoc, ref_dt, ref_fieldname):
)[0][0]
)

per_billed = (min(ref_doc_qty, billed_qty) / ref_doc_qty) * 100
per_billed = safe_div(min(ref_doc_qty, billed_qty), ref_doc_qty) * 100

ref_doc = frappe.get_doc(ref_dt, ref_dn)

Expand Down

0 comments on commit 15106b4

Please sign in to comment.