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:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Proyecto
- MRP
Se marcó esta pregunta
3
Respuestas
3228
Vistas
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
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
Inscribirse