Files
gzth/yuthon_will_task/views/yuthon_will_task_views.xml
T
2025-12-18 11:11:00 +08:00

262 lines
14 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id='view_yuthon_will_task_tree' model='ir.ui.view'>
<field name='name'>yuthon.will.task.tree</field>
<field name='model'>yuthon.will.task</field>
<field name='arch' type='xml'>
<tree string='日程'
decoration-muted = "task_state == 'cancel'"
decoration-danger="priority == 'very_urgent'"
decoration-info="priority == 'urgent'"
decoration-success="priority == 'important'">
<field name='start_date' column_invisible="1"/>
<field name='task_time' />
<field name='name' required="1"/>
<field name='employee_ids' widget="many2many_tags" required="1" options="{'no_create': True}"/>
<field name="address"/>
<field name='remarks'/>
<field name='document_ids' widget="many2many_tags"/>
<field name='employee_ids2' widget="many2many_tags" domain="[('user_role_ids.name', 'in', ['司机'])]" options="{'no_create': True}"/>
<field name='task_time_ids' widget="many2many_tags" required="1"/>
<field name='priority'/>
<field name='task_state' readonly="1"/>
<field name='users_ids' widget="many2many_tags" column_invisible="1"/>
<field name='user_role_ids' widget="many2many_tags" column_invisible="1"/>
<field name="user_id" optional="hide"/>
<field name='creation_time' optional="hide"/>
<button name="button_add_comment" string="提醒" type="object" class="oe_highlight" invisible="task_state == 'cancel'"/>
<button name="button_add_comment_cancel" string="取消" type="object" class="oe_highlight" invisible="task_state == 'cancel'"/>
<button name="schedule_reminders" string="提醒详情" type="object" class="oe_highlight" groups="base.group_system"/>
</tree>
</field>
</record>
<record id='yuthon_will_task_search' model='ir.ui.view'>
<field name='name'>yuthon.will.task.search</field>
<field name='model'>yuthon.will.task</field>
<field name='arch' type='xml'>
<search string='日程'>
<field name="name"/>
<filter name="next_seven_days" string="周内事项" domain="[('start_date', '>=', context_today().strftime('%Y-%m-%d')),
('start_date', '&lt;=', (context_today() + relativedelta(days=7)).strftime('%Y-%m-%d'))]"/>
<filter name="next_thirty_days" string="月内事项" domain="[('start_date', '>=', context_today().strftime('%Y-%m-%d')),
('start_date', '&lt;=', (context_today() + relativedelta(days=30)).strftime('%Y-%m-%d'))]"/>
</search>
</field>
</record>
<record id="view_yuthon_will_task_form" model="ir.ui.view">
<field name="name">yuthon.will.task.form</field>
<field name="model">yuthon.will.task</field>
<field name="arch" type="xml">
<form string="日程">
<sheet>
<widget name="web_ribbon" title="重要不紧急" bg_color="text-bg-success" invisible="priority != 'important'"/>
<widget name="web_ribbon" title="紧急不重要" bg_color="text-bg-warning" invisible="priority != 'urgent'"/>
<widget name="web_ribbon" title="重要且紧急" bg_color="text-bg-danger" invisible="priority != 'very_urgent'"/>
<group col="3">
<group>
<field name="code" readonly="1"/>
</group>
<group>
<field name="is_this_company" string="本公司"/>
</group>
<group>
<field name="priority"/>
</group>
</group>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" required="1"/>
</h1>
</div>
<group col="2">
<group>
<label for="start_date"/>
<div class="d-inline-flex w-100">
<field name="start_date" string="日期:" class="me-2" style="max-width: 10rem !important;"/>时间
<field name="request_hour_from" string=" " class="ms-2" style="max-width: 5rem !important;"/>至
<field name="request_hour_to" string=" " class="ms-2" style="max-width: 5rem !important;"/>
</div>
</group>
<group>
<field name="task_time_ids" widget="many2many_tags"/>
</group>
</group>
<group>
<field name="user_id"/>
<field name="task_state" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="employee_ids" widget="many2many_tags" options="{'no_create': True}" domain = "[('company_id', '=', company_id), ('user_id.name', '!=', 'Administrator')] if is_this_company else []"/>
<field name="user_role_ids" widget="many2many_tags" invisible="1"/>
</group>
<group col="2">
<group>
<field name="address"/>
</group>
<group>
<field name="employee_ids2" widget="many2many_tags" domain="[('company_id', '=', company_id), ('user_role_ids.name', 'in', ['司机'])] if is_this_company else [('user_role_ids.name', 'in', ['司机'])]" options="{'no_create': True}"/>
</group>
</group>
<group>
<field name="remarks"/>
<field name="document_ids" widget="preview_many2many"/>
<field name="creation_time" invisible="1"/>
</group>
</sheet>
<!-- <div class="oe_chatter">-->
<!-- <field name="message_follower_ids" groups="base.group_user" options="{'post_refresh': 'recipients'}"/>-->
<!-- <field name="activity_ids"/>-->
<!-- <field name="message_ids"/>-->
<!-- </div>-->
</form>
</field>
</record>
<record id='view_yuthon_will_task_tree2' model='ir.ui.view'>
<field name='name'>yuthon.will.task.tree2</field>
<field name='model'>yuthon.will.task</field>
<field name='arch' type='xml'>
<tree string='日程'
decoration-muted = "task_state == 'cancel'"
decoration-danger="priority == 'very_urgent'"
decoration-info="priority == 'urgent'"
decoration-success="priority == 'important'" create="false" edit="false" js_class="custom_task_tree_button">
<field name='start_date' column_invisible="1"/>
<field name='task_time' />
<field name='name' required="1"/>
<field name='employee_ids' widget="many2many_tags" required="1" options="{'no_create': True}"/>
<field name="address"/>
<field name='remarks'/>
<field name='document_ids' widget="many2many_tags"/>
<field name='employee_ids2' widget="many2many_tags" domain="[('user_role_ids.name', 'in', ['司机'])]" options="{'no_create': True}"/>
<field name='task_time_ids' widget="many2many_tags" required="1"/>
<field name='priority'/>
<field name='task_state' readonly="1"/>
<field name='users_ids' widget="many2many_tags" column_invisible="1"/>
<field name='user_role_ids' widget="many2many_tags" column_invisible="1"/>
<field name="user_id" optional="hide"/>
<field name='creation_time' optional="hide"/>
<button name="button_add_comment" string="提醒" type="object" class="oe_highlight" invisible="task_state == 'cancel'"/>
<button name="button_add_comment_cancel" string="取消" type="object" class="oe_highlight" invisible="task_state == 'cancel'"/>
</tree>
</field>
</record>
<record id="view_yuthon_will_task_form2" model="ir.ui.view">
<field name="name">yuthon.will.task.message.form</field>
<field name="model">yuthon.will.task</field>
<field name="arch" type="xml">
<form string="日程" create="false">
<sheet>
<widget name="web_ribbon" title="重要不紧急" bg_color="text-bg-success"
invisible="priority != 'important'"/>
<widget name="web_ribbon" title="紧急不重要" bg_color="text-bg-warning"
invisible="priority != 'urgent'"/>
<widget name="web_ribbon" title="重要且紧急" bg_color="text-bg-danger"
invisible="priority != 'very_urgent'"/>
<group col="3">
<group>
<field name="code" readonly="1"/>
</group>
<group>
<field name="is_this_company" string="本公司"/>
</group>
<group>
<field name="priority"/>
</group>
</group>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" required="1"/>
</h1>
</div>
<group col="2">
<group>
<label for="start_date"/>
<div class="d-inline-flex w-100">
<field name="start_date" string="日期:" class="me-2"
style="max-width: 10rem !important;"/>时间
<field name="request_hour_from" string=" " class="ms-2"
style="max-width: 5rem !important;"/>至
<field name="request_hour_to" string=" " class="ms-2"
style="max-width: 5rem !important;"/>
</div>
</group>
<group>
<field name="task_time_ids" widget="many2many_tags"/>
</group>
</group>
<group>
<field name="user_id" domain="[('company_id', '=', company_id)]"/>
<field name="company_id" invisible="1"/>
<field name="employee_ids" widget="many2many_tags" options="{'no_create': True}"/>
<field name='users_ids' widget="many2many_tags" invisible="1"/>
<field name="user_role_ids" widget="many2many_tags" invisible="1"/>
</group>
<group col="2">
<group>
<field name="address"/>
</group>
<group>
<field name='employee_ids2' widget="many2many_tags" domain="[('user_role_ids.name', 'in', ['司机'])]" options="{'no_create': True}"/>
</group>
</group>
<group>
<field name="remarks"/>
<field name="creation_time" invisible="1"/>
</group>
</sheet>
<!-- <div class="oe_chatter">-->
<!-- <field name="message_follower_ids" groups="base.group_user"/>-->
<!-- <field name="activity_ids"/>-->
<!-- <field name="message_ids"/>-->
<!-- </div>-->
</form>
</field>
</record>
<record id="view_calendar_event_calendar" model="ir.ui.view">
<field name="name">yuthon.will.task.calendar</field>
<field name="model">yuthon.will.task</field>
<field name="priority" eval="2"/>
<field name="arch" type="xml">
<calendar string="日程"
date_start="start_date"
event_open_popup="true"
event_limit="5"
quick_create="false"
quick_create_view_id="%(yuthon_will_task.view_yuthon_will_task_form)d"
color="employee_ids">
<field name="priority"/>
</calendar>
</field>
</record>
<record id='view_yuthon_will_task_action' model='ir.actions.act_window'>
<field name='name'>我的日程</field>
<field name='res_model'>yuthon.will.task</field>
<field name='view_mode'>tree,calendar,form</field>
<field name='domain'>[('users_ids', 'in', [uid])]</field>
<field name="context">{'search_default_next_seven_days': 1}</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_will_task.view_yuthon_will_task_tree2')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_will_task.view_yuthon_will_task_form2')})]"/>
</record>
<record id='view_yuthon_will_task_action2' model='ir.actions.act_window'>
<field name='name'>日程管理</field>
<field name='res_model'>yuthon.will.task</field>
<field name='view_mode'>tree,calendar,form</field>
<field name="context">{'search_default_next_seven_days': 1}</field>
</record>
<record id='view_yuthon_will_task_action21' model='ir.actions.act_window'>
<field name='name'>领导日程</field>
<field name='res_model'>yuthon.will.task</field>
<field name='view_mode'>tree,calendar,form</field>
<field name="context">{'search_default_next_seven_days': 1}</field>
</record>
<record id='view_yuthon_will_task_action4' model='ir.actions.act_window'>
<field name='name'>领导日程</field>
<field name='res_model'>yuthon.will.task</field>
<field name='view_mode'>tree,calendar,form</field>
<field name='domain'>[('user_role_ids.name', 'in', ['董事长', '分管领导', '总经理', '部门副经理', '副总经理'])]</field>
<field name="context">{'search_default_next_seven_days': 1}</field>
</record>
</odoo>