From 3f16ed9ef7fef1cf6a795084c03712a2ba952690 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 9 Feb 2017 15:51:08 +0100 Subject: [PATCH] [FIX] mrp: crash onchange In a MO, change a product in "Consumed Materials" by clicking on "Search more...". It crashes. Clicking on "Search more..." triggers the onchange since it empties the line. Since there is no product on the line anymore, it crashes. opw-705644 --- addons/mrp/models/stock_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index 6dde0af4f26..3c6a99fa6eb 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -87,7 +87,7 @@ class StockMove(models.Model): # For consumables, state is available so availability = qty to do if move.state == 'assigned': move.quantity_available = move.product_uom_qty - else: + elif move.product_id.uom_id and move.product_uom: move.quantity_available = move.product_id.uom_id._compute_quantity(move.reserved_availability, move.product_uom) @api.multi