Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
5 ตอบกลับ
8806 มุมมอง

I am trying to define a new field in read only mode, but it is not working:

<field name="sale_margin_percent" groups="base.group_user" attr="{'readonly': True}"/>

what is wrong with above definition? thanks

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

you can do readonly="1" without attr... attr is usefull if you want use a domain for conditional value...

อวตาร
ละทิ้ง
ผู้เขียน

If I save the record, should readonly="1" fields be stored into database?

คำตอบที่ดีที่สุด

You can use functional field for this purpose.

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Using readonly="1" makes the user not being able to edit the field, but it is neither moved to database when you store the record.

Aa the field is updatd by onchange events, I would like to be able to avoid user modifying that field but at the same time moving the value back to database on save.

Any ideas?

อวตาร
ละทิ้ง

You can create a second field. First fiels are updated by onchange and invisible in form. Second fields is a related in readonly. Should works...

Related Posts ตอบกลับ มุมมอง กิจกรรม
4
พ.ค. 23
10531
1
ม.ค. 19
9626
0
ต.ค. 17
3458
0
พ.ย. 16
2718
0
ต.ค. 16
4965