From 2ed3bdcc2e3b9deabd9de5b01b539213c7bf62d1 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Fri, 7 Feb 2025 11:43:25 +0100 Subject: [PATCH] fix: skip warning for free items (cherry picked from commit 772776ad8a91d082b66dc8c45052f703902b3691) --- erpnext/controllers/accounts_controller.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 160c478f299..14dc038b0d6 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1728,22 +1728,22 @@ class AccountsController(TransactionBase): continue ref_amt = flt(reference_details.get(item.get(item_ref_dn)), self.precision(based_on, item)) + based_on_amt = flt(item.get(based_on)) if not ref_amt: - frappe.msgprint( - _("System will not check over billing since amount for Item {0} in {1} is zero").format( - item.item_code, ref_dt - ), - title=_("Warning"), - indicator="orange", - ) + if based_on_amt: # Skip warning for free items + frappe.msgprint( + _( + "System will not check over billing since amount for Item {0} in {1} is zero" + ).format(item.item_code, ref_dt), + title=_("Warning"), + indicator="orange", + ) continue already_billed = self.get_billed_amount_for_item(item, item_ref_dn, based_on) - total_billed_amt = flt( - flt(already_billed) + flt(item.get(based_on)), self.precision(based_on, item) - ) + total_billed_amt = flt(flt(already_billed) + based_on_amt, self.precision(based_on, item)) allowance, item_allowance, global_qty_allowance, global_amount_allowance = get_allowance_for( item.item_code, item_allowance, global_qty_allowance, global_amount_allowance, "amount"