Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
6145 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Tác giả

@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

Câu trả lời hay nhất

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. 

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 5 25
1722
1
thg 4 25
1283
3
thg 9 24
14173
2
thg 2 24
2468
1
thg 7 23
2725