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
الردود
3243
أدوات العرض
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
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيل