[FIX] stock_account: prevent division by zero
In case of a move where source location = destination location, the result of SUM(quantity) would be 0 and ending up with a division by zero. Closes #12247 Closes #12423
This commit is contained in:
parent
5537c5a13c
commit
5e466d3507
|
@ -125,7 +125,7 @@ class stock_history(osv.osv):
|
|||
product_categ_id,
|
||||
SUM(quantity) as quantity,
|
||||
date,
|
||||
SUM(price_unit_on_quant * quantity) / SUM(quantity) as price_unit_on_quant,
|
||||
COALESCE(SUM(price_unit_on_quant * quantity) / NULLIF(SUM(quantity), 0), 0) as price_unit_on_quant,
|
||||
source
|
||||
FROM
|
||||
((SELECT
|
||||
|
|
Loading…
Reference in New Issue