Files
erpnext/erpnext/manufacturing
Mihir Kandoi affd2fd95d fix(manufacturing): guard average bin valuation-rate division against a zero divisor (Postgres)
_get_avg_valuation_rate_from_bins divides Sum(stock_value) by Sum(actual_qty).
The `Count(name) > 0` guard only proves a Bin row exists; Sum(actual_qty) can
still be 0 (stock depleted, or per-warehouse quantities cancelling out), and
the outer IfNull catches only NULL, not a 0 divisor.

MariaDB returns NULL for x/0 (then IfNull -> 0.0); PostgreSQL raises
`division by zero` and aborts BOM costing. Wrapping the divisor in
NullIf(Sum(actual_qty), 0) keeps the identical 0.0 result on MariaDB and
avoids the error on PostgreSQL.
2026-06-23 17:49:26 +05:30
..
2026-06-13 19:09:04 +05:30
2013-12-11 10:43:52 +05:30

Plan and manage manufacturing operations, bill of materials for manufacturing.