Skip to Content
Menu
This question has been flagged
2 Replies
1273 Views

py file:


class jntukstudentattendance(models.Model):
    _name='jntukstudent.attendance'
    _description='Student Attendance Tracking'
    student_id=fields.One2many('student.attendance1','stud_id',string="Students")
    course=fields.Many2one('jntukstudent.course','Course',required=True)
  



 @api.onchange('course')
    def onchange_standard_id(self):
        '''Method to get standard of student selected'''
        # raise ValidationError('Validation')
        stud_obj = self.env['jntuk.student']
        student_list = []
        for rec in self:
            if rec.course:
                stud_ids = stud_obj.search([('course', '=',rec.course.id)])
                _logger.debug("""This is my debug message ! ..............
                    .............................
                    .........................""")
                for stud in stud_ids:
                    student_list.append({'roll_no': stud.name,
                                             'is_present': True})

            rec.roll_no = student_list
 
      
class Studentattendanceform(models.Model):
  _name = 'student.attendance1'
  _description = 'Student attendance Details'


  roll_no = fields.Char('HallTicket Number')
  stud_id = fields.Many2one('jntukstudent.attendance','Name')

when i click course dropdown automatically get list of hall tickt numbers in notebook please help me i stuck  here


Avatar
Discard

By using related u can implement this

Try to implement with it..

Hope it will work

Author Best Answer

i didnot get you achu

Avatar
Discard

By using related in field u can implement this

For example:-

comment = fields.Char(related='partner_id.comment')