[FIX] stock: unlink scrap
Forbids to unlink a done scrap. opw-746294
This commit is contained in:
@@ -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 ""
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user