Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
4 Risposte
1117 Visualizzazioni

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

Avatar
Abbandona
Risposta migliore

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
Abbandona
Risposta migliore

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

Avatar
Abbandona
Autore Risposta migliore

i want to all fields in record to be uneditable

Avatar
Abbandona
Risposta migliore

Use the following code in your XML:

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

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
ago 25
133
0
ago 25
225
1
ago 25
662
1
ago 25
518
4
lug 25
1874