fix: handle division by zero error (#45966)

Co-authored-by: Sanket322 <shahsanket322003.com>
This commit is contained in:
Sanket Shah
2025-02-19 15:37:54 +05:30
committed by GitHub
parent fa31a0282e
commit 24394765a6

View File

@@ -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):
@@ -616,7 +616,7 @@ class StatusUpdater(Document):
)[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)