跳至内容
菜单
此问题已终结
3 回复
7540 查看

i have module which has three field.name,firstname and lastname,when user save it firstname and lastname

concatenate in name field,here name field must be readonly mod.

形象
丢弃
最佳答案

Hello Vijay,

This will help you.

name = fields.Char(compute='_compute_name', store="True")
firstname = fields.Char()
lastname = fields.Char()

@api.depends('firstname', 'lastname')
def _compute_name(self):
    for record in self:
        record.name = record.firstname + record.lastname

形象
丢弃
最佳答案

Hello, I think you've three options.

- Overriding the create and write functions.

-Use onchange method in the firstname and lastname: but if you used onchange method to modify a readonly field this will not update the field in DB, so you need to make an invisible field, as workaround.

-Make the name field as a functional field.

形象
丢弃
编写者

how to make name as functional field any demo function?

相关帖文 回复 查看 活动
1
10月 24
3768
9
7月 21
63197
8
11月 19
7894
8
4月 25
29079
3
8月 24
16048