Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
4 Răspunsuri
1098 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Autor Cel mai bun răspuns

i want to all fields in record to be uneditable

Imagine profil
Abandonează
Cel mai bun răspuns

Use the following code in your XML:

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
aug. 25
171
1
aug. 25
616
1
aug. 25
505
4
iul. 25
1841
1
iul. 25
1052