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

I want the status record to be uneditable if state = active, done

Аватар
Отменить
Лучший ответ

Hi,

In Odoo 17, to make a field (like status) read-only when the record’s state is either "active" or "done" You can achieve this using the 'readonly' attribute in the XML view, or by using Python logic with @api.depends and readonly=True on the field.


XML


<field name="status" readonly="state in ['active', 'done']"/>


Hope it helps

Аватар
Отменить
Лучший ответ

is this you need for particular users or all users  ( not to edit record - only view)

Аватар
Отменить
Автор Лучший ответ

i want to all fields in record to be uneditable

Аватар
Отменить
Лучший ответ

Use the following code in your XML:

field name="state" readonly="state in ['active', 'done']"

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
авг. 25
166
0
авг. 25
278
1
авг. 25
680
1
авг. 25
529
4
июл. 25
1885