コンテンツへスキップ
メニュー
この質問にフラグが付けられました
4 返信
1075 ビュー

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

アバター
破棄
最善の回答

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

アバター
破棄
最善の回答

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

アバター
破棄
著作者 最善の回答

i want to all fields in record to be uneditable

アバター
破棄
最善の回答

Use the following code in your XML:

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

アバター
破棄
関連投稿 返信 ビュー 活動
0
8月 25
136
1
8月 25
570
1
8月 25
485
4
7月 25
1819
1
7月 25
1035