diff --git a/addons/stock/i18n/stock.pot b/addons/stock/i18n/stock.pot index e7182b88541..e01b6291165 100644 --- a/addons/stock/i18n/stock.pot +++ b/addons/stock/i18n/stock.pot @@ -6566,7 +6566,13 @@ msgid "You cannot cancel a stock move that has been set to 'Done'." msgstr "" #. module: stock -#: code:addons/stock/models/stock_inventory.py:352 +#: code:addons/stock/models/stock_scrap.py:72 +#, python-format +msgid "You cannot delete a scrap which is done." +msgstr "" + +#. module: stock +#: code:addons/stock/models/stock_inventory.py:374 #, python-format msgid "You cannot have two inventory adjustements in state 'in Progess' with the same product(%s), same location(%s), same package, same owner and same lot. Please first validatethe first inventory adjustement with this product before creating another one." msgstr "" diff --git a/addons/stock/models/stock_scrap.py b/addons/stock/models/stock_scrap.py index 355f0139d04..16be4d9b73b 100644 --- a/addons/stock/models/stock_scrap.py +++ b/addons/stock/models/stock_scrap.py @@ -66,6 +66,12 @@ class StockScrap(models.Model): scrap.do_scrap() return scrap + @api.multi + def unlink(self): + if 'done' in self.mapped('state'): + raise UserError(_('You cannot delete a scrap which is done.')) + return super(StockScrap, self).unlink() + def _get_origin_moves(self): return self.picking_id and self.picking_id.move_lines.filtered(lambda x: x.product_id == self.product_id)