Odoo Help


This community 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.


name_get method does not work properly

Andrius Laukavičius
on 11/6/14, 9:47 AM 518 views

I'm trying to implement new name_get method for res.partner, but it just does not properly work. The problem is, new name is not being updated. It updates only when I modify anything on name field. I updated name_get liket this:

    def name_get(self):
        res = super(res_partner, self).name_get()
        res_dict = dict(res)
        for record in self:
            if record.qualified and record.show_in_name:
                res_dict[record.id] = "%s + QLF" % (res_dict[record.id])

        return res_dict.items()

Sow when I tick fields qualified and show_in_name, it does not change how name is displayed instantly. It stayes the same. Example:

partner name: 'Partner1'

I go for exmaple in list view, it shows Partner1. Till now, its OK.

Now I go in to that partner and tick 'qualified' and 'show_in_name'. Now I go to list view and still see that partners name as 'Partner1'. So now I rename partner to 'Partner2', save it, and rename back to 'Partner1'. Now I see it as 'Partner1 + QLF'. Now If I untick both options from 'qualified' and 'show_in_name', it still stays as 'Partner1 + QLF'. And If I would rename like I did before, name display would go back to 'Partner1' again. Why is this happening?

I also tried to just add new line inside source code where name_get is defined, but even that way  its still the same.

But if I check how for example person name is displayed when it has parent_id, it changes instantly without all this renaming hacking.

So why is this happening? Am I missing something here or is it some kind of bug?

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 11/6/14, 9:47 AM
Seen: 518 times
Last updated: 3/16/15, 8:10 AM