Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
4 Відповіді
1128 Переглядів

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
Change position chatter Вирішено
1
серп. 25
529
4
лип. 25
1886