Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
7524 Представления

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?

Related Posts Ответы Просмотры Активность
1
окт. 24
3583
9
июл. 21
63194
8
нояб. 19
7889
8
апр. 25
29072
3
авг. 24
16043