mirror of
https://gitlab.com/datalifeit/trytond-stock_location_product_limit
synced 2023-12-14 04:23:00 +01:00
parent
4988d40333
commit
5009a7b108
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue