summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Snauwaert <csn@openerp.com>2013-08-28 14:49:12 +0200
committerCedric Snauwaert <csn@openerp.com>2013-08-28 14:49:12 +0200
commit5400aec81bdd9355f90d7cfa44f8ee72adc227d8 (patch)
treed40668963d03fa97c9ca3ddf47260555da2419c7
parent2c83187f59b951300d30c4b5a0d44a1d5d12390e (diff)
[FIX]add warehouse_id to route and show all routes associated to a warehouse on the warehouse form view
bzr revid: csn@openerp.com-20130828124912-9mvmbzvxmbq02me2
-rw-r--r--addons/stock/stock_view.xml2
-rw-r--r--addons/stock_location/stock_location.py9
-rw-r--r--addons/stock_location/stock_location_view.xml10
3 files changed, 21 insertions, 0 deletions
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index e76ce99855c..4488074293e 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -493,6 +493,7 @@
<field name="model">stock.warehouse</field>
<field name="arch" type="xml">
<form string="Warehouse" version="7.0">
+ <sheet>
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
<group>
@@ -506,6 +507,7 @@
<field name="partner_id"/>
</group>
</group>
+ </sheet>
</form>
</field>
</record>
diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py
index 5e58b918cb6..77d1a67149a 100644
--- a/addons/stock_location/stock_location.py
+++ b/addons/stock_location/stock_location.py
@@ -28,20 +28,29 @@ class stock_location_route(osv.osv):
_name = 'stock.location.route'
_description = "Inventory Routes"
_order = 'sequence'
+
+ def _default_warehouse(self, cr, uid, context=None):
+ user = self.pool.get('res.users').browse(cr, uid, uid, context)
+ res = self.pool.get('stock.warehouse').search(cr, uid, [('company_id', '=', user.company_id.id)], limit=1, context=context)
+ return res and res[0] or False
+
_columns = {
'name': fields.char('Route Name', required=True),
'sequence': fields.integer('Sequence'),
'pull_ids': fields.one2many('procurement.rule', 'route_id', 'Pull Rules'),
'push_ids': fields.one2many('stock.location.path', 'route_id', 'Push Rules'),
+ 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'),
}
_defaults = {
'sequence': lambda self,cr,uid,ctx: 0,
+ 'warehouse_id': _default_warehouse,
}
class stock_warehouse(osv.osv):
_inherit = 'stock.warehouse'
_columns = {
'route_id': fields.many2one('stock.location.route', 'Default Logistic Route', help='Default route through the warehouse', required=True),
+ 'route_ids': fields.one2many('stock.location.route', 'warehouse_id', 'All Routes'),
}
diff --git a/addons/stock_location/stock_location_view.xml b/addons/stock_location/stock_location_view.xml
index c50a6ca8a94..6c5cc042fef 100644
--- a/addons/stock_location/stock_location_view.xml
+++ b/addons/stock_location/stock_location_view.xml
@@ -157,6 +157,14 @@
<xpath expr="//field[@name='partner_id']" position="after">
<field name="route_id"/>
</xpath>
+ <xpath expr="//group[last()]" position="after">
+ <separator string="All Associated Routes"/>
+ <field name="route_ids" nolabel="1" colspan="4">
+ <tree string="All Routes">
+ <field name="name"/>
+ </tree>
+ </field>
+ </xpath>
</field>
</record>
@@ -167,6 +175,7 @@
<tree string="Routes">
<field name="sequence" widget="handle" />
<field name="name"/>
+ <field name="warehouse_id"/>
</tree>
</field>
</record>
@@ -179,6 +188,7 @@
<form string="Route">
<field name="name" />
<field name="sequence" groups="base.group_no_one"/>
+ <field name="warehouse_id"/>
<group string="Push Rules" colspan="4" >
<field name="push_ids" colspan="4" nolabel="1"/>
</group>