Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
4 Respostas
1441 Visualizações

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

Avatar
Cancelar
Melhor resposta

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
Cancelar
Melhor resposta

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

Avatar
Cancelar
Autor Melhor resposta

i want to all fields in record to be uneditable

Avatar
Cancelar
Melhor resposta

Use the following code in your XML:

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

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
4
out. 25
263
2
out. 25
364
1
out. 25
348
1
set. 25
341
1
set. 25
425