From 2b170da354afb8a9539ef4766e184690b8d1e485 Mon Sep 17 00:00:00 2001 From: hoangvv Date: Fri, 21 Feb 2025 18:00:17 +0700 Subject: [PATCH] add education module --- education/__init__.py | 4 +++ education/__manifest__.py | 34 +++++++++++++++++++++++ education/controllers/__init__.py | 3 ++ education/controllers/controllers.py | 22 +++++++++++++++ education/demo/demo.xml | 30 ++++++++++++++++++++ education/models/__init__.py | 5 ++++ education/models/education_class.py | 14 ++++++++++ education/models/education_class_group.py | 8 ++++++ education/models/education_student.py | 10 +++++++ education/security/ir.model.access.csv | 2 ++ education/views/education_class.xml | 19 +++++++++++++ education/views/templates.xml | 24 ++++++++++++++++ 12 files changed, 175 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_class_group.py create mode 100644 education/models/education_student.py create mode 100644 education/security/ir.model.access.csv create mode 100644 education/views/education_class.xml create mode 100644 education/views/templates.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..ab515f6 --- /dev/null +++ b/education/__manifest__.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +{ + 'name': "Education Management", + + 'summary': "This Module is for Education purpose", + + 'description': """ + This Module is for Education purpose + """, + + 'author': "NextZen", + 'website': "https://nextzenos.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': 'Tutorial', + 'version': '0.1', + + # any module necessary for this one to work correctly + 'depends': ['base'], + + # always loaded + 'data': [ + # 'security/ir.model.access.csv', + 'views/views.xml', + 'views/templates.xml', + ], + # only loaded in demonstration mode + 'demo': [ + 'demo/demo.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..451f8be --- /dev/null +++ b/education/controllers/controllers.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# from odoo import http + + +# class Education(http.Controller): +# @http.route('/education/education', auth='public') +# def index(self, **kw): +# return "Hello, world" + +# @http.route('/education/education/objects', auth='public') +# def list(self, **kw): +# return http.request.render('education.listing', { +# 'root': '/education/education', +# 'objects': http.request.env['education.education'].search([]), +# }) + +# @http.route('/education/education/objects/', auth='public') +# def object(self, obj, **kw): +# return http.request.render('education.object', { +# 'object': obj +# }) + diff --git a/education/demo/demo.xml b/education/demo/demo.xml new file mode 100644 index 0000000..28e6a0c --- /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..360af17 --- /dev/null +++ b/education/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- + +from . import education_class +from . import education_class_group +from . import education_student \ 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..06e574b --- /dev/null +++ b/education/models/education_class.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + +from odoo import models, fields + +class EducationClass(models.Model): + _name = 'education.class' + _description = 'Education Class' + + name = fields.Char(string='Name', required=True) + class_group_id = fields.Many2one('education.class.group', string='Class Group', ondelete='restrict') + next_class_id = fields.Many2one('education.class', string='Next Class') + + attachment_ids = fields.Many2many('ir.attachment', 'education_student_ir_attachment_rel', + 'attachment_id', 'student_id', string='Attachments') \ No newline at end of file diff --git a/education/models/education_class_group.py b/education/models/education_class_group.py new file mode 100644 index 0000000..bfe5c8b --- /dev/null +++ b/education/models/education_class_group.py @@ -0,0 +1,8 @@ +from odoo import fields, models + +class EductionClassGroup(models.Model): + _name = 'education.class.group' + _description = 'Education Class Group' + _order = 'sequence' + + class_ids = fields.One2many('education.class', 'class_group_id', string='Class of Groups') \ 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..8de1c2b --- /dev/null +++ b/education/models/education_student.py @@ -0,0 +1,10 @@ +from odoo import models, fields +class EducationStudent(models.Model): + _name = 'education.student' + + name = fields.Char(string="Name") + student_code = fields.Char(string='Student Code') + class_id = fields.Many2one('education.class', string='Class') + + def get_student_has_class(self): + return self.env['education.student'].search([('class_id', '!=', False)]) \ 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..1296a74 --- /dev/null +++ b/education/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_education_education,education.education,model_education_education,base.group_user,1,1,1,1 diff --git a/education/views/education_class.xml b/education/views/education_class.xml new file mode 100644 index 0000000..d797438 --- /dev/null +++ b/education/views/education_class.xml @@ -0,0 +1,19 @@ + + + + education.class.list + education.class + + + + + + + + Class + education.class + list,form + + + + 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 @@ + + + + +