create module student management
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import controllers
|
||||
from . import models
|
||||
@@ -0,0 +1,38 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': "Student Management",
|
||||
|
||||
'summary': "Short (1 phrase/line) summary of the module's purpose",
|
||||
|
||||
'description': """
|
||||
Long description of module's purpose
|
||||
""",
|
||||
|
||||
'author': "My Company",
|
||||
'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': 'Management',
|
||||
'version': '0.1',
|
||||
|
||||
# any module necessary for this one to work correctly
|
||||
'depends': ['base'],
|
||||
|
||||
# always loaded
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'views/student_student_views.xml',
|
||||
'views/student_course_views.xml',
|
||||
'views/student_menus.xml',
|
||||
],
|
||||
# only loaded in demonstration mode
|
||||
'demo': [
|
||||
'demo/demo.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'application': True,
|
||||
'auto_install': False,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import controllers
|
||||
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# from odoo import http
|
||||
|
||||
|
||||
# class StudentManagement(http.Controller):
|
||||
# @http.route('/student_management/student_management', auth='public')
|
||||
# def index(self, **kw):
|
||||
# return "Hello, world"
|
||||
|
||||
# @http.route('/student_management/student_management/objects', auth='public')
|
||||
# def list(self, **kw):
|
||||
# return http.request.render('student_management.listing', {
|
||||
# 'root': '/student_management/student_management',
|
||||
# 'objects': http.request.env['student_management.student_management'].search([]),
|
||||
# })
|
||||
|
||||
# @http.route('/student_management/student_management/objects/<model("student_management.student_management"):obj>', auth='public')
|
||||
# def object(self, obj, **kw):
|
||||
# return http.request.render('student_management.object', {
|
||||
# 'object': obj
|
||||
# })
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<!--
|
||||
<record id="object0" model="student_management.student_management">
|
||||
<field name="name">Object 0</field>
|
||||
<field name="value">0</field>
|
||||
</record>
|
||||
|
||||
<record id="object1" model="student_management.student_management">
|
||||
<field name="name">Object 1</field>
|
||||
<field name="value">10</field>
|
||||
</record>
|
||||
|
||||
<record id="object2" model="student_management.student_management">
|
||||
<field name="name">Object 2</field>
|
||||
<field name="value">20</field>
|
||||
</record>
|
||||
|
||||
<record id="object3" model="student_management.student_management">
|
||||
<field name="name">Object 3</field>
|
||||
<field name="value">30</field>
|
||||
</record>
|
||||
|
||||
<record id="object4" model="student_management.student_management">
|
||||
<field name="name">Object 4</field>
|
||||
<field name="value">40</field>
|
||||
</record>
|
||||
-->
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import student_student
|
||||
from . import student_course
|
||||
@@ -0,0 +1,10 @@
|
||||
from odoo import fields, models
|
||||
|
||||
class StudentCourse(models.Model):
|
||||
_name = 'student.course'
|
||||
_description = 'Student Course'
|
||||
|
||||
name = fields.Char(string='Môn học', required=True)
|
||||
code = fields.Char(string='Mã môn học', required=True, unique=True)
|
||||
credit = fields.Integer(string='Số tín chỉ')
|
||||
student_ids = fields.Many2many('student.student', string='Học sinh')
|
||||
@@ -0,0 +1,16 @@
|
||||
from odoo import fields, models
|
||||
|
||||
class StudentStudent(models.Model):
|
||||
_name = 'student.student'
|
||||
_description = 'Student Management'
|
||||
|
||||
name = fields.Char(string='Tên học sinh', required=True)
|
||||
student_id = fields.Char(string='Mã học sinh', unique=True)
|
||||
birth_date = fields.Date(string='Ngày sinh')
|
||||
gender = fields.Selection([
|
||||
('male', 'Nam giới'),
|
||||
('female', 'Nữ giới')
|
||||
])
|
||||
email = fields.Char(string='Email', required=True, unique=True)
|
||||
phone = fields.Char(string='Số điện thoại')
|
||||
course_ids = fields.Many2many('student.course', string='Môn học')
|
||||
@@ -0,0 +1,3 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_student_student,student_student,model_student_student,base.group_user,1,1,1,1
|
||||
access_student_course,student_course,model_student_course,base.group_user,1,1,1,1
|
||||
|
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_student_course_list" model="ir.ui.view">
|
||||
<field name="name">student.course.view.tree</field>
|
||||
<field name="model">student.course</field>
|
||||
<field name="arch" type="xml">
|
||||
<list string="Danh sách môn học">
|
||||
<field name="name" />
|
||||
<field name="code" />
|
||||
<field name="credit" />
|
||||
<field name="student_ids" />
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_student_course_form" model="ir.ui.view">
|
||||
<field name="name">student.course.view.form</field>
|
||||
<field name="model">student.course</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Form môn học">
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name" />
|
||||
<field name="code" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="credit" />
|
||||
</group>
|
||||
<notebook>
|
||||
<page name="" string="Học sinh">
|
||||
<field name="student_ids" />
|
||||
</page>
|
||||
</notebook>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_student_course" model="ir.actions.act_window">
|
||||
<field name="name">Môn học</field>
|
||||
<field name="res_model">student.course</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<menuitem
|
||||
id="menu_student"
|
||||
name="Học sinh"
|
||||
sequence="10" />
|
||||
<menuitem
|
||||
id="menu_student_student"
|
||||
name="Học sinh"
|
||||
action="action_student_student"
|
||||
parent="menu_student"
|
||||
sequence="10" />
|
||||
<menuitem
|
||||
id="menu_student_course"
|
||||
name="Môn học"
|
||||
action="action_student_course"
|
||||
parent="menu_student"
|
||||
sequence="10" />
|
||||
|
||||
</odoo>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_student_student_tree" model="ir.ui.view">
|
||||
<field name="name">student.student.list</field>
|
||||
<field name="model">student.student</field>
|
||||
<field name="arch" type="xml">
|
||||
<list string="Danh sách học sinh">
|
||||
<field name="name" />
|
||||
<field name="student_id" />
|
||||
<field name="birth_date" />
|
||||
<field name="gender" />
|
||||
<field name="email" />
|
||||
<field name="phone" />
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_student_student_form" model="ir.ui.view">
|
||||
<field name="name">student.student.form</field>
|
||||
<field name="model">student.student</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Form học sinh">
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name" />
|
||||
<field name="student_id" />
|
||||
<field name="email" />
|
||||
<field name="phone" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="birth_date" />
|
||||
<field name="gender" widget="radio" />
|
||||
<field name="course_ids" widget="many2many_tags" />
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_student_student" model="ir.actions.act_window">
|
||||
<field name="name">Học sinh</field>
|
||||
<field name="res_model">student.student</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user