[FIX] stock: filtered related product_id field will overwrite on create
Assume a situation where you trigger a method which is going to create a
nested picking with move_lines included and having a filter set which
means that your context includes {'default_product_id': 20}
{
'location_dest_id': 9,
'location_id': 19,
'move_lines': [(0,
0,
{'location_dest_id': 1,
'location_id': 2,
'name': u'name',
'partner_id': 1,
'product_id': 10,
'product_uom': 1,
'product_uom_qty': 1.0})],
'origin': u'Origin',
'partner_id': 1,
'picking_type_id': 59
}
Before the creation of the objects it will inject the default product in
the top level of the dict which should create a picking with one or more
move_lines.
Based on this this injection will overwrite all product_id values of the
created move lines as the picking is created last and the default value
will write ALL move lines with this specific product from the context.
closes odoo/odoo#45076
X-original-commit: 1da687b644e581081ce21687c5eb32285c872a2a
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
committed by
Nicolas Martinelli
parent
d8dc4cbafc
commit
8496ffbc03
@@ -363,7 +363,8 @@ class Picking(models.Model):
|
||||
is_locked = fields.Boolean(default=True, help='When the picking is not done this allows changing the '
|
||||
'initial demand. When the picking is done this allows '
|
||||
'changing the done quantities.')
|
||||
product_id = fields.Many2one('product.product', 'Product', related='move_lines.product_id', readonly=False)
|
||||
# Used to search on pickings
|
||||
product_id = fields.Many2one('product.product', 'Product', related='move_lines.product_id', readonly=True)
|
||||
show_operations = fields.Boolean(compute='_compute_show_operations')
|
||||
show_reserved = fields.Boolean(related='picking_type_id.show_reserved')
|
||||
show_lots_text = fields.Boolean(compute='_compute_show_lots_text')
|
||||
|
||||
Reference in New Issue
Block a user