diff --git a/education/__manifest__.py b/education/__manifest__.py index cd1e890..d50b298 100644 --- a/education/__manifest__.py +++ b/education/__manifest__.py @@ -22,13 +22,16 @@ # always loaded 'data': [ - # 'security/ir.model.access.csv', - 'views/views.xml', - 'views/templates.xml', + 'security/education_security.xml', + 'security/ir.model.access.csv', + 'views/education_menu_views.xml', + 'views/education_student_views.xml', + 'views/education_class_views.xml', + ], # only loaded in demonstration mode - # 'demo': [ - # 'demo/demo.xml', - # ], + 'demo': [ + 'demo/demo.xml', + ], } diff --git a/education/models/__init__.py b/education/models/__init__.py index b455415..72ae638 100644 --- a/education/models/__init__.py +++ b/education/models/__init__.py @@ -5,3 +5,4 @@ from . import education_class_group from . import education_student from . import education_school from . import education_student_level +from . import res_partner \ No newline at end of file diff --git a/education/models/education_class.py b/education/models/education_class.py index 300e4d1..9ad184a 100644 --- a/education/models/education_class.py +++ b/education/models/education_class.py @@ -26,5 +26,4 @@ class EducationClass(models.Model): student_ids = fields.One2many("education.student", "class_id", string="Students") school_id = fields.Many2one("education.school", string="School", required=True) active = fields.Boolean(string="Active", default=True) - school_id = fields.Many2one("education.school", string="School", required=True) teacher_ids = fields.Many2many("res.partner", string="Teachers") diff --git a/education/models/education_class_group.py b/education/models/education_class_group.py index 285b346..d3a9cdb 100644 --- a/education/models/education_class_group.py +++ b/education/models/education_class_group.py @@ -7,15 +7,16 @@ class EductionClassGroup(models.Model): _order = 'sequence' name = fields.Char(string='Name', translate=True, required=True) - parent_id = fields.Many2one('education.class.group', string='Parent Group', ondelete='restrict') - child_ids = fields.One2many('education.class.group', string='Child Groups', ondelete='restrict') - class_ids = fields.One2many('education.class', 'class_group_id', string='Class of Groups') + # parent_id = fields.Many2one('education.class.group', string='Parent Group', ondelete='restrict') + # child_ids = fields.One2many('education.class.group', string='Child Groups', ondelete='restrict') + + # class_ids = fields.One2many('education.class', 'class_group_id', string='Class of Groups') _parent_store = True _parent_name = "parent_id" parent_path = fields.Char(index=True) - @api.constraints('parent_id') + @api.constrains('parent_id') def _check_hierarchy(self): if not self._check_recursion(): raise ValidationError('Error! You cannot create recursivecategories.') \ No newline at end of file diff --git a/education/models/education_student.py b/education/models/education_student.py index ebe68dd..1fcf973 100644 --- a/education/models/education_student.py +++ b/education/models/education_student.py @@ -35,7 +35,7 @@ class EducationStudent(models.Model): write_date = fields.Datetime(string="Last Updated on") currency_id = fields.Many2one("res.currency", string="Currency") amount_paid = fields.Monetary("Amount Paid") - + class_id = fields.Many2one("education.class", string="Education Class") @api.depends("date_of_birth") def _compute_age(self): curent_year = fields.Date.today().year diff --git a/education/models/education_student_level.py b/education/models/education_student_level.py index 5bcea49..c2e5895 100644 --- a/education/models/education_student_level.py +++ b/education/models/education_student_level.py @@ -1,7 +1,7 @@ from odoo import fields, models class StudentLevel(models.Model): - _name = 'student.level' + _name = 'education.student.level' _description = 'Student Level' _order = 'sequence, name' _rec_name = 'code' diff --git a/education/models/res_partner.py b/education/models/res_partner.py new file mode 100644 index 0000000..7bc5793 --- /dev/null +++ b/education/models/res_partner.py @@ -0,0 +1,9 @@ +from odoo import fields, models, api + +class ResPartner(models.Model): + _inherit = 'res.partner' + + is_teacher = fields.Boolean(string='Is Teacher') + def _get_all_teachers(self): + return self.search([('is_teacher', '=', True)]) + \ No newline at end of file diff --git a/education/security/edutcation_security.xml b/education/security/education_security.xml similarity index 99% rename from education/security/edutcation_security.xml rename to education/security/education_security.xml index 191f378..ce6624a 100644 --- a/education/security/edutcation_security.xml +++ b/education/security/education_security.xml @@ -31,7 +31,6 @@ [('is_private', '=', False)] - School: See all schools diff --git a/education/security/ir.model.access.csv b/education/security/ir.model.access.csv index d31ea33..d547e23 100644 --- a/education/security/ir.model.access.csv +++ b/education/security/ir.model.access.csv @@ -1,5 +1,7 @@ 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 access_education_school_user,education.school user,model_education_school,education_group_user,1,0,0,0 access_education_school_admin,education.school admin,model_education_school,education_group_admin,1,1,1,1 -access_education_class_allow_manager,education.class allow_manager,model_education_class,education_group_allow_manager_class,1,1,1,1 \ No newline at end of file +access_education_class_allow_manager,education.class allow_manager,model_education_class,education_group_allow_manager_class,1,1,1,1 +access_education_class_group,education.class user,model_education_class_group,education_group_user,1,0,0,0 +access_education_student,education.student user,model_education_student,education_group_user,1,0,0,0 +access_education_student_level,education.student.level user,model_education_student_level,education_group_user,1,0,0,0 \ No newline at end of file diff --git a/education/views/education_class_views.xml b/education/views/education_class_views.xml index 931eea3..d45b79b 100644 --- a/education/views/education_class_views.xml +++ b/education/views/education_class_views.xml @@ -7,8 +7,7 @@
- + @@ -18,7 +17,6 @@ - @@ -43,9 +41,4 @@ list,form - \ No newline at end of file diff --git a/education/views/education_menu_views.xml b/education/views/education_menu_views.xml new file mode 100644 index 0000000..eadcb81 --- /dev/null +++ b/education/views/education_menu_views.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/education/views/education_student_level_views.xml b/education/views/education_student_level_views.xml index d4f3a47..58e3659 100644 --- a/education/views/education_student_level_views.xml +++ b/education/views/education_student_level_views.xml @@ -1,7 +1,7 @@ - student.level.form - student.level + education.student.level.form + education.student.level diff --git a/education/views/education_student_views.xml b/education/views/education_student_views.xml index b0dff21..e23a6db 100644 --- a/education/views/education_student_views.xml +++ b/education/views/education_student_views.xml @@ -36,11 +36,11 @@ education.student.list education.student - + - + @@ -59,7 +59,5 @@ education.student list,form - - + \ No newline at end of file diff --git a/education/views/templates.xml b/education/views/templates.xml deleted file mode 100644 index 2f37b71..0000000 --- a/education/views/templates.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - -