File "/opt/odoo/odoo/models.py", line 4042, in _where_calc
where_clause, where_params = e.to_sql()
File "/opt/odoo/odoo/osv/expression.py", line 1290, in to_sql
q, p = self.__leaf_to_sql(leaf)
File "/opt/odoo/odoo/osv/expression.py", line 1157, in __leaf_to_sql
"Invalid value %r in domain term %r" % (right, leaf)
AssertionError: Invalid value jntukstudent.course(2,) in domain term ('course', '=', jntukstudent.course(2,))
py file:
@api.multi
@api.onchange('course')
def onchange_class_info1(self):
'''Method to get student roll no'''
stud_list = []
stud_obj = self.env['jntuk.student']
for rec in self:
if rec.course:
stud_list = [{'roll_no': stu.name}
for stu in stud_obj.search([('course', '=',
rec.course),
])]
rec.student_id = stud_list
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- 客户关系管理
- e-Commerce
- 会计
- 库存
- PoS
- 项目
- MRP
此问题已终结
3
回复
3236
查看
Hello
You have to pass the integer value instead of object into the domain, so make the following change into your method. then try to execute your code.
@api.multi
@api.onchange('course')
def onchange_class_info1(self):
'''Method to get student roll no'''
stud_list = []
stud_obj = self.env['jntuk.student']
for rec in self:
if rec.course:
stud_list = [{'roll_no': stu.name}
for stu in stud_obj.search([('course', '=',
rec.course.id),
])]
rec.student_id = stud_list
Hello,
In domain you are passing browse object of jntukstudent.course(2,) instead of id, so you are getting that error
Thank you sooo much mithul