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

Version: Odoo 13

Note: I am new to Odoo and it is possible that I am might be missing something obvious.

In a model form view I am using html field and I want to make it mandatory. I used required=True flag on python and also required="1" in xml but none helped.

in python:

rich_text = fields.Html('Field Name', required=True)

in xml: (form view)

<field name="rich_text" widget="html" required="1"/>


Any help is much appreciated. Thanks.

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

@Keval Mehta, I installed Lunch app and tested 'lunch alert' view with Html field. Though it is defined as required I am able to create alerts without that field.

Try adding required via css

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

refer to https://www.odoo.com/forum/help-1/question/how-to-make-a-html-field-mandatory-in-the-form-161104

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

Your define argument : 

rich_text = fields.Html('Field Name', required=True)

should be work as if you see in default odoo13 base you will find : 

message = fields.Html('Message', required=True) under ​addons/lunch/models/lunch_alert.py file. 

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
3
พ.ค. 25
1812
1
เม.ย. 25
1348
one2one relational field แก้ไขแล้ว
3
ก.ย. 24
14241
2
ก.พ. 24
2518
1
ก.ค. 23
2761