diff --git a/__init__.py b/__init__.py index d77458424c..640aa7298f 100644 --- a/__init__.py +++ b/__init__.py @@ -11,4 +11,5 @@ def register(): Product, ProductLocation, ShipmentIn, + ShipmentOutReturn, module='stock_product_location', type_='model') diff --git a/location.py b/location.py index b6ed4607f6..880d84a51b 100644 --- a/location.py +++ b/location.py @@ -6,7 +6,7 @@ from trytond.transaction import Transaction from trytond.backend import TableHandler from trytond.pool import PoolMeta -__all__ = ['ProductLocation', 'ShipmentIn'] +__all__ = ['ProductLocation', 'ShipmentIn', 'ShipmentOutReturn'] __metaclass__ = PoolMeta @@ -58,3 +58,16 @@ class ShipmentIn: continue res['to_location'] = product_location.location.id return res + + +class ShipmentOutReturn: + __name__ = 'stock.shipment.out.return' + + @classmethod + def _get_inventory_moves(cls, incoming_move): + res = super(ShipmentOutReturn, cls)._get_inventory_moves(incoming_move) + for product_location in incoming_move.product.locations: + if (product_location.warehouse + == incoming_move.shipment_out_return.warehouse): + res['to_location'] = product_location.location.id + return res