summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2018-10-08 15:26:02 +0000
committerGoffin Simon <sig@odoo.com>2018-10-09 07:45:59 +0000
commit736f49baef76f6a6abb6c3e2eb2d96428a4e2faa (patch)
treed8b7006c07f6c4a568faa1b88c9c982611bd79f2 /addons
parent798d21ee3f197c2aaa4b990574bee7133df764c5 (diff)
[FIX] stock_account: float division by zero
Steps to reproduce: - Create a stockable product P with 2 quantity on hand - Choose a delivery order in state 'done', unlock it and add a line with P - Try to set 2 as done quantity and confirm the wizard Bug: A ZeroDivisionError(float division by zero) was raised. opw:1886735 closes odoo/odoo#27547
Diffstat (limited to 'addons')
-rw-r--r--addons/stock/models/stock_move_line.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/addons/stock/models/stock_move_line.py b/addons/stock/models/stock_move_line.py
index 81fda382d91..e965ea28d0b 100644
--- a/addons/stock/models/stock_move_line.py
+++ b/addons/stock/models/stock_move_line.py
@@ -185,6 +185,8 @@ class StockMoveLine(models.Model):
ml = super(StockMoveLine, self).create(vals)
if ml.state == 'done':
+ if 'qty_done' in vals:
+ ml.move_id.product_uom_qty = ml.move_id.quantity_done
if ml.product_id.type == 'product':
Quant = self.env['stock.quant']
quantity = ml.product_uom_id._compute_quantity(ml.qty_done, ml.move_id.product_id.uom_id,rounding_method='HALF-UP')