我想将多个字符字段连接到一个多对一字段中,并在其他模块中访问它。我们怎样才能做到这一点?
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.
有人可以帮我吗?
最佳答案
使用name_get
函数。
例如:
@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
希望对您有帮助。
关于python - 如何在一个多对一字段中连接多个字符字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46989213/