From 6baa855977686dfd47787b4b4b0f3a77ca15460f Mon Sep 17 00:00:00 2001 From: XuanHuyen Date: Sun, 23 Feb 2025 01:59:56 +0700 Subject: [PATCH] init --- education/__init__.py | 4 + education/__manifest__.py | 32 ++++++++ education/controllers/__init__.py | 3 + education/controllers/controllers.py | 22 ++++++ education/demo/demo.xml | 30 ++++++++ education/models/__init__.py | 6 ++ education/models/education_class.py | 9 +++ education/models/education_school.py | 9 +++ education/models/education_student.py | 23 ++++++ education/models/student_level.py | 11 +++ education/security/ir.model.access.csv | 5 ++ education/views/education_class_views.xml | 44 +++++++++++ education/views/education_student_views.xml | 81 +++++++++++++++++++++ education/views/student_level_views.xml | 25 +++++++ education/views/templates.xml | 24 ++++++ education/views/views.xml | 60 +++++++++++++++ 16 files changed, 388 insertions(+) create mode 100644 education/__init__.py create mode 100644 education/__manifest__.py create mode 100644 education/controllers/__init__.py create mode 100644 education/controllers/controllers.py create mode 100644 education/demo/demo.xml create mode 100644 education/models/__init__.py create mode 100644 education/models/education_class.py create mode 100644 education/models/education_school.py create mode 100644 education/models/education_student.py create mode 100644 education/models/student_level.py create mode 100644 education/security/ir.model.access.csv create mode 100644 education/views/education_class_views.xml create mode 100644 education/views/education_student_views.xml create mode 100644 education/views/student_level_views.xml create mode 100644 education/views/templates.xml create mode 100644 education/views/views.xml diff --git a/education/__init__.py b/education/__init__.py new file mode 100644 index 0000000..aa4d0fd --- /dev/null +++ b/education/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +from . import controllers +from . import models diff --git a/education/__manifest__.py b/education/__manifest__.py new file mode 100644 index 0000000..32f137f --- /dev/null +++ b/education/__manifest__.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +{ + 'name': "Education", + + 'summary': "Module education management", + + 'description': """ +Long description of module's purpose + """, + + 'author': "Huyen107", + 'website': "https://www.yourcompany.com", + + # Categories can be used to filter modules in modules listing + # Check https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/data/ir_module_category_data.xml + # for the full list + 'category': 'Education, Management', + 'version': '0.1', + + # any module necessary for this one to work correctly + 'depends': ['base'], + + # always loaded + 'data': [ + 'security/ir.model.access.csv', + 'views/education_student_views.xml', + 'views/education_class_views.xml', + 'views/student_level_views.xml', + + ], +} + diff --git a/education/controllers/__init__.py b/education/controllers/__init__.py new file mode 100644 index 0000000..b0f26a9 --- /dev/null +++ b/education/controllers/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import controllers diff --git a/education/controllers/controllers.py b/education/controllers/controllers.py new file mode 100644 index 0000000..497e6b0 --- /dev/null +++ b/education/controllers/controllers.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# from odoo import http + + +# class School(http.Controller): +# @http.route('/school/school', auth='public') +# def index(self, **kw): +# return "Hello, world" + +# @http.route('/school/school/objects', auth='public') +# def list(self, **kw): +# return http.request.render('school.listing', { +# 'root': '/school/school', +# 'objects': http.request.env['school.school'].search([]), +# }) + +# @http.route('/school/school/objects/', auth='public') +# def object(self, obj, **kw): +# return http.request.render('school.object', { +# 'object': obj +# }) + diff --git a/education/demo/demo.xml b/education/demo/demo.xml new file mode 100644 index 0000000..c5b3056 --- /dev/null +++ b/education/demo/demo.xml @@ -0,0 +1,30 @@ + + + + + diff --git a/education/models/__init__.py b/education/models/__init__.py new file mode 100644 index 0000000..615b1d1 --- /dev/null +++ b/education/models/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- + +from . import education_student +from . import education_class +from . import student_level +from . import education_school \ No newline at end of file diff --git a/education/models/education_class.py b/education/models/education_class.py new file mode 100644 index 0000000..a5ee81e --- /dev/null +++ b/education/models/education_class.py @@ -0,0 +1,9 @@ +from odoo import fields, api, models + +class EducationClass(models.Model): + _name = 'education.class' + _description = 'Education Class' + + name = fields.Char(string='Name', required=True) + school_id = fields.Many2one('education.school', string='School', required=True) + teacher_ids = fields.Many2many('res.partner', string='Teachers') \ No newline at end of file diff --git a/education/models/education_school.py b/education/models/education_school.py new file mode 100644 index 0000000..bc3b6c8 --- /dev/null +++ b/education/models/education_school.py @@ -0,0 +1,9 @@ +from odoo import fields, api, models + +class EductionSchool(models.Model): + _name = 'education.school' + _description = 'School' + + name = fields.Char(string='Name', translate=True, required=True) + code = fields.Char(string='Code', copy=False) + class_ids = fields.One2many("education.class", "school_id", string="Classes") \ No newline at end of file diff --git a/education/models/education_student.py b/education/models/education_student.py new file mode 100644 index 0000000..f5a9113 --- /dev/null +++ b/education/models/education_student.py @@ -0,0 +1,23 @@ +from odoo import fields, api, models + +class EducationStudent(models.Model): + _name = "education.student" + _description = "Education Student" + + name = fields.Char(string='Name', required=True, translate=True) + student_code = fields.Char(string='Student Code', required=True, index=True, + help="Student ID is unique") + class_id = fields.Many2one("education.class", string="Class") + gender = fields.Selection([('male', 'Male'), ('female', 'Female'), ('other', 'Other')], + string='Gender', default='male') + date_of_birth = fields.Date(string='Date of Birth') + age = fields.Integer(string='Age') + active = fields.Boolean(string='Active', default=True) + notes = fields.Text(string='Internal Notes') + attached_file = fields.Binary('Attached File', groups='base.group_user') + description = fields.Html(string='Description', sanitize=True, strip_style=False) + total_score = fields.Float(string='Total Score') + write_date = fields.Datetime(string='Last Updated on') + + currency_id = fields.Many2one('res.currency', string='Currency') + amount_paid = fields.Monetary('Amount Paid') \ No newline at end of file diff --git a/education/models/student_level.py b/education/models/student_level.py new file mode 100644 index 0000000..1b607d0 --- /dev/null +++ b/education/models/student_level.py @@ -0,0 +1,11 @@ +from odoo import fields, api, models + +class StudentLevel(models.Model): + _name = "student.level" + _description = 'Student Level' + _order = "sequence, name" + _rec_name = "code" + + code = fields.Char(string="Code", required=True) + name = fields.Char(string='Name', translate=True, required=True) + sequence = fields.Integer(string='Sequence', default=1) \ No newline at end of file diff --git a/education/security/ir.model.access.csv b/education/security/ir.model.access.csv new file mode 100644 index 0000000..93cb83f --- /dev/null +++ b/education/security/ir.model.access.csv @@ -0,0 +1,5 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_education_student,education.student,model_education_student,base.group_user,1,1,1,1 +access_education_class,education.class,model_education_class,base.group_user,1,1,1,1 +access_education_school,education.school,model_education_school,base.group_user,1,1,1,1 +access_student_level,student.level,model_student_level,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/education/views/education_class_views.xml b/education/views/education_class_views.xml new file mode 100644 index 0000000..1b699a2 --- /dev/null +++ b/education/views/education_class_views.xml @@ -0,0 +1,44 @@ + + + + + + Class + education.class + list,form + + + + + education.class.view.form + education.class + +
+ + + + + +
+
+
+ + + + education.class.view.list + education.class + + + + + + + + + + +
\ No newline at end of file diff --git a/education/views/education_student_views.xml b/education/views/education_student_views.xml new file mode 100644 index 0000000..b4afa54 --- /dev/null +++ b/education/views/education_student_views.xml @@ -0,0 +1,81 @@ + + + + + + Students + education.student + list,form + + + + + education.student.view.form + education.student + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + education.student.view.list + education.student + + + + + + + + + + + + education.student.view.search + education.student + + + + + + + + + + + + +
\ No newline at end of file diff --git a/education/views/student_level_views.xml b/education/views/student_level_views.xml new file mode 100644 index 0000000..1855bc7 --- /dev/null +++ b/education/views/student_level_views.xml @@ -0,0 +1,25 @@ + + + + + + student.level.form + student.level + +
+ + + + + + + + + + + +
+
+
+ +
\ No newline at end of file diff --git a/education/views/templates.xml b/education/views/templates.xml new file mode 100644 index 0000000..2f37b71 --- /dev/null +++ b/education/views/templates.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/education/views/views.xml b/education/views/views.xml new file mode 100644 index 0000000..10ff875 --- /dev/null +++ b/education/views/views.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + +