From b99f8fd0213d6b4f608da9498dbf5947f28f0a5f Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 3 Jun 2025 18:18:55 +0530 Subject: [PATCH] fix: zero division error in purchase receipt (cherry picked from commit 32229fb64600077d3013be46f99b980e43e3c02c) --- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index c8c81c2a124..f38375f943f 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -1146,7 +1146,7 @@ def update_billing_percentage(pr_doc, update_modified=True, adjust_incoming_rate adjusted_amt = flt(adjusted_amt * flt(pr_doc.conversion_rate), item.precision("amount")) item.db_set("amount_difference_with_purchase_invoice", adjusted_amt, update_modified=False) - elif item.billed_amt > amount: + elif amount and item.billed_amt > amount: per_over_billed = (flt(item.billed_amt / amount, 2) * 100) - 100 if per_over_billed > over_billing_allowance: frappe.throw(