summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2015-03-17 16:21:33 +0100
committerJosse Colpaert <jco@odoo.com>2015-03-27 13:35:18 +0100
commit7ecb78adfaac4a7972f7ce90eefe6830fbba9e7a (patch)
tree4e9700ff1c4d2d03c381c7fdfb96bc908de3f60d
parent34c891a426717849ef1111c78f41c687e04dac91 (diff)
[FIX] mrp: cancel remaining products to consume if no more products to produce
opw: 630222
-rw-r--r--addons/mrp/mrp.py5
1 files changed, 5 insertions, 0 deletions
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