完善教育 #61

Merged
qitangbo merged 1 commits from qtb into master 2026-10-13 18:03:07 +08:00
4 changed files with 14 additions and 5 deletions
-1
View File
@@ -64,7 +64,6 @@
'college/static/src/js/hide_activity_menu.js',
'college/static/src/js/portal_indicator.js',
'college/static/src/xml/portal_indicator.xml',
'college/static/src/xml/sidenav_tooltip.xml',
],
'web.assets_web_dark': [
'college/static/src/scss/college_theme_dark.scss',
+1
View File
@@ -270,6 +270,7 @@
</div>
</div>
<!-- 主体内容 -->
<div style="padding:36px 28px;background:#fff;color:#334155;">
<h2 style="color:#0f172a;font-size:20px;margin:0 0 16px;">关于我们</h2>
+10 -3
View File
@@ -107,11 +107,18 @@ class ExamQuestion(models.Model):
@api.onchange('question_type')
def _onchange_question_type(self):
"""切换题型时:判断题给默认正确答案;单选/多选在无选项时补 A/B/C/D。"""
"""切换题型时:判断题给默认正确答案;单选/多选在无选项时补 A/B/C/D;
非选择题清掉默认带出的空选项,否则会被一并提交,触发
ExamQuestionOption.content 的 required 校验。"""
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()
if self.question_type in ('single_choice', 'multiple_choice'):
if not self.option_ids:
self.option_ids = self._default_option_lines()
else:
# 切到填空/判断/简答:清掉默认带出的空选项,避免服务端必填校验报错
# 用 (5,0,0) 完整写法,(5,) 简写在 Odoo 18 + Py3.13 下会触发访问冲突
self.option_ids = [(5, 0, 0)]
@api.depends('correct_answer')
def _compute_correct_answer_tf(self):
@@ -27,7 +27,9 @@ class StudentOrganization(models.Model):
parent_path = fields.Char(index=True)
# 完整名称(显示层级)
full_name = fields.Char(string='完整名称', compute='_compute_full_name', store=True)
# recursive=True: full_name 依赖 parent_id.full_name(自引用层级),
# 必须声明,否则 Odoo 18 报 UserWarning 且父级改名时子级不会重算
full_name = fields.Char(string='完整名称', compute='_compute_full_name', store=True, recursive=True)
# 负责人信息(学院用)
manager_id = fields.Many2one('res.users', string='负责人')