How to retrieve values on Many2one field using OnChange ?
the student should be registered in one standard and one group ... the standard have multi groups so i want that when i change the field standard .. the group field should be updated with the groups in that standard
When i try to do so it gives me an error
'Expected singleton: fci.standard.groups(3, 4, 5, 6)'
I'm trying that when i change the standard field the group field will be updated to select only groups in this standard
Here is my fields
'standard_id': fields.many2one('fci.standard', string='Standard', required=True),
'group_id': fields.many2one('fci.standard.groups', string='Standard Group'),
Here is my function
def on_change_standard(self, cr, uid, ids, standard_id, context=None):
val = {}
if not standard_id:
return {}
student_obj = self.pool.get('fci.standard')
student_data = student_obj.browse(cr, uid, standard_id, context=context)
val.update({'group_id': student_data.groups_ids.id})
return {'value': val}
and here is my xml
<field name="standard_id" on_change="on_change_standard(standard_id)" widget="selection"/>
<field name="group_id" widget="selection"/>