24 lines
926 B
Python
24 lines
926 B
Python
from odoo import models, fields, api
|
|
|
|
class EducationSubject(models.Model):
|
|
_name = 'education.subject'
|
|
_description = 'Education Subject'
|
|
|
|
name = fields.Char(string='Name', required=True)
|
|
code = fields.Char(string='Code', required=True)
|
|
program_id = fields.Many2one('education.program', string='Program', required=True)
|
|
academic_year_id = fields.Many2one('education.academic.year', string='Academic Year')
|
|
term_id = fields.Many2one('education.academic.term', string='Semester/Term')
|
|
credits = fields.Float(string='Credits', default=1.0)
|
|
subject_type = fields.Selection([
|
|
('theory', 'Theory'),
|
|
('practical', 'Practical'),
|
|
('both', 'Theory + Practical')
|
|
], string='Subject Type', required=True, default='theory')
|
|
active = fields.Boolean(default=True)
|
|
|
|
_code_unique = models.Constraint(
|
|
'unique(code)',
|
|
'Subject code must be unique!'
|
|
)
|