This question has been flagged
2 Replies
10555 Views

I know that there are exactly the same question here:

https://www.odoo.com/es_ES/forum/help-1/question/how-to-override-the-display-name-of-a-kanban-res-partner-view-23392

But I tried the answers with no result. In the standard kanban view of a partner, if this one is a person, their name is shown as following:

company, name

If I check the code of the kanban view, I find the line which is showing the name:

<h4 class="oe_partner_heading"><a type="open"><field name="name"/></a></h4>

But why is showing the column display_name instead of name?

I tried to remove that, and I cannot, because, let's show my example:

This works, and shows the phone just after the display_name (why display_name??? I specified name):

<xpath expr="//kanban/templates//div//div/h4" position="replace">
     <h4><a type="open"><field name="name"/> <field name="phone"/></a></h4> ...

This does not work:

<xpath expr="//kanban/templates//div//div/h4" position="replace">
     <h4><a type="open"><field name="phone"/></a></h4> ...

It seems that if I remove the field name, it will not work. Anyone knows about this problem? How can I remove the name of the company in the kanban view if the partner is a person?

EDIT

def name_get(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
        if isinstance(ids, (int, long)):
            ids = [ids]
        res = []
        for record in self.browse(cr, uid, ids, context=context):
            name = record.name
            res.append((record.id, name))
        return res

Avatar
Discard
Author Best Answer

I solved it (in my case, it was not necessary to override anything, only inherit from base.res_partner_kanban_view and modify the XML), in the next way:

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

Avatar
Discard
Best Answer

Find the appropriate "name_get" method on the object the kanban is view. This will most likely tell you how the name is returned when OpenERP searches for this object on the background.

Override the method and provide your own defintion to see if it changes.

Avatar
Discard
Author

I cannot manage this, I edited my post with the override of the python function.

It's a bit unclear for me. Are you unable to override the method, or are you unable to see any changes once the overridden method works?

Author

@Ludo - Neobis the second one. But I have just found a way to manage what I want. Instead of using replace in the XML view, I made that tag invisible and write after that.