init
This commit is contained in:
parent
983b76ba74
commit
6baa855977
4
education/__init__.py
Normal file
4
education/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import controllers
|
||||
from . import models
|
32
education/__manifest__.py
Normal file
32
education/__manifest__.py
Normal file
@ -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',
|
||||
|
||||
],
|
||||
}
|
||||
|
3
education/controllers/__init__.py
Normal file
3
education/controllers/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import controllers
|
22
education/controllers/controllers.py
Normal file
22
education/controllers/controllers.py
Normal file
@ -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/<model("school.school"):obj>', auth='public')
|
||||
# def object(self, obj, **kw):
|
||||
# return http.request.render('school.object', {
|
||||
# 'object': obj
|
||||
# })
|
||||
|
30
education/demo/demo.xml
Normal file
30
education/demo/demo.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<!--
|
||||
<record id="object0" model="school.school">
|
||||
<field name="name">Object 0</field>
|
||||
<field name="value">0</field>
|
||||
</record>
|
||||
|
||||
<record id="object1" model="school.school">
|
||||
<field name="name">Object 1</field>
|
||||
<field name="value">10</field>
|
||||
</record>
|
||||
|
||||
<record id="object2" model="school.school">
|
||||
<field name="name">Object 2</field>
|
||||
<field name="value">20</field>
|
||||
</record>
|
||||
|
||||
<record id="object3" model="school.school">
|
||||
<field name="name">Object 3</field>
|
||||
<field name="value">30</field>
|
||||
</record>
|
||||
|
||||
<record id="object4" model="school.school">
|
||||
<field name="name">Object 4</field>
|
||||
<field name="value">40</field>
|
||||
</record>
|
||||
-->
|
||||
</data>
|
||||
</odoo>
|
6
education/models/__init__.py
Normal file
6
education/models/__init__.py
Normal file
@ -0,0 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import education_student
|
||||
from . import education_class
|
||||
from . import student_level
|
||||
from . import education_school
|
9
education/models/education_class.py
Normal file
9
education/models/education_class.py
Normal file
@ -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')
|
9
education/models/education_school.py
Normal file
9
education/models/education_school.py
Normal file
@ -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")
|
23
education/models/education_student.py
Normal file
23
education/models/education_student.py
Normal file
@ -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')
|
11
education/models/student_level.py
Normal file
11
education/models/student_level.py
Normal file
@ -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)
|
5
education/security/ir.model.access.csv
Normal file
5
education/security/ir.model.access.csv
Normal file
@ -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
|
|
44
education/views/education_class_views.xml
Normal file
44
education/views/education_class_views.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- action -->
|
||||
<record id="education_class_action" model="ir.actions.act_window">
|
||||
<field name="name">Class</field>
|
||||
<field name="res_model">education.class</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
</record>
|
||||
|
||||
<!-- form view -->
|
||||
<record id="education_class_view_form" model="ir.ui.view">
|
||||
<field name="name">education.class.view.form</field>
|
||||
<field name="model">education.class</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Class Form">
|
||||
<group>
|
||||
<group>
|
||||
<field name="name" />
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- list view -->
|
||||
<record id="education_class_view_list" model="ir.ui.view">
|
||||
<field name="name">education.class.view.list</field>
|
||||
<field name="model">education.class</field>
|
||||
<field name="arch" type="xml">
|
||||
<list string="class">
|
||||
<field name="name" />
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- menu -->
|
||||
<menuitem
|
||||
id="education_class_menu"
|
||||
name="Class"
|
||||
action="education_class_action"
|
||||
parent="education_student_menu_root" />
|
||||
|
||||
</odoo>
|
81
education/views/education_student_views.xml
Normal file
81
education/views/education_student_views.xml
Normal file
@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- action -->
|
||||
<record id="education_student_action" model="ir.actions.act_window">
|
||||
<field name="name">Students</field>
|
||||
<field name="res_model">education.student</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
</record>
|
||||
|
||||
<!-- form view -->
|
||||
<record id="education_student_view_form" model="ir.ui.view">
|
||||
<field name="name">education.student.view.form</field>
|
||||
<field name="model">education.student</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Student Form">
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name" />
|
||||
<field name="student_code" />
|
||||
<field name="gender" />
|
||||
<field name="date_of_birth" />
|
||||
<field name="age" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="total_score" />
|
||||
<field name="attached_file" />
|
||||
<field name="write_date" />
|
||||
<field name="currency_id" />
|
||||
<field name="amount_paid" />
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<field name="notes" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="description" />
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- list view -->
|
||||
<record id="education_student_view_list" model="ir.ui.view">
|
||||
<field name="name">education.student.view.list</field>
|
||||
<field name="model">education.student</field>
|
||||
<field name="arch" type="xml">
|
||||
<list string="Student">
|
||||
<field name="name" />
|
||||
<field name="student_code" />
|
||||
<field name="class_id" />
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- search -->
|
||||
<record id="education_student_view_search" model="ir.ui.view">
|
||||
<field name="name">education.student.view.search</field>
|
||||
<field name="model">education.student</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Student Search">
|
||||
<field name="name"
|
||||
filter_domain="['|', '|', ('name', 'ilike', self), ('student_code', '=', self)" />
|
||||
<field name="class_id" />
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- menu -->
|
||||
<menuitem
|
||||
id="education_student_menu_root"
|
||||
name="Education Manage" />
|
||||
<menuitem
|
||||
id="education_student_menu"
|
||||
name="Students"
|
||||
action="education_student_action"
|
||||
parent="education_student_menu_root" />
|
||||
|
||||
</odoo>
|
25
education/views/student_level_views.xml
Normal file
25
education/views/student_level_views.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- form view -->
|
||||
<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="arch" type="xml">
|
||||
<form string="Student Level Form">
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name" />
|
||||
<field name="sequence" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="code" />
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
24
education/views/templates.xml
Normal file
24
education/views/templates.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<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>
|
60
education/views/views.xml
Normal file
60
education/views/views.xml
Normal file
@ -0,0 +1,60 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- explicit list view definition -->
|
||||
<!--
|
||||
<record model="ir.ui.view" id="school.list">
|
||||
<field name="name">school list</field>
|
||||
<field name="model">school.school</field>
|
||||
<field name="arch" type="xml">
|
||||
<list>
|
||||
<field name="name"/>
|
||||
<field name="value"/>
|
||||
<field name="value2"/>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
<!-- actions opening views on models -->
|
||||
<!--
|
||||
<record model="ir.actions.act_window" id="school.action_window">
|
||||
<field name="name">school window</field>
|
||||
<field name="res_model">school.school</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
<!-- server action to the one above -->
|
||||
<!--
|
||||
<record model="ir.actions.server" id="school.action_server">
|
||||
<field name="name">school server</field>
|
||||
<field name="model_id" ref="model_school_school"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
action = {
|
||||
"type": "ir.actions.act_window",
|
||||
"view_mode": "list,form",
|
||||
"res_model": model._name,
|
||||
}
|
||||
</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
<!-- Top menu item -->
|
||||
<!--
|
||||
<menuitem name="school" id="school.menu_root"/>
|
||||
-->
|
||||
<!-- menu categories -->
|
||||
<!--
|
||||
<menuitem name="Menu 1" id="school.menu_1" parent="school.menu_root"/>
|
||||
<menuitem name="Menu 2" id="school.menu_2" parent="school.menu_root"/>
|
||||
-->
|
||||
<!-- actions -->
|
||||
<!--
|
||||
<menuitem name="List" id="school.menu_1_list" parent="school.menu_1"
|
||||
action="school.action_window"/>
|
||||
<menuitem name="Server to list" id="school" parent="school.menu_2"
|
||||
action="school.action_server"/>
|
||||
-->
|
||||
</data>
|
||||
</odoo>
|
Loading…
Reference in New Issue
Block a user