modify state fields for new state in record

This commit is contained in:
wilsongomez 2022-09-30 15:57:39 -05:00
parent 9550f7f12d
commit 7b94469d28
2 changed files with 18 additions and 0 deletions

View file

@ -27,6 +27,7 @@ def register():
shipment.ShipmentIn,
shipment.ShipmentDetailedStart,
inventory.Inventory,
inventory.InventoryLine,
inventory.CreateInventoriesStart,
stock.WarehouseKardexStockStart,
product.ChangeUdmProductStart,

View file

@ -32,6 +32,18 @@ class CreateInventories(metaclass=PoolMeta):
return inventory
class InventoryLine(metaclass=PoolMeta):
'Stock Inventory Line'
__name__ = 'stock.inventory.line'
@classmethod
def __setup__(cls):
super(InventoryLine, cls).__setup__()
cls._states = {
'readonly': ~Eval('inventory_state').in_(["draft", "checkup", "pre_count"])
}
cls.quantity.states = cls._states
class Inventory(metaclass=PoolMeta):
'Stock Inventory'
__name__ = 'stock.inventory'
@ -47,6 +59,11 @@ class Inventory(metaclass=PoolMeta):
def __setup__(cls):
super(Inventory, cls).__setup__()
cls.state.selection.extend([('pre_count', 'Pre-count'), ('checkup', 'Checkup')])
cls._states = {
'readonly': (~Eval('state').in_(["draft", "checkup", "pre_count"]) | ~Eval('location')
| ~Eval('date')),
}
cls.lines.states = cls._states
cls._transitions |= set((
('draft', 'checkup'),
('checkup', 'draft'),