[FIX] mrp_subcontracting: lot_id instead of lot_name in receipt

Usecase to reproduce:
- Create a subcontracted product tracked without tracked components
- Create a receipt for this product
- Click on show detail

-> Lot_id are display even if the picking type uses create lot.
The assign serial feature is not working either.

The lot_id instead of lot_name is required in case of tracked
components since it will open the produce wizard and the user
will create lot there. However in the case of non-tracked components,
the wizard will not be used nor lot created. In this case the
classic behavior should be used with lot_name

closes odoo/odoo#43997

Task: 2180191
X-original-commit: 00fe4186935435f46a0db197c68e6df956fe80db
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
Arnold Moyaux
2020-01-27 12:38:13 +00:00
parent b0da38e82f
commit d39fc89324
@@ -71,7 +71,7 @@ class StockMove(models.Model):
float_compare(self.quantity_done, self.product_uom_qty, precision_rounding=rounding) < 0:
return self._action_record_components()
action = super(StockMove, self).action_show_details()
if self.is_subcontract:
if self.is_subcontract and self._has_tracked_subcontract_components():
action['views'] = [(self.env.ref('stock.view_stock_move_operations').id, 'form')]
action['context'].update({
'show_lots_m2o': self.has_tracking != 'none',