diff --git a/addons/stock/report/report_stock_move_view.xml b/addons/stock/report/report_stock_move_view.xml index 2949f53b117..4f320ab58a9 100644 --- a/addons/stock/report/report_stock_move_view.xml +++ b/addons/stock/report/report_stock_move_view.xml @@ -141,7 +141,7 @@ form tree,graph - {'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,} + {'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,} 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. diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 6acde78f419..e9928eb0aa7 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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 diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index f4409cd90b4..4ed57da90a5 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -186,7 +186,6 @@ stock.inventory form - {'full':'1'} 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. @@ -330,8 +329,8 @@ - - + +