[MERGE] stock: always use full name in name_get of stock.location

bzr revid: rco@openerp.com-20120113160054-elutn20eaeh0fkdt
This commit is contained in:
Raphael Collet 2012-01-13 17:00:54 +01:00
commit 6132cfc44f
3 changed files with 18 additions and 32 deletions

View File

@ -141,7 +141,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="search_view_id" ref="view_stock_search"/>
<field name="context">{'full':'1','contact_display': 'partner','search_default_done':1,'search_default_year':1, 'search_default_month':1, 'search_default_group_type':1, 'group_by': [], 'group_by_no_leaf':1,}</field>
<field name="context">{'contact_display': 'partner','search_default_done':1,'search_default_year':1, 'search_default_month':1, 'search_default_group_type':1, 'group_by': [], 'group_by_no_leaf':1,}</field>
<field name="help">Moves Analysis allows you to easily check and analyse your company stock moves. Use this report when you want to analyse the different routes taken by your products and inventory management performance.</field>
</record>
<menuitem action="action_stock_move_report" id="menu_action_stock_move_report" parent="next_id_61" sequence="3"/>

View File

@ -74,35 +74,22 @@ class stock_location(osv.osv):
_order = 'parent_left'
def name_get(self, cr, uid, ids, context=None):
res = []
if context is None:
context = {}
if not len(ids):
return []
reads = self.read(cr, uid, ids, ['name','location_id'], context=context)
for record in reads:
name = record['name']
if context.get('full',False):
if record['location_id']:
name = record['location_id'][1] + ' / ' + name
res.append((record['id'], name))
else:
res.append((record['id'], name))
return res
# always return the full hierarchical name
res = self._complete_name(cr, uid, ids, 'complete_name', None, context=context)
return res.items()
def _complete_name(self, cr, uid, ids, name, args, context=None):
""" Forms complete name of location from parent location to child location.
@return: Dictionary of values
"""
def _get_one_full_name(location, level=4):
if location.location_id:
parent_path = _get_one_full_name(location.location_id, level-1) + "/"
else:
parent_path = ''
return parent_path + location.name
res = {}
for m in self.browse(cr, uid, ids, context=context):
res[m.id] = _get_one_full_name(m)
names = [m.name]
parent = m.location_id
while parent:
names.append(parent.name)
parent = parent.location_id
res[m.id] = ' / '.join(reversed(names))
return res

View File

@ -186,7 +186,6 @@
<field name="res_model">stock.inventory</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_inventory_tree"/>
<field name="context">{'full':'1'}</field>
<field name="search_view_id" ref="view_inventory_filter" />
<field name="help">Periodical Inventories are used to count the number of products available per location. You can use it once a year when you do the general inventory or whenever you need it, to correct the current stock level of a product.</field>
</record>
@ -330,8 +329,8 @@
<field name="date" colspan="4"/>
</group>
<group col="2" colspan="2">
<separator string="Traceability" colspan="4"/>
<field name="stock_available" colspan="4"/>
<separator string="Traceability" colspan="2"/>
<field name="stock_available" colspan="2"/>
<button name="action_traceability" string="Upstream Traceability" type="object" context="{'type': '', 'field': 'prodlot_id'}" icon="gtk-go-up" colspan="2"/>
<button name="action_traceability" string="Downstream Traceability" type="object" context="{'type': 'move_history_ids', 'field': 'prodlot_id'}" icon="gtk-go-down" colspan="2"/>
</group>
@ -407,7 +406,7 @@
<field name="view_type">form</field>
<field name="view_id" ref="view_production_lot_tree"/>
<field name="search_view_id" ref="search_product_lot_filter" />
<field name="context">{'full':'1',"search_default_available":1}</field>
<field name="context">{"search_default_available":1}</field>
<field name="help">This is the list of all the production lots (serial numbers) you recorded. When you select a lot, you can get the upstream or downstream traceability of the products contained in lot. By default, the list is filtred on the serial numbers that are available in your warehouse but you can uncheck the 'Available' button to get all the lots you produced, received or delivered to customers.</field>
</record>
<menuitem action="action_production_lot_form" id="menu_action_production_lot_form"
@ -584,7 +583,7 @@
<field name="view_type">form</field>
<field name="view_id" ref="view_location_tree2"/>
<field name="search_view_id" ref="view_location_search"/>
<field name="context">{'full':1, 'search_default_in_location':1}</field>
<field name="context">{'search_default_in_location':1}</field>
<field name="help">Define your locations to reflect your warehouse structure and organization. OpenERP is able to manage physical locations (warehouses, shelves, bin, etc), partner locations (customers, suppliers) and virtual locations which are the counterpart of the stock operations like the manufacturing orders consumptions, inventories, etc. Every stock operation in OpenERP moves the products from one location to another one. For instance, if you receive products from a supplier, OpenERP will move products from the Supplier location to the Stock location. Each report can be performed on physical, partner or virtual locations.</field>
</record>
<menuitem action="action_location_form" id="menu_action_location_form" parent="menu_warehouse_config"/>
@ -1420,8 +1419,8 @@
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned" colspan="1"/>
<newline/>
<field name="location_id" context="{'full':True}"/>
<field name="location_dest_id" context="{'full':True}"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="address_id" context="{'contact_display':'partner'}"/>
</group>
@ -1608,8 +1607,8 @@
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned" colspan="1"/>
<newline/>
<field name="location_id" context="{'full':True}"/>
<field name="location_dest_id" context="{'full':True}"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="address_id" context="{'contact_display':'partner'}"/>
</group>