完善教育 #29
@@ -24,7 +24,7 @@
|
||||
""",
|
||||
'category': 'Education',
|
||||
'sequence': 20,
|
||||
'depends': ['base', 'web', 'mail'],
|
||||
'depends': ['base', 'web', 'mail', 'base_install_request'],
|
||||
'external_dependencies': {
|
||||
'python': ['pypinyin'],
|
||||
},
|
||||
|
||||
@@ -8,12 +8,19 @@
|
||||
<field name="name">老师</field>
|
||||
<field name="category_id" ref="module_category_education"/>
|
||||
<field name="comment">可创建/管理课程、布置与批改作业、查看全部学习进展。</field>
|
||||
<!-- 让老师拥有「访问权限」级权限(隐含 base.group_erp_manager)。
|
||||
模块安装的 Python 层 is_admin() 检查 base.group_erp_manager,
|
||||
因此老师可安装/升级/卸载模块;但老师不是 base.group_system,
|
||||
所以看不到「设置」菜单。 -->
|
||||
<field name="implied_ids" eval="[(4, ref('base.group_erp_manager'))]"/>
|
||||
</record>
|
||||
|
||||
<record id="group_student" model="res.groups">
|
||||
<field name="name">学生</field>
|
||||
<field name="category_id" ref="module_category_education"/>
|
||||
<field name="comment">可查看自己选课的课程、提交作业、查看自己的学习进展,不能创建课程。</field>
|
||||
<!-- 学生仅内部用户,可登录但无模块管理权限 -->
|
||||
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
|
||||
</record>
|
||||
|
||||
<!-- 学生只能访问自己的习题作答 -->
|
||||
|
||||
@@ -44,3 +44,5 @@ access_yuthon_school_training_student,yuthon.school.training.student,model_yutho
|
||||
access_yuthon_about_page_admin,yuthon.about.page.admin,model_yuthon_about_page,base.group_system,1,1,1,1
|
||||
access_yuthon_about_page_teacher,yuthon.about.page.teacher,model_yuthon_about_page,college.group_teacher,1,1,1,1
|
||||
access_yuthon_about_page_student,yuthon.about.page.student,model_yuthon_about_page,college.group_student,1,0,0,0
|
||||
access_ir_module_module_teacher,ir.module.module.teacher,base.model_ir_module_module,college.group_teacher,1,1,1,1
|
||||
access_ir_module_module_student,ir.module.module.student.read,base.model_ir_module_module,college.group_student,1,0,0,0
|
||||
|
||||
|
+89
-1
@@ -55,12 +55,100 @@ else:
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
<!-- ===================== 仅对超级管理员显示 Odoo 默认「应用」菜单(模块安装器) ===================== -->
|
||||
<!-- ===================== 「设置」菜单:仅超级管理员可见 ===================== -->
|
||||
<record id="base.menu_management" model="ir.ui.menu">
|
||||
<field name="active" eval="True"/>
|
||||
<field name="groups_id" eval="[(6, 0, [ref('base.group_system')])]"/>
|
||||
</record>
|
||||
|
||||
<!-- ===================== 原生「应用」菜单:师生可见 =====================
|
||||
让老师、学生都能在左侧看到 Odoo 默认的「应用」菜单(模块列表)。
|
||||
由于「应用」挂在「设置」下,这里单独给 base.menu_apps 追加
|
||||
teacher/student 组,菜单会脱离隐藏的父菜单提升到顶层。
|
||||
权限区分:
|
||||
- 老师:group_teacher 隐含 base.group_erp_manager,可安装/升级/卸载模块
|
||||
(模块按钮已放开到 group_erp_manager),但看不到「设置」菜单;
|
||||
- 学生:仅 group_user,只读浏览,无法安装/升级/卸载。 -->
|
||||
<record id="base.menu_apps" model="ir.ui.menu">
|
||||
<field name="groups_id" eval="[
|
||||
(6, 0, [
|
||||
ref('base.group_system'),
|
||||
ref('college.group_teacher'),
|
||||
ref('college.group_student'),
|
||||
])
|
||||
]"/>
|
||||
</record>
|
||||
|
||||
<!-- ===================== 隐藏学生的「请求访问」按钮 =====================
|
||||
base_install_request 给所有非系统管理员都加了「Request Access」按钮,
|
||||
学生点了会发起安装申请。这里把该按钮限定为仅管理员可见,让学生彻底只读。 -->
|
||||
<record id="view_module_kanban_hide_request_access" model="ir.ui.view">
|
||||
<field name="name">ir.module.module.kanban.hide.request.access</field>
|
||||
<field name="model">ir.module.module</field>
|
||||
<field name="inherit_id" ref="base_install_request.ir_module_module_view_kanban"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='action_open_install_request']" position="attributes">
|
||||
<attribute name="groups">base.group_system</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- ===================== 模块按钮放开给「访问权限」组 =====================
|
||||
原生模块安装/升级/卸载按钮 groups="base.group_system",导致只有设置组
|
||||
(管理员)可见。为了让老师(group_erp_manager)能安装模块、又不用进
|
||||
「设置」,把这些按钮的 groups 从 group_system 改为 group_erp_manager。
|
||||
老师属于 group_erp_manager,可见可点;学生只属于 group_user,仍不可见。 -->
|
||||
<!-- 看板视图(应用列表卡片) -->
|
||||
<record id="view_module_kanban_teacher_install" model="ir.ui.view">
|
||||
<field name="name">ir.module.module.kanban.teacher.install</field>
|
||||
<field name="model">ir.module.module</field>
|
||||
<field name="inherit_id" ref="base.module_view_kanban"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='button_immediate_install']" position="attributes">
|
||||
<attribute name="groups">base.group_erp_manager</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//a[@name='button_immediate_upgrade']" position="attributes">
|
||||
<attribute name="groups">base.group_erp_manager</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//a[@name='button_uninstall_wizard']" position="attributes">
|
||||
<attribute name="groups">base.group_erp_manager</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='button_uninstall_cancel']" position="attributes">
|
||||
<attribute name="groups">base.group_erp_manager</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='button_install_cancel']" position="attributes">
|
||||
<attribute name="groups">base.group_erp_manager</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- 表单视图(模块详情页) -->
|
||||
<record id="view_module_form_teacher_install" model="ir.ui.view">
|
||||
<field name="name">ir.module.module.form.teacher.install</field>
|
||||
<field name="model">ir.module.module</field>
|
||||
<field name="inherit_id" ref="base.module_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='button_immediate_install']" position="attributes">
|
||||
<attribute name="groups">base.group_erp_manager</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='button_immediate_upgrade']" position="attributes">
|
||||
<attribute name="groups">base.group_erp_manager</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='button_uninstall_wizard']" position="attributes">
|
||||
<attribute name="groups">base.group_erp_manager</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='button_uninstall_cancel']" position="attributes">
|
||||
<attribute name="groups">base.group_erp_manager</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='button_upgrade_cancel']" position="attributes">
|
||||
<attribute name="groups">base.group_erp_manager</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='button_install_cancel']" position="attributes">
|
||||
<attribute name="groups">base.group_erp_manager</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- ===================== 教育(根) ===================== -->
|
||||
<menuitem id="menu_yuthon_education_root"
|
||||
name="学习管理"
|
||||
|
||||
Reference in New Issue
Block a user