mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[14.0][IMP] stock_cycle_count: check modify
This commit is contained in:
committed by
ArnauCForgeFlow
parent
c04edfbed8
commit
ac0f2c94c5
@@ -90,11 +90,7 @@ class StockInventory(models.Model):
|
||||
|
||||
def write(self, vals):
|
||||
for inventory in self:
|
||||
if (
|
||||
inventory.cycle_count_id
|
||||
and "state" not in vals.keys()
|
||||
and inventory.state == "draft"
|
||||
):
|
||||
if inventory._allow_write(vals):
|
||||
raise UserError(
|
||||
_(
|
||||
"You cannot modify the configuration of an Inventory "
|
||||
@@ -102,3 +98,8 @@ class StockInventory(models.Model):
|
||||
)
|
||||
)
|
||||
return super(StockInventory, self).write(vals)
|
||||
|
||||
def _allow_write(self, vals):
|
||||
return (
|
||||
self.cycle_count_id and "state" not in vals.keys() and self.state == "draft"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user