Odoo Help


name_get method does not work properly

Andrius Laukavičius
on 11/6/14, 9:47 AM 909 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?

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

1 follower(s)


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