Skip to Content
Menu
This question has been flagged
1 Reply
5326 Views
AssertionError: Invalid value course.coure() in domain term ('course_id', '=', course.coure())
i couldnot rectify this please help me why its come
regular_single_entry.py::
class regularsingle(models.Model):
_name='regular.single'
_description='Student registration'
# _inherits = ['regulardata.form',]

 
course_id=fields.Many2one('course.coure','Course',required=True )
regulation=fields.Many2one('student.regulation','regulation',required=True)
hallticket_no = fields.Char('HallTicket Number')
regular_data=fields.One2many('page.regular','regular_data1')
branch_id = fields.Many2one('branch.branch','Branch',required=True)
 
 


    @api.multi
@api.onchange('regulation')
def onchange_get_passeddata(self):
stud_list = []
stud_obj = self.env['regulardata.form'].search([('branch_id','=',self.branch_id),('course_id','=',self.course_id) ])
if self.regulation:
for stu in stud_obj:
for sub in stu.regular:
stud_list.append({'subject_code': sub.subject_code,'subject_name': sub.subject_name,'subject_type':sub.subject_type})

# _logger.debug(stud_list)
self.regular_data = stud_list



reglar_data.py:

class regulardataform(models.Model):
_name='regulardata.form'
_description='regular data'

name = fields.Char('Subject Name')

hallticket_no = fields.Char('HallTicket Number')

regulation = fields.Many2one('student.regulation','Regulation')
course_id=fields.Many2one('course.coure','Course',required=True)
regular=fields.One2many('regular.data','regular_data')
branch_id = fields.Many2one('branch.branch','Branch')
    college_id = fields.Many2one('college.colleege','College')
if it is char field then working ,it is many2one doesnot work(course_id,branch_id)

 

Avatar
Discard
Best Answer

Hi,

Please update this line in your code

        stud_obj = self.env['regulardata.form'].search([('branch_id','=',self.branch_id.id),('course_id','=',self.course_id.id)])


self.branch_id and self.course_id will return records to get the ID from it, you have to use self.branch_id.id and self.course_id.id


Thanks

Avatar
Discard
Author

damn working niyas thank you sooo much

Accepted the answer ;) Don't forget that 'self' is in your case on record but could be multiple. If it are multiple you'll get a singleton error.

Author

Okay thank you yenthe garu

Related Posts Replies Views Activity
1
Nov 24
18019
1
Sep 23
1203
3
May 23
4091
7
Apr 23
47092
1
Dec 22
6434