Files
shcool/college/views/course_views.xml
T
2026-08-05 19:29:35 +08:00

212 lines
11 KiB
XML

<odoo>
<!-- ===================== 课程:列表 ===================== -->
<record id="yuthon_school_course_view_list" model="ir.ui.view">
<field name="name">yuthon.school.course.list</field>
<field name="model">yuthon.school.course</field>
<field name="arch" type="xml">
<list string="课程">
<field name="name"/>
<field name="code"/>
<field name="college"/>
<field name="semester"/>
<field name="course_type"/>
<field name="hours"/>
<field name="teacher_id" column_invisible="1"/>
<field name="student_count"/>
<field name="chapter_count"/>
<field name="state"/>
</list>
</field>
</record>
<!-- ===================== 课程:表单 ===================== -->
<record id="yuthon_school_course_view_form" model="ir.ui.view">
<field name="name">yuthon.school.course.form</field>
<field name="model">yuthon.school.course</field>
<field name="arch" type="xml">
<form>
<header>
<button name="action_publish" type="object" string="发布"
class="btn-primary"
invisible="[('state', '!=', 'draft')]"/>
<button name="action_archive" type="object" string="归档"
invisible="[('state', '!=', 'published')]"/>
<button name="action_to_draft" type="object" string="转为草稿"
invisible="[('state', '=', 'draft')]"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,published,archived"/>
</header>
<sheet>
<group>
<group>
<field name="name"/>
<field name="code"/>
<field name="teacher_id" invisible="1"/>
<field name="college"/>
<field name="semester"/>
</group>
<group>
<field name="course_type"/>
<field name="hours"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="is_public"/>
</group>
</group>
<notebook>
<page string="课程内容">
<group>
<field name="syllabus" string="课程大纲"/>
</group>
<separator string="课程章节(每章含视频与资料)"/>
<field name="chapter_ids">
<list editable="top">
<field name="name"/>
<field name="video_filename_display" string="视频"/>
<button name="action_open_edit" type="object"
string="编辑章节" icon="fa-pencil"
class="btn-link"
groups="college.group_teacher,base.group_system"/>
</list>
<form>
<group>
<field name="name"/>
<field name="sequence" invisible="1"/>
</group>
<group>
<field name="description" widget="html"
string="章节说明"/>
</group>
<group>
<field name="video_file" filename="video_filename"/>
<field name="video_filename" invisible="1"/>
</group>
<field name="attachment_ids" string="章节资料">
<list editable="bottom">
<field name="name" string="文件名"/>
<field name="file" filename="name"/>
</list>
</field>
</form>
</field>
</page>
<page string="选课学员" groups="college.group_teacher,base.group_system">
<field name="student_ids" widget="many2many"
context="{'default_name': name}"/>
</page>
<page string="课程介绍">
<field name="introduction"/>
</page>
<page string="课程目标">
<field name="objectives"/>
</page>
<page string="课程特色">
<field name="features"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<!-- ===================== 课程:搜索 ===================== -->
<record id="yuthon_school_course_view_search" model="ir.ui.view">
<field name="name">yuthon.school.course.search</field>
<field name="model">yuthon.school.course</field>
<field name="arch" type="xml">
<search>
<field name="name" string="课程名称"
filter_domain="[('name', 'ilike', self)]"/>
<field name="college"/>
<field name="semester"/>
<filter name="theory" string="理论"
domain="[('course_type', '=', 'theory')]"/>
<filter name="practice" string="实践"
domain="[('course_type', '=', 'practice')]"/>
<filter name="my_courses" string="我的课程"
domain="[('teacher_id', '=', uid)]"/>
<filter name="published" string="已发布"
domain="[('state', '=', 'published')]"/>
<group expand="0" string="分组">
<filter name="group_college" string="学院"
context="{'group_by': 'college'}"/>
<filter name="group_semester" string="学期"
context="{'group_by': 'semester'}"/>
<filter name="group_state" string="状态"
context="{'group_by': 'state'}"/>
</group>
</search>
</field>
</record>
<!-- ===================== 课程:看板 ===================== -->
<record id="yuthon_school_course_view_kanban" model="ir.ui.view">
<field name="name">yuthon.school.course.kanban</field>
<field name="model">yuthon.school.course</field>
<field name="arch" type="xml">
<kanban default_group_by="state"
default_order="semester,college,name"
class="o_kanban_mobile">
<field name="name"/>
<field name="college"/>
<field name="semester"/>
<field name="course_type"/>
<field name="teacher_id"/>
<field name="student_count"/>
<field name="chapter_count"/>
<field name="state"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click o_kanban_record_has_image_fill"
style="padding:12px 14px;">
<div class="o_kanban_record_top mb-2">
<div class="o_kanban_record_headings">
<strong><field name="name"/></strong>
</div>
<span class="badge bg-primary text-white"
style="font-size:11px;">
<field name="course_type"/>
</span>
</div>
<div class="text-muted small mb-1">
<field name="college"/> · <field name="semester"/>
</div>
<div class="small mb-1">
任课教师:<field name="teacher_id"/>
</div>
<div class="small mb-1">
课时:<field name="hours"/> · 选课学员:<field name="student_count"/> 人
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<!-- ===================== 课程:动作(后置定义,显式绑定老师视图,避免学生视图靠优先级抢占) ===================== -->
<record id="action_yuthon_school_course_my" model="ir.actions.act_window">
<field name="name">我的课程</field>
<field name="res_model">yuthon.school.course</field>
<field name="view_mode">kanban,list,form</field>
<field name="domain">[('teacher_id', '=', uid)]</field>
<field name="context">{'search_default_my_courses': 1}</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'kanban', 'view_id': ref('yuthon_school_course_view_kanban')}),
(0, 0, {'view_mode': 'list', 'view_id': ref('yuthon_school_course_view_list')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_school_course_view_form')})]"/>
<field name="target">current</field>
</record>
<record id="action_yuthon_school_course_all" model="ir.actions.act_window">
<field name="name">全部课程</field>
<field name="res_model">yuthon.school.course</field>
<field name="view_mode">kanban,list,form</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'kanban', 'view_id': ref('yuthon_school_course_view_kanban')}),
(0, 0, {'view_mode': 'list', 'view_id': ref('yuthon_school_course_view_list')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_school_course_view_form')})]"/>
<field name="target">current</field>
</record>
</odoo>