top of page
Writer's pictureTek Siong, Hock

Odoo - Display partner in different name

Updated: Jan 30, 2021

There are times when you may want to have a unique short name for you customer when select it, but at the same time, may have to used the full name in the invoice report print out.


This Odoo technical development blog is my way to contribute back to the Odoo Community, for all the selfless and great sharing by the community members.


Click "Like" at the bottom of this blog, to motivate us to continue sharing more Odoo tips.


Replace the short name to the standard model's 'name'.

class ResPartner(models.Model):
    _inherit = "res.partner"
    short_name = fields.Char(string='Short Name')
    # Change the display name when user select partner
    def name_get(self):
        res = []
        for field in self:
            #name = field.name
            if field.short_name:
                res.append((field.id, '%s %s' % (field.short_name, '')))
            elif field.ref:
                res.append((field.id, '%s %s' % (field.ref, field.name)))
            else:
                res.append((field.id, '%s %s' % ('', field.name)))

        return res

Important to set the always_reload option.

<field name="customer_name" options='{"always_reload": True}'/>

534 views1 comment

Recent Posts

See All

1 Kommentar


haseeb ahmed
haseeb ahmed
11. Sept. 2023

hey, just wanted to say thanks, i was looking / searching for this from last year. at some point in last year, i hired a dev guy. he implemented solution in slightly different (less ideal way). i am glad i found it, will be trying this out shortly huge thanks again.

Gefällt mir
bottom of page