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
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">kanban</field>
- <field name="context">{"search_default_customer":1}</field>
+ <field name="context">{"search_default_customer":1, 'short_category_name': True}</field>
<field name="search_view_id" ref="view_res_partner_filter"/>
<field name="help">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.</field>
</record>