odoo_18_Education_management/models/schedule.py

69 lines
2.2 KiB
Python

from odoo import models, fields
from odoo.exceptions import UserError
_inherit = ['mail.thread', 'mail.activity.mixin']
class SchoolClassSchedule(models.Model):
_name = 'school.class.schedule'
_description = 'Class Schedule'
title = fields.Char(string="Title", required=True)
class_name = fields.Selection([
('1', 'Class 1'),
('2', 'Class 2'),
('3', 'Class 3'),
('4', 'Class 4'),
('5', 'Class 5'),
('6', 'Class 6'),
('7', 'Class 7'),
('8', 'Class 8'),
('9', 'Class 9'),
('10', 'Class 10'),
('11', 'Class 11'),
('12', 'Class 12'),
], string="Class", required=True)
subject = fields.Char(string="Subject")
teacher = fields.Char(string="Teacher")
secondary_teacher = fields.Char(string="Secondary Teacher")
start_date = fields.Date(string="Start From")
end_date = fields.Date(string="End Till")
total_class = fields.Integer(string="Total Classes")
total_enrollment = fields.Integer(string="Total Enrollments")
status = fields.Selection([
('draft', 'Draft'),
('active', 'Active'),
('completed', 'Completed'),
('cancelled', 'Cancelled')
], default='draft', string="Status")
school = fields.Char(string="School")
unit_credit = fields.Float(string="Unit Credit")
term = fields.Char(string="Term")
academic_year = fields.Char(string="Academic Year")
session = fields.Char(string="Session")
fees_structure = fields.Char(string="Fees Structure")
fees_status = fields.Selection([
('paid', 'Paid'),
('partial', 'Partial'),
('unpaid', 'Unpaid')
], string="Fees Status")
session_status = fields.Selection([
('planned', 'Planned'),
('running', 'Running'),
('ended', 'Ended')
], string="Session Status")
def action_send_message(self):
for record in self:
raise UserError("Send Message clicked for %s" % record.name)
def action_log_note(self):
for record in self:
raise UserError("Log Note clicked for %s" % record.name)
def action_schedule_activity(self):
for record in self:
raise UserError("Activity clicked for %s" % record.name)