From aa84c454ad4147136d004f9aae552536fbc5c064 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 13 Jan 2012 16:15:48 +0100 Subject: [PATCH 1/3] [IMP] stock.location: always return full name in name_get bzr revid: rco@openerp.com-20120113151548-hyj48p274sbgj4vu --- addons/stock/stock.py | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) 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 From 6068fc44fdcc38c0692b82e46e5fbbb21d5ab50c Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 13 Jan 2012 16:16:47 +0100 Subject: [PATCH 2/3] [IMP] stock: remove 'full' from context for locations, no longer useful bzr revid: rco@openerp.com-20120113151647-mo7rprxwhqy589ki --- addons/stock/report/report_stock_move_view.xml | 2 +- addons/stock/stock_view.xml | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) 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_view.xml b/addons/stock/stock_view.xml index f4409cd90b4..e0b4580e0ee 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. @@ -407,7 +406,7 @@ form - {'full':'1',"search_default_available":1} + {"search_default_available":1} 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. form - {'full':1, 'search_default_in_location':1} + {'search_default_in_location':1} 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. @@ -1420,8 +1419,8 @@ icon="gtk-convert" context="{'scrap': True}" states="draft,waiting,confirmed,assigned" colspan="1"/> - - + + @@ -1608,8 +1607,8 @@ icon="gtk-convert" context="{'scrap': True}" states="draft,waiting,confirmed,assigned" colspan="1"/> - - + + From 3278a63fd9c6cd9c9def87198bdb4dfde6fbc502 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 13 Jan 2012 16:17:23 +0100 Subject: [PATCH 3/3] [FIX] stock: fix form view of production lot bzr revid: rco@openerp.com-20120113151723-mjwksx9xnoq6fcaj --- addons/stock/stock_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index e0b4580e0ee..4ed57da90a5 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -329,8 +329,8 @@ - - + +