跳至內容
選單
此問題已被標幟
2 回覆
3191 瀏覽次數

How to validate error message if some field is empty or uncheck etc ? is there any built-in function tag am using required in xml view but not working ? 

頭像
捨棄
作者

yes i did but still not working

作者 最佳答案

I tried but not working am using on the xml?? 

from odoo import fields, models, api, _from odoo.exceptions import UserError
class SchoolProfile(models.Model):    _name = "school.profile"
    name = fields.Many2one("school.profile", string="School Name", required=True)

頭像
捨棄

did you upgrade the module after making the changes in xml?

作者

yesi did but still not working

最佳答案

Hi,

The following ways allow you to make a field required: either updating in Python or XML.

<field name="employee_id" required="1"/>

OR

employee_id = fields.Many2one('hr.employee', string='Employee', required=1)



https://www.youtube.com/watch?v=TR1TVykJmgE

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
10月 24
1479
0
7月 24
1241
0
11月 23
1436
0
9月 23
2082
1
11月 22
4141