odoo_18_Education_management/models/school_course.py

34 lines
1.4 KiB
Python

from odoo import models, fields
from odoo.exceptions import UserError
class SchoolCourse(models.Model):
_name = 'school.course'
_description = 'Course'
name = fields.Char(string='Course Name', required=True)
class_id = fields.Many2one('school.class', string='Class')
teacher = fields.Many2one('res.users', string='Teacher')
start_date = fields.Date(string='Started On')
end_date = fields.Date(string='End Date')
total_capacity = fields.Integer(string='Total Capacity')
unit_credit = fields.Float(string='Unit Credit')
attendance_ids = fields.One2many('school.course.attendance', 'course_id', string='Attendance')
enrolled_student_ids = fields.One2many('school.course.student', 'course_id', string='Enrolled Students')
attendance_ids = fields.One2many('school.course.attendance', 'course_id', string='Attendance')
schedule_line_ids = fields.One2many('school.course.schedule', 'course_id', string='Weekly Schedule')
assignment_ids = fields.One2many('school.course.assignment', 'course_id', string='Assignments')
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)