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

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 ? 

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

yes i did but still not working

Tác giả Câu trả lời hay nhất

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)

Ảnh đại diện
Huỷ bỏ

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

Tác giả

yesi did but still not working

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

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 10 24
1473
0
thg 7 24
1235
0
thg 11 23
1425
0
thg 9 23
2047
1
thg 11 22
4136