From 814e5741ad7ae6ecd54ac62f017328e5fc9b555a Mon Sep 17 00:00:00 2001 From: resteve Date: Thu, 18 Feb 2016 00:54:43 +0100 Subject: [PATCH] Copy box from incoming/move to move/inventory --- __init__.py | 4 ++++ shipment.py | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 shipment.py diff --git a/__init__.py b/__init__.py index e631e15..d914821 100644 --- a/__init__.py +++ b/__init__.py @@ -3,8 +3,12 @@ # copyright notices and license terms. from trytond.pool import Pool from .move import * +from .shipment import * def register(): Pool.register( Move, + ShipmentIn, + ShipmentOut, + ShipmentOutReturn, module='stock_move_box', type_='model') diff --git a/shipment.py b/shipment.py new file mode 100644 index 0000000..f3ff361 --- /dev/null +++ b/shipment.py @@ -0,0 +1,41 @@ +# This file is part of the stock_move_box module for Tryton. +# The COPYRIGHT file at the top level of this repository contains the full +# copyright notices and license terms. +from trytond.pool import PoolMeta + +__all__ = ['ShipmentIn', 'ShipmentOut', 'ShipmentOutReturn'] +__metaclass__ = PoolMeta + + +class ShipmentIn(): + __name__ = 'stock.shipment.in' + + @classmethod + def _get_inventory_moves(cls, incoming_move): + move = super(ShipmentIn, cls)._get_inventory_moves(incoming_move) + if not move: + return + move.box = incoming_move.box + return move + + +class ShipmentOut(): + __name__ = 'stock.shipment.out' + + def _get_inventory_move(self, move): + inventory_move = super(ShipmentOut, self)._get_inventory_move(move) + inventory_move.box = move.box + return inventory_move + + +class ShipmentOutReturn(): + __name__ = 'stock.shipment.out.return' + + @classmethod + def _get_inventory_moves(cls, incoming_move): + move = super(ShipmentOutReturn, + cls)._get_inventory_moves(incoming_move) + if not move: + return + move.box = incoming_move.box + return move