Odoo Help


Make selection field using values of another few fields

on 11/8/16, 1:13 AM 212 views

I have add name as "first name", "middle" and "last name".

Want to get them three for another drop-down. (V8)

Ameera PP
On 11/8/16, 5:41 AM

Check this link:


Anjana Arora
On 11/8/16, 5:48 AM

def name_get(self, cr, uid, ids, context=None):
      res = []       

     for record in self.browse(cr, uid, ids, context=context):
            name = ''           

            if record.first_name or record.middle or record.last_name:
                name = str(record.first_name)+ '/' + str(record.middle)   + '/' + str(record.last_name)

            res.append((record.id, name))    

    return res


Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

On 11/8/16, 3:22 AM

Write a Selection function, and inside the function, build the Selection tuple in whichever way you needed.

Something this like

def _get_xyz_selection(self):
return [('option1', 'Option1'),
('option2', 'Option2),...]

xyz_column = fields.Selection(selection=_get_xyz_selection, ...)

Hi Rukshani,

Create the fields

class ResPartnerInherited(models.Model):
     _inherit = 'res.partner'
     _rec_name = 'full_name'

     middle_name = fields.Char('Middle Name')
     last_name = fields.Char('Last Name')
     def _get_full_name(self):
     full_name = fields.Char(compute='_get_full_name')

Create Many2One field in another model

    partner_id = fields.Many2one('res.partner', 'Partner')     


<field name="partner_id"/><!--   It will display like dropdown box                     -->


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 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/8/16, 1:13 AM
Seen: 212 times
Last updated: 11/9/16, 10:53 PM