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
+23
View File
@@ -0,0 +1,23 @@
###############################################################################
#
# 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 . import test_core_common
from . import test_core
+130
View File
@@ -0,0 +1,130 @@
###############################################################################
#
# 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 .test_core_common import TestCoreCommon
class TestCore(TestCoreCommon):
def setUp(self):
super(TestCore, self).setUp()
def test_case_1_batch(self):
batchs = self.op_batch.search([])
for batch in batchs:
batch.check_dates()
batch.name_search('BOA-S1')
def test_case_2_course(self):
courses = self.op_course.search([])
for course in courses:
course.get_import_templates()
def test_case_3_faculty(self):
faculty = self.op_faculty.search([])
new_faculty = self.op_faculty.create({
'partner_id': self.env.ref('openeducat_core.op_res_partner_30').id,
'first_name': 'binapshah',
'last_name': 'kalol',
'birth_date': '2009-01-01',
'gender': 'male',
})
new_faculty._onchange_name()
for rec in faculty:
rec._check_birthdate()
rec._onchange_name()
rec.create_employee()
rec.get_import_templates()
def test_case_4_hr_employe(self):
employs = self.hr_emp.search([])
for employ in employs:
employ.onchange_user()
employ.onchange_address_id()
def test_case_5_res_company(self):
users = self.res_company.search([])
record = self.env.ref('openeducat_core.op_faculty_1'),
users.create_user(record)
def test_case_6_student(self):
students = self.op_student.search([])
vals = {
'first_name': 'nikul',
'middle_name': 'm',
'last_name': 'ahir',
'birth_date': '1999-01-01',
'gender': 'm',
'partner_id': self.env.ref('openeducat_core.op_res_partner_14').id
}
new_student = self.op_student.create(vals)
for student in students:
student._onchange_name()
student._check_birthdate()
student.get_import_templates()
new_student.create_student_user()
def test_case_7_subject_registartion(self):
vals = {
'student_id': self.env.ref('openeducat_core.op_student_1').id,
'course_id': self.env.ref('openeducat_core.op_course_2').id,
'batch_id': self.env.ref('openeducat_core.op_batch_1').id,
}
registrations = self.subject_registration.create(vals)
for registration in registrations:
registration.action_reset_draft()
registration.action_reject()
registration.action_approve()
registration.action_submitted()
registration.get_subjects()
def test_case_7_update(self):
self.op_update._get_message()
self.op_update.update_notification(cron_mode=True)
def test_case_8_employ_wizard(self):
vals = {'user_boolean': True}
employe = self.employ_wizard.create(vals)
employe.create_employee()
def test_case_9_faculty_user_wizard(self):
faculty_id = self.env.ref('openeducat_core.op_faculty_1')
vals = {'faculty_ids': [(6, 0, [faculty_id.id])]}
faculty = self.faculty_user_wizard.create(vals)
faculty._get_faculties()
faculty.create_faculty_user()
def test_case_10_studnet_wizard(self):
student_id = self.env.ref('openeducat_core.op_student_1')
vals = {'student_ids': [(6, 0, [student_id.id])]}
student = self.studnet_wizard.create(vals)
student._get_students()
student.create_user()
@@ -0,0 +1,38 @@
###############################################################################
#
# 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.tests import TransactionCase
class TestCoreCommon(TransactionCase):
def setUp(self):
super(TestCoreCommon, self).setUp()
self.op_batch = self.env['op.batch']
self.op_faculty = self.env['op.faculty']
self.op_course = self.env['op.course']
self.res_company = self.env['res.users']
self.op_student = self.env['op.student']
self.hr_emp = self.env['hr.employee']
self.subject_registration = self.env['op.subject.registration']
self.op_update = self.env['publisher_warranty.contract']
self.employ_wizard = self.env['wizard.op.faculty.employee']
self.faculty_user_wizard = self.env['wizard.op.faculty']
self.studnet_wizard = self.env['wizard.op.student']