Convert party warehouse in multivalue.

This commit refs #23994
This commit is contained in:
ramon.vidal 2022-09-28 19:29:41 +02:00 committed by Sergio Morillo
parent 4988d40333
commit 5009a7b108

View file

@ -114,8 +114,11 @@ class ShipmentOut(metaclass=PoolMeta):
def product_limits_by_location(self):
ProductLimit = Pool().get('stock.location.product_limit')
warehouse = self.get_party_warehouse_used(
**self._get_party_warehouse_pattern())
return ProductLimit.product_limits_by_location(
self.customer.warehouse.id)
warehouse.id)
@classmethod
def wait(cls, shipments):
@ -131,7 +134,8 @@ class ShipmentOut(metaclass=PoolMeta):
cache = set()
for shipment in shipments:
location = shipment.customer.warehouse
location = shipment.get_party_warehouse_used(
**shipment._get_party_warehouse_pattern())
if not location:
continue
for move in shipment.outgoing_moves:
@ -169,8 +173,10 @@ class ShipmentOutReturn(metaclass=PoolMeta):
def product_limits_by_location(self):
ProductLimit = Pool().get('stock.location.product_limit')
warehouse = self.get_party_warehouse_used(
**self._get_party_warehouse_pattern())
return ProductLimit.product_limits_by_location(
self.customer.warehouse.id)
warehouse.id)
class ShipmentInternal(metaclass=PoolMeta):
@ -178,10 +184,11 @@ class ShipmentInternal(metaclass=PoolMeta):
def product_limits_by_location(self):
ProductLimit = Pool().get('stock.location.product_limit')
if not self.party or not self.party.warehouse:
warehouse = self.get_party_warehouse_used(
**self._get_party_warehouse_pattern())
if not warehouse:
return []
return ProductLimit.product_limits_by_location(
self.party.warehouse.id)
return ProductLimit.product_limits_by_location(warehouse.id)
@classmethod
def wait(cls, shipments):
@ -194,7 +201,8 @@ class ShipmentInternal(metaclass=PoolMeta):
cache = set()
for shipment in shipments:
location = shipment.party and shipment.party.warehouse or None
location = shipment.get_party_warehouse_used(
**shipment._get_party_warehouse_pattern())
if not location:
continue
for move in shipment.moves: