Odoo Help


How to override the display name of a kanban res_partner_view

Mind And Go
on 7/4/13, 5:42 AM 8,607 views


I would like to change the name displayed for the partners that ARE NOT companies in the kanban view. I tried to override the "name_get" function but it apparently concern only the partner that are companies. How can I change this display name so that I haven't got company name and contact name separated by comas?

Thanks a lot

@Mind And Go Hello! Did you find the solution? I need to do exactly the same as you have asked, but I do not understand very well the answers, I tried them with any result. Can you help us?

Juan Formoso
on 10/13/14, 11:29 AM

Timo Talvitie, Vizucom Oy

--Timo Talvitie, Vizucom Oy--
| 5 4 7
Tampere, Finland
--Timo Talvitie, Vizucom Oy--

Lead developer at Vizucom.

Timo Talvitie, Vizucom Oy
On 8/12/13, 6:45 AM

You can do it by creating a new functional field for res.partner that inspects whether the current partner is a company or not and generates a new kanban name for it accordingly. Something like this:

from openerp.osv import osv, fields
class Partner(osv.Model):      

    _inherit = 'res.partner'   

def _get_kanban_name(self, cr, uid, ids, field_name, arg, context):

    res = {}
    for record in self.browse(cr, uid, ids, context):
        id = record['id']
        is_company = record['is_company']
        actual_name = record['name']

        kanban_name = ""
        if is_company:
            kanban_name = actual_name + " - I'm a company"
            kanban_name = actual_name + " - I'm not a company"

        res[id] = kanban_name

    return res

_columns = {
    'kanban_name': fields.function(_get_kanban_name, type='char', string='New kanban name')

After you've done that, you can override the base.res_partner_kanban_view like Ghanshyam described, and put your new kanban_name field there in the desired place. Hope that helps.


Ghanshyam Prajapati

--Ghanshyam Prajapati--

| 4 4 8
Pune, India
--Ghanshyam Prajapati--
OpenERP Developer
Ghanshyam Prajapati
On 7/4/13, 5:55 AM


You can override kanban view as per following,

for example,

<record model="ir.ui.view" id="base.res_partner_kanban_view">
            <field name="name">res.partner.kanban.view</field>
            <field name="model">res.partner</field>
            <field name="arch" type="xml">
                    <field name="color"/>
                    <field name="name"/>
                    <field name="title"/>
                    <field name="email"/>
                    <field name="parent_id"/>
                    <field name="is_company"/>
                    <field name="function"/>
                    <field name="phone"/>
                    <field name="street"/>
                    <field name="street2"/>
                    <field name="zip"/>
                    <field name="city"/>
                    <field name="country_id"/>
                    <field name="mobile"/>
                    <field name="state_id"/>
                    <field name="category_id"/>
                    <field name="has_image"/>
                        <t t-name="kanban-box">
                            <div class="oe_kanban_vignette oe_semantic_html_override">
                                <a type="open">
                                    <t t-if="record.has_image.raw_value === false">
                                        <t t-if="record.is_company.raw_value === true">
                                            <img t-att-src='_s + "/base/static/src/img/company_image.png"' class="oe_kanban_image"/>
                                        <t t-if="record.is_company.raw_value === false">
                                            <img t-att-src='_s + "/base/static/src/img/company_image.png"' class="oe_kanban_image"/>
                                <div class="oe_kanban_details">
                                    <h4 class="oe_partner_heading"><a type="open"><field name="company_id"/></a></h4>
                                    <h4 class="oe_partner_heading"><a type="open"><field name="name"/></a></h4>
                                    <div class="oe_kanban_partner_categories"/>
                                    <div class="oe_kanban_partner_links"/>
                                        <li t-if="record.company_id.raw_value"><field name="company_id"/></li>

Hy, thanks for your answer. Actually, I already try to copy paste a kanban view in a specific module. It doesn't work correctly. I already tried to make a kanban view inherit from another one without more success. In the end in this Kanban view, I can't see how to change the displayname. Do I have to change this whether in the view or in the class itself. What I woul like is to make the companyname dispapear before the coma as shown here : http://openerp.tdeo.fr/kanban_res_partner.png

Mind & Go, Mind And Go
on 7/4/13, 6:08 AM

See my updated answer.

Ghanshyam Prajapati
on 7/4/13, 7:18 AM

Hey buddy, please mark my answer as solved if your problem is solved.

Ghanshyam Prajapati
on 7/4/13, 8:33 AM

Hy Ghanshyam, I'm sorry but it's not exactly my point. Your update is interesting but don't really answer my problem which was probably not correctly explained. In the end My problem is more linked to the <field name="name"/> more than Kanban view. I would like to display only the contact name instead of partner_name (coma) contact_name.

Mind & Go, Mind And Go
on 7/4/13, 4:21 PM
Juan Formoso
On 10/14/14, 9:54 AM

I had the same problem as you. Finally, I solved it this way (it was not necessary to override anything, only inherit from base.res_partner_kanban_view and modify the XML):

                <xpath expr="//kanban/templates//div//div/h4" position="attributes">
                    <attribute name="invisible">1</attribute>
                <xpath expr="//kanban/templates//div//div/h4" position="after">
                    <h4 class="oe_partner_heading"><a type="open"><field name="name"/></a></h4>

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 7/4/13, 5:42 AM
Seen: 8607 times
Last updated: 3/16/15, 8:10 AM