Skip to content
Snippets Groups Projects
Commit 6a1e272c authored by Nans Lefebvre's avatar Nans Lefebvre
Browse files

[FIX] stock: do not raise if writing the same value


Rewrite the product associated to a serial number.
There is a check to forbid this if some move lines already exist.
This check does not actually care what value is written,
so it can raise uselessly (and forbid a legitimate write).

opw 2049717

closes odoo/odoo#35736

Signed-off-by: default avatarNans Lefebvre (len) <len@odoo.com>
parent c2271c87
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,7 @@ class ProductionLot(models.Model):
@api.multi
def write(self, vals):
if 'product_id' in vals:
move_lines = self.env['stock.move.line'].search([('lot_id', 'in', self.ids)])
move_lines = self.env['stock.move.line'].search([('lot_id', 'in', self.ids), ('product_id', '!=', vals['product_id'])])
if move_lines:
raise UserError(_(
'You are not allowed to change the product linked to a serial or lot number ' +
......
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