Navi
Navi

Reputation: 1052

how to give a _rec_name as a combination of two field in odoo 10?

how to display a code(or a number) + name when selecting in many2one field?

or

how to give a _rec_name as a combination of two field?

or

how to combine two fields on saving.

for example:There are two fields like name and employee id. After filling up those fields and saving. On opening the record, the _rec_name should display as name[employee id].

Upvotes: 1

Views: 1618

Answers (1)

Dayana
Dayana

Reputation: 1538

You need to overwrite the _name_get method in your class:

    @api.multi
    def name_get(self):
        result = []
        for s in self:
            name = s.field1+ ' ' + s.field2
            result.append((s.id, name))
        return result

I hope this help you.

Upvotes: 2

Related Questions