2026-09-25 18:00:58 +05:30

23 lines
922 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)
_sql_constraints = [
('code_unique', 'unique(code)', 'Subject code must be unique!')
]