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

This commit is contained in:
Mihir Kandoi
2026-04-18 17:14:49 +05:30
committed by GitHub
parent b93f2350ee
commit 3ef6c24f07

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",
)