[FIX] stock: Inventory Adjustments Deletion

It's not allowed to delete inventory adjustement linked to validated moves.

opw:1826300
This commit is contained in:
Goffin Simon
2018-03-29 15:17:18 +02:00
parent 1dbc655676
commit 8a906f80b4
2 changed files with 13 additions and 0 deletions
+6
View File
@@ -6647,6 +6647,12 @@ msgstr ""
msgid "You cannot delete a scrap which is done."
msgstr ""
#. module: stock
#: code:addons/stock/models/stock_inventory.py:103
#, python-format
msgid "You cannot delete a validated inventory adjustement."
msgstr ""
#. module: stock
#: code:addons/stock/models/stock_inventory.py:374
#, python-format
+7
View File
@@ -96,6 +96,13 @@ class Inventory(models.Model):
else:
self.total_qty = 0
@api.multi
def unlink(self):
for inventory in self:
if inventory.state == 'done':
raise UserError(_('You cannot delete a validated inventory adjustement.'))
return super(Inventory, self).unlink()
@api.model
def _selection_filter(self):
""" Get the list of filter allowed according to the options checked