Skip to content
Snippets Groups Projects
Commit eddda890 authored by Florian Damhaut's avatar Florian Damhaut
Browse files

[FIX] mrp: Context irrelevant of hidden parameters for stock_mrp


Step to reproduce:
- Inventory > Configuration > Operations Types > Manufacturing (or any other operation type with code 'mrp_operation')
- Change 'Type of Operation' to 'Receipt' (or any other but 'manufacturing')
- Uncheck box field 'Use Existing Lots/Serial Numbers'
- Change 'Type of Operation' back to 'Manufacturing'
- Set correct value for 'Default Source Location' (type Receipt changed the value to 'Vendor', need to fix it)

- Create a storable product with the route 'Manufacture' selected.
- Create a BoM for this product, with a component tracked by lot (Add quantity to component)
- Create a MO for the product > Confirm > Check Availability

Current Behaviour :
Quantity are reserved, but the lot_ids are not visible
The behaviour is due to the fact that hidden parameters still have effect when they should act as their default value. To ensure it's the case, they are set back to their original value when the user switch between configuration to avoid ending in a wrongful configuration.

Behaviour after PR :
Lot ids are shown no matter the hidden configuration of picking type

opw-2680370

closes odoo/odoo#81290

Signed-off-by: default avatarArnold Moyaux <arm@odoo.com>
parent 8d45823f
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
from odoo import fields, models, api
class StockPickingType(models.Model):
......@@ -50,6 +50,12 @@ class StockPickingType(models.Model):
def get_mrp_stock_picking_action_picking_type(self):
return self._get_action('mrp.mrp_production_action_picking_deshboard')
@api.onchange('code')
def _onchange_code(self):
if self.code == 'mrp_operation':
self.use_create_lots = True
self.use_existing_lots = True
class StockPicking(models.Model):
_inherit = 'stock.picking'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment