跳至内容
菜单
此问题已终结
4 回复
6142 查看

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

最佳答案

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. 

形象
丢弃
相关帖文 回复 查看 活动
3
5月 25
1717
1
4月 25
1282
3
9月 24
14170
2
2月 24
2467
1
7月 23
2725