diff --git a/addons/mrp/i18n/mrp.pot b/addons/mrp/i18n/mrp.pot index d79fdaeb329..f5d87479f26 100644 --- a/addons/mrp/i18n/mrp.pot +++ b/addons/mrp/i18n/mrp.pot @@ -3266,6 +3266,18 @@ msgstr "" msgid "You cannot use the same serial number in two different lines." msgstr "" +#. module: mrp +#: code:addons/mrp/models/mrp_unbuild.py:110 +#, python-format +msgid "You don't have in the stock the lot %s." +msgstr "" + +#. module: mrp +#: code:addons/mrp/models/mrp_unbuild.py:125 +#, python-format +msgid "You don't have in the stock the required lot/serial number for %s ." +msgstr "" + #. module: mrp #: code:addons/mrp/wizard/change_production_qty.py:44 #, python-format diff --git a/addons/mrp/models/mrp_unbuild.py b/addons/mrp/models/mrp_unbuild.py index dc22a8e87f1..d73466ed2bb 100644 --- a/addons/mrp/models/mrp_unbuild.py +++ b/addons/mrp/models/mrp_unbuild.py @@ -106,6 +106,8 @@ class MrpUnbuild(models.Model): self.env['stock.quant'].quants_reserve(quants, consume_move) if consume_move.has_tracking != 'none': + if not quants[0][0]: + raise UserError(_("You don't have in the stock the lot %s.") % (self.lot_id.name,)) self.env['stock.move.lots'].create({ 'move_id': consume_move.id, 'lot_id': self.lot_id.id, @@ -119,6 +121,8 @@ class MrpUnbuild(models.Model): for produce_move in produce_moves: if produce_move.has_tracking != 'none': original = original_quants.filtered(lambda quant: quant.product_id == produce_move.product_id) + if not original.lot_id: + raise UserError(_("You don't have in the stock the required lot/serial number for %s .") % (produce_move.product_id.name,)) self.env['stock.move.lots'].create({ 'move_id': produce_move.id, 'lot_id': original.lot_id.id,