add openeducat modules

This commit is contained in:
XuanHuyen
2025-05-05 09:03:48 +07:00
parent 4f8478d1e7
commit 0bf3600b22
1206 changed files with 317180 additions and 0 deletions
@@ -0,0 +1,42 @@
###############################################################################
#
# OpenEduCat Inc
# Copyright (C) 2009-TODAY OpenEduCat Inc(<https://www.openeducat.org>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class OpExamRoom(models.Model):
_name = "op.exam.room"
_description = "Exam Room"
name = fields.Char('Name', size=256, required=True)
classroom_id = fields.Many2one('op.classroom', 'Classroom', required=True)
capacity = fields.Integer('Capacity', required=True)
@api.constrains('capacity')
def check_capacity(self):
if self.capacity < 0:
raise ValidationError(_('Enter proper Capacity'))
elif self.capacity > self.classroom_id.capacity:
raise ValidationError(_('Capacity over Classroom capacity!'))
@api.onchange('classroom_id')
def onchange_classroom(self):
self.capacity = self.classroom_id.capacity