Copy box from incoming/move to move/inventory

This commit is contained in:
resteve 2016-02-18 00:54:43 +01:00
parent b6a8a3b8f1
commit 814e5741ad
2 changed files with 45 additions and 0 deletions

View File

@ -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')

41
shipment.py Normal file
View File

@ -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