class EducationStudentsAttendance(models.Model):
_name = 'education.attendances'
name = fields.Char(compute='get_name', string='Attendance Sheet Name', default='New')
# class_id = fields.Many2one('education.class', string='Class')
class_division = fields.Many2one('education.class.division', string='Class', required=True)
date = fields.Date(string='Date', default=fields.Date.today, required=True)
attendance_line = fields.One2many('education.attendances.line', 'attendance_id', string='Attendance Line')
attendance_created = fields.Boolean(string='Attendance Created')
state = fields.Selection([('draft', 'Draft'), ('done', 'Done')], default='draft')
academic_year = fields.Many2one('education.academic.year', string='Academic Year',
related='class_division.academic_year_id', store=True)
# add fields to relate timetable
week_day = fields.Char('Week Day')
subject = fields.Many2one('education.subject', string='Subject', required=True)
“”“这里在时间表中创建时如何获得class_division?”“”
答案 0 :(得分:1)
您可以使用Onchange API来做到这一点 看到这个例子
@api.onchange('date')
def set_name(self):
self.name = ('Your Text %s - %s') % (self.date, self.subject )