fix: zero valuation rate popup on SI (backport #54376) (#54377)

fix: zero valuation rate popup on SI (#54376)

(cherry picked from commit 3ef6c24f07)

Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
This commit is contained in:
mergify[bot]
2026-04-18 12:05:36 +00:00
committed by GitHub
parent 3914d5d1b7
commit 104eac21e8

View File

@@ -142,14 +142,19 @@ class StockController(AccountsController):
]:
for item in self.get("items"):
if (
(item.get("valuation_rate") == 0 or item.get("incoming_rate") == 0)
(
item.get("valuation_rate") == 0
or (item.get("incoming_rate") == 0 and self.get("update_stock", 1))
)
and item.get("allow_zero_valuation_rate") == 0
and frappe.get_cached_value("Item", item.item_code, "is_stock_item")
):
frappe.toast(
_(
"Row #{0}: Item {1} has zero rate but 'Allow Zero Valuation Rate' is not enabled."
).format(item.idx, frappe.bold(item.item_code)),
_("Row #{0}: Item {1} has zero rate but '{2}' is not enabled.").format(
item.idx,
frappe.bold(item.item_code),
item.meta.get_label("allow_zero_valuation_rate"),
),
indicator="orange",
)