Skip to Content
Menú
This question has been flagged
4 Respostes
1105 Vistes

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

Avatar
Descartar
Best Answer

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

Avatar
Descartar
Best Answer

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

Avatar
Descartar
Autor Best Answer

i want to all fields in record to be uneditable

Avatar
Descartar
Best Answer

Use the following code in your XML:

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

Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
d’ag. 25
34
0
d’ag. 25
186
1
d’ag. 25
645
1
d’ag. 25
510
4
de jul. 25
1855