[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:
Daniel-CA 2016-05-31 17:55:27 +02:00 committed by Martin Trigaux
parent 5537c5a13c
commit 5e466d3507
No known key found for this signature in database
GPG Key ID: 7B0E288E7C0F83A7
1 changed files with 1 additions and 1 deletions

View File

@ -125,7 +125,7 @@ class stock_history(osv.osv):
product_categ_id, product_categ_id,
SUM(quantity) as quantity, SUM(quantity) as quantity,
date, 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 source
FROM FROM
((SELECT ((SELECT