Hi, I am trying to copy ids into a many2many field, but it throws list index out of range error. Can someone please help me where I am doing a mistake
@api.onchange('course_id') 
def get_default_subject_ids(self): 
    res = [] 
    if len(self.course_id.subject_ids): 
        for subject in self.course_id.subject_ids : 
            res.append(subject.id) 
        self.subject_ids= [0,0,res] 
    return True 
 
Debugged it and observed that it throws list index out of range @ self.subject_ids= [0,0,res]
Regards,
Narender
 
                        
i have tried that before, but it then throws
argument of type 'bool' is not iterable error