• Tek Siong, Hock

Odoo - Concatenate Internal Reference with Partner Name

Due to the legacy migration issue, you may have a separate partner for customer and vendor, with different code (Internal Reference).

So, when user selecting the partner in the dropdown, you want to concatenate the Internal Reference with Partner Name, as below.

You can use the following code, in the res.partner.

def name_get(self):
    res = []
    for field in self:
        if field.ref:
            res.append((field.id, '%s %s' % (field.ref, field.name)))
            res.append((field.id, '%s %s' % ('', field.name)))

    return res

37 views0 comments