from odoo import fields, models,api

class EducationLevel(models.Model):
    _name = 'education.level'

    name = fields.Char(string='Name')
    level_expected_age = fields.Float(string="Level Expected Age")

class EducationClassroom(models.Model):
    _name = 'education.classroom'

    name = fields.Char(string='Name')
    education_level_id = fields.Many2one('education.level', string='Education Level')

class EducationResults(models.Model):
    _name = 'education.result'

    name = fields.Char(string='Name',compute="get_name")
    evaluation = fields.Char(string='Evaluation')
    rate_type = fields.Selection([
           ('from_4', 'From 4'),
           ('from_5', 'From 5'),
           ('from_100', 'From 100'),
      ], string='Rate Type')
    min_degree = fields.Float(string='Mini Degree')
    max_degree = fields.Float(string='Max Degree')

    @api.depends("evaluation","min_degree","max_degree")
    def get_name(self):
        for rec in self:
            if rec.evaluation and rec.max_degree and rec.min_degree:
                rec.name = rec.evaluation + " " + str(rec.min_degree) + "-" + str(rec.max_degree)
            else:
                rec.name=""

class StudyMaterial(models.Model):
    _name = 'study.material'

    name = fields.Char(string='Name')


class EducationExamType(models.Model):
    _name = 'education.exam.type'

    name = fields.Char(string='Name', required=True)