Add dock to internal shipment

This commit is contained in:
Sergio Morillo 2016-09-03 16:48:14 +02:00
parent 45f7ae10c3
commit b34a73cbad
4 changed files with 33 additions and 4 deletions

View file

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

View file

@ -5,7 +5,8 @@ from trytond.pool import PoolMeta
from trytond.pyson import Eval
__all__ = ['Location', 'LocationDock', 'ShipmentOut',
'ShipmentOutReturn', 'ShipmentIn', 'DockMixin']
'ShipmentOutReturn', 'ShipmentIn', 'DockMixin',
'ShipmentInternal']
class Location:
@ -43,7 +44,7 @@ class LocationDock(ModelView, ModelSQL):
return True
class DockMixin(Model):
class DockMixin(object):
"""Adds dock field to Model"""
dock = fields.Many2One('stock.location.dock', 'Dock',
@ -74,3 +75,14 @@ class ShipmentIn(DockMixin):
__metaclass__ = PoolMeta
class ShipmentInternal(DockMixin):
__name__ = 'stock.shipment.internal'
__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

View file

@ -21,12 +21,18 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">shipment_out_form</field>
<field name="inherit" ref="stock.shipment_out_view_form"/>
</record>
<!-- Shipment out -->
<!-- Shipment out return -->
<record model="ir.ui.view" id="shipment_out_return_view_form">
<field name="model">stock.shipment.out.return</field>
<field name="name">shipment_out_return_form</field>
<field name="inherit" ref="stock.shipment_out_return_view_form"/>
</record>
<!-- Shipment internal -->
<record model="ir.ui.view" id="shipment_internal_view_form">
<field name="model">stock.shipment.internal</field>
<field name="name">shipment_internal_form</field>
<field name="inherit" ref="stock.shipment_internal_view_form"/>
</record>
<!-- Location dock -->
<record model="ir.ui.view" id="dock_view_tree">
<field name="model">stock.location.dock</field>

View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!-- The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/field[@name='to_location']" position="after">
<label name="dock"/>
<field name="dock"/>
</xpath>
</data>