Add Shipment in return.

This commit refs #4650
This commit is contained in:
Sergio Morillo 2018-05-21 15:45:44 +02:00
parent 915d80ea23
commit a754295224
2 changed files with 19 additions and 5 deletions

View file

@ -2,8 +2,8 @@
# copyright notices and license terms.
from trytond.pool import Pool
from .stock import (Location, LocationDock, ShipmentIn,
ShipmentOut, ShipmentOutReturn,
ShipmentInternal)
ShipmentOut, ShipmentOutReturn, ShipmentInternal,
ShipmentInReturn)
def register():
@ -14,4 +14,5 @@ def register():
ShipmentOut,
ShipmentOutReturn,
ShipmentInternal,
ShipmentInReturn,
module='stock_location_dock', type_='model')

View file

@ -1,11 +1,11 @@
# The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import ModelSQL, ModelView, fields, Model
from trytond.model import ModelSQL, ModelView, fields
from trytond.pool import PoolMeta
from trytond.pyson import Eval
__all__ = ['Location', 'LocationDock', 'ShipmentOut',
'ShipmentOutReturn', 'ShipmentIn', 'DockMixin',
'ShipmentOutReturn', 'ShipmentIn', 'ShipmentInReturn', 'DockMixin',
'ShipmentInternal']
@ -83,6 +83,19 @@ class ShipmentIn(DockMixin):
__metaclass__ = PoolMeta
class ShipmentInReturn(DockMixin):
__name__ = 'stock.shipment.in.return'
__metaclass__ = PoolMeta
warehouse = fields.Function(fields.Many2One('stock.location', 'Warehouse'),
'get_warehouse')
def get_warehouse(self, name):
if self.from_location:
return self.from_location.warehouse.id
return None
class ShipmentInternal(DockMixin):
__name__ = 'stock.shipment.internal'
__metaclass__ = PoolMeta
@ -93,4 +106,4 @@ class ShipmentInternal(DockMixin):
def get_warehouse(self, name):
if self.from_location:
return self.from_location.warehouse.id
return None
return None