top of page

Odoo - Concatenate Internal Reference with Partner Name

  • Writer: Tek Siong, Hock
    Tek Siong, Hock
  • Sep 21, 2021
  • 1 min read

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)))
        else:
            res.append((field.id, '%s %s' % ('', field.name)))

    return res

Recent Posts

See All
Odoo Performance Profile for debugging

Odoo Performance Profile for debugging, If you are on Odoo 16 and below, and need a good tool for debugging the performance of your Odoo system, this will be the right content for you.

 
 
 

Comments


Subscribe Form

  • facebook
  • linkedin

©2019 by Excelroot Technology Sdn Bhd.

bottom of page