From 7ecb78adfaac4a7972f7ce90eefe6830fbba9e7a Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 17 Mar 2015 16:21:33 +0100 Subject: [PATCH] [FIX] mrp: cancel remaining products to consume if no more products to produce opw: 630222 --- addons/mrp/mrp.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index fabeeca0fe3..3d933fc0dbf 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -986,6 +986,11 @@ class mrp_production(osv.osv): stock_mov_obj.action_done(cr, uid, [extra_move_id], context=context) self.message_post(cr, uid, production_id, body=_("%s produced") % self._description, context=context) + + # Remove remaining products to consume if no more products to produce + if not production.move_created_ids and production.move_lines: + stock_mov_obj.action_cancel(cr, uid, [x.id for x in production.move_lines], context=context) + self.signal_workflow(cr, uid, [production_id], 'button_produce_done') return True