Added order and fields depends methods.

This commit is contained in:
Sergio Morillo 2022-10-01 00:10:49 +02:00
parent 088b0437ec
commit 0dd4f484da
2 changed files with 9 additions and 2 deletions

View File

@ -61,6 +61,11 @@ class PartyWarehouse(ModelSQL, ModelView, ValueMixin):
warehouse = fields.Many2One('stock.location', "Warehouse",
domain=[('type', '=', 'warehouse')], ondelete='RESTRICT')
@classmethod
def __setup__(cls):
super().__setup__()
cls._order.insert(0, ('party', 'ASC'))
@classmethod
def __register__(cls, module_name):
pool = Pool()

View File

@ -23,7 +23,8 @@ class ShipmentInternal(PartyWarehouseMixin, metaclass=PoolMeta):
},
depends=['state', 'moves', 'from_location', 'to_location'])
@fields.depends('party', 'from_location', 'to_location')
@fields.depends('party', 'from_location', 'to_location',
methods=['_get_party_warehouse_pattern'])
def on_change_from_location(self):
if (self.party
and self.from_location
@ -33,7 +34,8 @@ class ShipmentInternal(PartyWarehouseMixin, metaclass=PoolMeta):
if self.from_location.warehouse != warehouse:
self.to_location = warehouse.storage_location
@fields.depends('party', 'from_location', 'to_location')
@fields.depends('party', 'from_location', 'to_location',
methods=['_get_party_warehouse_pattern'])
def on_change_to_location(self):
if (self.party
and self.to_location