Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
4 Replies
1451 Tampilan

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

Avatar
Buang
Jawaban Terbai

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
Buang
Jawaban Terbai

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

Avatar
Buang
Penulis Jawaban Terbai

i want to all fields in record to be uneditable

Avatar
Buang
Jawaban Terbai

Use the following code in your XML:

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

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
4
Okt 25
303
2
Okt 25
379
1
Okt 25
366
1
Sep 25
346
1
Sep 25
427