summaryrefslogtreecommitdiff
path: root/addons/mrp_subcontracting/models/stock_picking.py
diff options
context:
space:
mode:
authorArnold Moyaux <arm@odoo.com>2019-08-14 14:05:51 +0000
committerArnold Moyaux <arm@odoo.com>2019-08-19 15:03:59 +0000
commita3aeabd44d36dd735d4bfd78c65fc8f850578c60 (patch)
tree1789d82e22d3d25bbee05751a27586fae5f7cbef /addons/mrp_subcontracting/models/stock_picking.py
parentd15137394153a912460f664653b359b3d2c17b53 (diff)
[FIX] mrp: do not base default on active_id
Since active_id do not works allows to use a context key that will not be modified magically.
Diffstat (limited to 'addons/mrp_subcontracting/models/stock_picking.py')
-rw-r--r--addons/mrp_subcontracting/models/stock_picking.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/addons/mrp_subcontracting/models/stock_picking.py b/addons/mrp_subcontracting/models/stock_picking.py
index 6a16740a951..cd310f5ea3f 100644
--- a/addons/mrp_subcontracting/models/stock_picking.py
+++ b/addons/mrp_subcontracting/models/stock_picking.py
@@ -60,7 +60,7 @@ class StockPicking(models.Model):
})
else:
for move_line in move.move_line_ids:
- produce = self.env['mrp.product.produce'].create({
+ produce = self.env['mrp.product.produce'].with_context(default_production_id=production.id).create({
'production_id': production.id,
'qty_producing': move_line.qty_done,
'product_uom_id': move_line.product_uom_id.id,
@@ -83,16 +83,12 @@ class StockPicking(models.Model):
def action_record_components(self):
self.ensure_one()
for move in self.move_lines:
+ if not move._has_tracked_subcontract_components():
+ continue
production = move.move_orig_ids.production_id
if not production or production.state in ('done', 'to_close'):
continue
- action = self.env.ref('mrp.act_mrp_product_produce').read()[0]
- action['context'] = dict(
- self.env.context,
- active_id=production.id,
- default_subcontract_move_id=move.id
- )
- return action
+ return move._action_record_components()
# -------------------------------------------------------------------------
# Subcontract helpers