Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
4 Antwoorden
1459 Weergaven

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

Avatar
Annuleer
Beste antwoord

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
Annuleer
Beste antwoord

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

Avatar
Annuleer
Auteur Beste antwoord

i want to all fields in record to be uneditable

Avatar
Annuleer
Beste antwoord

Use the following code in your XML:

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

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
4
okt. 25
314
2
okt. 25
384
1
okt. 25
373
1
sep. 25
347
1
sep. 25
428