update education module
This commit is contained in:
parent
ab34ac054b
commit
7a6111136f
@ -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',
|
||||
],
|
||||
}
|
||||
|
||||
|
@ -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
|
@ -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")
|
||||
|
@ -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.')
|
@ -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
|
||||
|
@ -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'
|
||||
|
9
education/models/res_partner.py
Normal file
9
education/models/res_partner.py
Normal file
@ -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)])
|
||||
|
@ -31,7 +31,6 @@
|
||||
<field name="groups" eval="[(4, ref('education.education_group_user'))]" />
|
||||
<field name="domain_force">[('is_private', '=', False)]</field>
|
||||
</record>
|
||||
|
||||
<record id="education_school_rule_admin" model="ir.rule">
|
||||
<field name="name">School: See all schools</field>
|
||||
<field name="model_id" ref="model_education_school" />
|
@ -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
|
||||
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
|
|
@ -7,8 +7,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Class Form">
|
||||
<sheet>
|
||||
<widget name="web_ribbon" title="Archived" bg_color="bg-danger"
|
||||
attrs="{'invisible': [('active', '=', True)]}" />
|
||||
<widget name="web_ribbon" title="Archived" bg_color="bg-danger"/>
|
||||
<field name="active" invisible="1" />
|
||||
<group>
|
||||
<group>
|
||||
@ -18,7 +17,6 @@
|
||||
</group>
|
||||
<group>
|
||||
<field name="next_class_id" />
|
||||
<field name="company_id" groups="base.group_multi_company" />
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
@ -43,9 +41,4 @@
|
||||
<field name="view_mode">list,form</field>
|
||||
</record>
|
||||
</data>
|
||||
<menuitem id="education_class_allow_manager_menu"
|
||||
action="education_class_action"
|
||||
parent="education_management_menu_root"
|
||||
groups="education.education_group_allow_manager_class"
|
||||
sequence="100" />
|
||||
</odoo>
|
12
education/views/education_menu_views.xml
Normal file
12
education/views/education_menu_views.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<menuitem name="Education Manager" id="education_management_menu_root" />
|
||||
<menuitem id="education_student_menu" action="education_student_action"
|
||||
parent="education_management_menu_root" name="Students" sequence="50" />
|
||||
<menuitem name="Configurations" id="education_configuration_menu_root" />
|
||||
<menuitem id="education_class_allow_manager_menu"
|
||||
name="Class"
|
||||
action="education_class_action"
|
||||
parent="education_configuration_menu_root"
|
||||
sequence="10" />
|
||||
</odoo>
|
@ -1,7 +1,7 @@
|
||||
<odoo>
|
||||
<record id="student_level_view_form" model="ir.ui.view">
|
||||
<field name="name">student.level.form</field>
|
||||
<field name="model">student.level</field>
|
||||
<field name="name">education.student.level.form</field>
|
||||
<field name="model">education.student.level</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Student Level Form">
|
||||
<sheet>
|
||||
|
@ -36,11 +36,11 @@
|
||||
<field name="name">education.student.list</field>
|
||||
<field name="model">education.student</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Student list">
|
||||
<list string="Student list">
|
||||
<field name="name" />
|
||||
<field name="student_code" />
|
||||
<field name="class_id" />
|
||||
</tree>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
<record id="education_student_view_search" model="ir.ui.view">
|
||||
@ -59,7 +59,5 @@
|
||||
<field name="res_model">education.student</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
</record>
|
||||
<menuitem name="Education Manager" id="education_student_menu_root" />
|
||||
<menuitem id="education_student_menu" action="education_student_action"
|
||||
parent="education_student_menu_root" name="Students" sequence="50" />
|
||||
|
||||
</odoo>
|
@ -1,24 +0,0 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<!--
|
||||
<template id="listing">
|
||||
<ul>
|
||||
<li t-foreach="objects" t-as="object">
|
||||
<a t-attf-href="#{ root }/objects/#{ object.id }">
|
||||
<t t-esc="object.display_name"/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
<template id="object">
|
||||
<h1><t t-esc="object.display_name"/></h1>
|
||||
<dl>
|
||||
<t t-foreach="object._fields" t-as="field">
|
||||
<dt><t t-esc="field"/></dt>
|
||||
<dd><t t-esc="object[field]"/></dd>
|
||||
</t>
|
||||
</dl>
|
||||
</template>
|
||||
-->
|
||||
</data>
|
||||
</odoo>
|
Loading…
Reference in New Issue
Block a user