mirror of
https://bitbucket.org/presik/trytonpsk-stock_co.git
synced 2023-12-14 05:43:05 +01:00
modify state fields for new state in record
This commit is contained in:
parent
9550f7f12d
commit
7b94469d28
|
@ -27,6 +27,7 @@ def register():
|
|||
shipment.ShipmentIn,
|
||||
shipment.ShipmentDetailedStart,
|
||||
inventory.Inventory,
|
||||
inventory.InventoryLine,
|
||||
inventory.CreateInventoriesStart,
|
||||
stock.WarehouseKardexStockStart,
|
||||
product.ChangeUdmProductStart,
|
||||
|
|
17
inventory.py
17
inventory.py
|
@ -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'),
|
||||
|
|
Loading…
Reference in a new issue