From eec9f019f027ec843882339a5cfdb6c76e9790f1 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Thu, 15 Dec 2011 15:56:04 +0100 Subject: [PATCH] [IMP] base: allow the category name to not include the parents if the context requires it bzr revid: ls@numerigraphe.fr-20111215145604-wu2muv9m9gb9c9h4 --- openerp/addons/base/res/res_partner.py | 9 ++++++++- openerp/addons/base/res/res_partner_view.xml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/res/res_partner.py b/openerp/addons/base/res/res_partner.py index 32b5e08d7b6..fc481fd5e00 100644 --- a/openerp/addons/base/res/res_partner.py +++ b/openerp/addons/base/res/res_partner.py @@ -37,13 +37,20 @@ res_payterm() class res_partner_category(osv.osv): def name_get(self, cr, uid, ids, context=None): + """Return the categories' names with all their parent's names + + The normal name_get behavior can be force by setting + short_category_name=True in the context.""" if not len(ids): return [] + if context is None: + context = {} reads = self.read(cr, uid, ids, ['name','parent_id'], context=context) res = [] for record in reads: name = record['name'] - if record['parent_id']: + if record['parent_id'] and not context.get('short_category_name', + False): name = record['parent_id'][1]+' / '+name res.append((record['id'], name)) return res diff --git a/openerp/addons/base/res/res_partner_view.xml b/openerp/addons/base/res/res_partner_view.xml index b489a4d6e79..c575250b172 100644 --- a/openerp/addons/base/res/res_partner_view.xml +++ b/openerp/addons/base/res/res_partner_view.xml @@ -505,7 +505,7 @@ res.partner form kanban - {"search_default_customer":1} + {"search_default_customer":1, 'short_category_name': True} A customer is an entity you do business with, like a company or an organization. A customer can have several contacts or addresses which are the people working for this company. You can use the history tab, to follow all transactions related to a customer: sales order, emails, opportunities, claims, etc. If you use the email gateway, the Outlook or the Thunderbird plugin, don't forget to register emails to each contact so that the gateway will automatically attach incoming emails to the right partner.