Reputation: 587
I want to concatenate multiple character fields in a single many2one field and access this in other module. How can we do this?
For example:- I have 5 character fields with different classes in a module and want to concatenate these 5 character fields in a single many2one field. Also I want access this many2one field in another module.
Can anyone help me out here?
Upvotes: 2
Views: 208
Reputation: 4174
Use name_get
function.
Ex:
@api.multi
@api.depends('name', 'state')
def name_get(self):
result = []
for move in self:
if move.state == 'draft':
name = '* ' + str(move.id)
else:
name = move.name
result.append((move.id, name))
return result
Hope it will help you.
Upvotes: 3