diff --git a/addons/stock/i18n/stock.pot b/addons/stock/i18n/stock.pot index 5b13fc1578f..67d78f45413 100644 --- a/addons/stock/i18n/stock.pot +++ b/addons/stock/i18n/stock.pot @@ -2288,6 +2288,11 @@ msgstr "" msgid "Has Scrap Moves" msgstr "" +#. module: stock +#: model:ir.model.fields,field_description:stock.field_stock_picking_has_tracking +msgid "Has Tracking" +msgstr "" + #. module: stock #: model:ir.model.fields,field_description:stock.field_stock_location_posz msgid "Height (Z)" @@ -4885,6 +4890,7 @@ msgid "Reference of the document" msgstr "" #. module: stock +#: model:ir.ui.view,arch_db:stock.view_move_kandan #: model:ir.ui.view,arch_db:stock.view_picking_form msgid "Register lots, packs, location" msgstr "" @@ -6643,14 +6649,14 @@ msgid "Whether the move was added after the picking's confirmation" msgstr "" #. module: stock -#: model:product.product,name:stock.test_quant_product -#: model:product.template,name:stock.test_quant_product_product_template -msgid "Whiteboard" +#: model:ir.model.fields,field_description:stock.field_stock_return_picking_line_wizard_id +msgid "Wizard" msgstr "" #. module: stock -#: model:ir.model.fields,field_description:stock.field_stock_return_picking_line_wizard_id -msgid "Wizard" +#: code:addons/stock/models/stock_production_lot.py:47 +#, python-format +msgid "You are not allowed to change the product linked to a serial or lot number if some stock moves have already been created with that number. This would lead to inconsistencies in your stock." msgstr "" #. module: stock diff --git a/addons/stock/models/stock_production_lot.py b/addons/stock/models/stock_production_lot.py index 4fc1092839d..5a7a72074aa 100644 --- a/addons/stock/models/stock_production_lot.py +++ b/addons/stock/models/stock_production_lot.py @@ -37,6 +37,18 @@ class ProductionLot(models.Model): raise UserError(_("You are not allowed to create a lot for this picking type")) return super(ProductionLot, self).create(vals) + @api.multi + def write(self, vals): + if 'product_id' in vals: + move_lines = self.env['stock.move.line'].search([('lot_id', 'in', self.ids)]) + if move_lines: + raise UserError(_( + 'You are not allowed to change the product linked to a serial or lot number ' + + 'if some stock moves have already been created with that number. ' + + 'This would lead to inconsistencies in your stock.' + )) + return super(ProductionLot, self).write(vals) + @api.one def _product_qty(self): # We only care for the quants in internal or transit locations.