This question has been flagged
3428 Views

on changes department_id i want corresponding semester_id this is the function which i am applying. But the return value is all the semester i want only those semester which related to department.

 def on_change_dep(self, cr, uid, ids,dep_id, context=None):
      vals = {}


      if dep_id:
         sem = self.pool.get('dep.semister').search(cr,uid,[('dep_id','=',dep_id)],context=None)


  if sem:   
     for dep_sem_id in sem: 
         val=self.pool.get('dep.semister').browse(cr,uid,dep_sem_id)
         if val:

            vals.update({'semester_id':val.sem_id.id}) 
         return {'value':vals}
  return True
Avatar
Discard
Author

hi prakash , using domain and value solution is not possible because semester_id and its corresponding department_id is stored in different model,where as if i use domain context then semester_id will find value from semester model where corresponding department is not stored .so if you have other solution please help me