Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
4 Antworten
1076 Ansichten

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

Avatar
Verwerfen
Beste Antwort

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
Verwerfen
Beste Antwort

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

Avatar
Verwerfen
Autor Beste Antwort

i want to all fields in record to be uneditable

Avatar
Verwerfen
Beste Antwort

Use the following code in your XML:

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

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Aug. 25
136
1
Aug. 25
570
1
Aug. 25
485
4
Juli 25
1819
1
Juli 25
1035