完善教育

This commit is contained in:
李鹏宇
2026-09-16 15:34:00 +08:00
parent 7601338f99
commit 89b67f0e7f
19 changed files with 43 additions and 1055 deletions
+3 -3
View File
@@ -16,9 +16,9 @@
10=Productivity(生产力) 11=Calendar(日历)
20=Uncategorized(未分类)
如需保留/恢复某类目,从下面列表中删除对应 id 即可。 -->
<!-- 默认只显示「系统原生」的应用,保持原 Apps 看板的横向卡片布局。
用户可通过搜索面板的「本地模块」过滤器切换到本地模块。 -->
<field name="domain">[('module_origin', '=', 'official'), ('application', '=', True), ('category_id', 'not in', [13, 54, 71, 15, 94, 6, 10, 11, 20])]</field>
<!-- 默认隐藏 Odoo 官方默认程序(module_origin='official'),仅显示本地/第三方应用;
如需临时查看官方应用,可在搜索面板点「系统原生」过滤器。 -->
<field name="domain">[('module_origin', '!=', 'official'), ('application', '=', True), ('category_id', 'not in', [13, 54, 71, 15, 94, 6, 10, 11, 20])]</field>
<field name="context">{}</field>
<field name="search_view_id" ref="shixun_module_search_view"/>
<field name="limit">50</field>
+6 -3
View File
@@ -325,7 +325,7 @@ class CourseChapter(models.Model):
], limit=1, order='id desc')
if attachment:
chapter.video_embed_html = (
f'<video controls style="width:100%;max-width:720px;" '
f'<video controls style="width:100%;" '
f'preload="metadata">'
f'<source src="/web/content/{attachment.id}" '
f'type="video/mp4">'
@@ -350,7 +350,10 @@ class CourseChapter(models.Model):
r.is_done_for_me = bool(student and student in r.completed_student_ids)
def action_open_study(self):
"""学生端:弹窗打开当前章节的学习页(带视频播放/附件下载)。"""
"""学生端:在当前窗口打开当前章节的学习页(带视频播放/附件下载)。
从弹窗改为全屏表单,避免视频播放区域过窄。
"""
self.ensure_one()
study_form = self.env.ref(
'college.yuthon_school_course_chapter_study_form')
@@ -361,7 +364,7 @@ class CourseChapter(models.Model):
'res_id': self.id,
'view_mode': 'form',
'views': [(study_form.id, 'form')],
'target': 'new',
'target': 'current',
}
def action_open_edit(self):
+17 -1
View File
@@ -77,11 +77,27 @@ class ExamQuestion(models.Model):
text = re.sub(r'\s+', ' ', text).strip()
q.question_text_short = (text[:40] + '…') if len(text) > 40 else text
@api.model
def default_get(self, fields_list):
"""新建题目时,单选/多选题默认带 A/B/C/D 四个选项行。"""
res = super().default_get(fields_list)
if 'option_ids' in fields_list and res.get('question_type') in (
'single_choice', 'multiple_choice'):
res['option_ids'] = self._default_option_lines()
return res
@staticmethod
def _default_option_lines():
return [(0, 0, {'label': lbl, 'sequence': seq})
for lbl, seq in (('A', 10), ('B', 20), ('C', 30), ('D', 40))]
@api.onchange('question_type')
def _onchange_question_type(self):
"""切换题型时,对判断题给出默认正确答案提示。"""
"""切换题型时:判断题给默认正确答案;单选/多选在无选项时补 A/B/C/D。"""
if self.question_type == 'true_false':
self.correct_answer = 'True'
if self.question_type in ('single_choice', 'multiple_choice') and not self.option_ids:
self.option_ids = self._default_option_lines()
def _get_correct_options(self):
"""返回本题的正确选项记录(仅选择题有效)。"""
+1 -1
View File
@@ -57,7 +57,7 @@
</field>
</record>
<!-- ===================== 章节:学生学习表单(弹窗播放视频/下载附件) ===================== -->
<!-- ===================== 章节:学生学习表单(全屏播放视频/下载附件) ===================== -->
<record id="yuthon_school_course_chapter_study_form" model="ir.ui.view">
<field name="name">yuthon.school.course.chapter.study.form</field>
<field name="model">yuthon.school.course.chapter</field>
+9 -5
View File
@@ -12,17 +12,21 @@
<menuitem id="menu_yuthon_product_intro"
name="产品介绍"
web_icon="college,static/src/img/product_intro.png"
sequence="0"
sequence="-10"
action="action_yuthon_product_intro"
groups="college.group_teacher,college.group_student,base.group_system"/>
<!-- ===================== 我的实训(顶级菜单,置顶) ===================== -->
<!-- ===================== 我的实训(顶级菜单,置顶;作为实训相关功能的容器) ===================== -->
<menuitem id="menu_yuthon_training"
name="我的实训"
web_icon="college,static/src/img/training.png"
sequence="1"
action="action_yuthon_school_training"
groups="college.group_teacher,college.group_student,base.group_system"/>
<menuitem id="menu_yuthon_training_overview"
name="实训概览"
parent="menu_yuthon_training"
action="action_yuthon_school_training"
sequence="10"/>
<!-- ===================== 我的课程(统一入口,按用户角色路由) ===================== -->
<!-- 老师 / 管理员 → action_yuthon_school_course_my(老师端我的课程) -->
@@ -383,8 +387,8 @@ else:
</record>
<menuitem id="menu_yuthon_about_question_import"
name="题库导入"
parent="menu_yuthon_about"
parent="menu_yuthon_exam_root"
action="action_yuthon_about_question_import"
sequence="50"
sequence="60"
groups="college.group_teacher,base.group_system"/>
</odoo>
+2
View File
@@ -62,6 +62,8 @@
<filter name="official" string="系统原生" domain="[('module_origin', '=', 'official')]"/>
<filter name="local" string="本地模块" domain="[('module_origin', '=', 'local')]"/>
</xpath>
<!-- 移除左侧搜索面板(应用/类别两列 facet),只保留搜索栏过滤器 -->
<xpath expr="//searchpanel" position="replace"/>
</field>
</record>
</odoo>