osbzr/gooderp_addons

View on GitHub
task/views/views.xml

Summary

Maintainability
Test Coverage
<openerp>
    <data>

        <record model="ir.ui.view" id="timesheet_form">
            <field name="name">今日</field>
            <field name="model">timesheet</field>
            <field name="arch" type="xml">
                <form string="今日">
                    <sheet>
                        <group>
                            <group>
                                <field name="user_id"/>
                                <field name="date"/>
                            </group>
                        </group>
                        <notebook>
                            <page name='task' string='待办事项'>
                                <field name="task_ids" domain="[('user_id', '=', uid)]">
                                    <tree string="计划">
                                        <field name="name"/>
                                        <field name="next_action"/>
                                        <field name="next_datetime"/>
                                        <field name="status"/>
                                        <field name="note" string="任务描述"/>
                                    </tree>
                                </field>
                            </page>
                            <page name='timeline' string='工作记录'>
                                <field name="timeline_ids" mode='kanban' context="{'form_view_ref': 'task.timeline_form'}">
                                    <kanban class="o_kanban_mobile">
                                        <field name='color'/>
                                        <templates>
                                            <t t-name="kanban-box">
                                                <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click_edit">
                                                    <div class="o_dropdown_kanban dropdown">
                                                        <a class="dropdown-toggle btn" data-toggle="dropdown" href="#" >
                                                            <span class="fa fa-bars fa-lg"/>
                                                        </a>
                                                        <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
                                                            <li><a type="delete">删除</a></li>
                                                            <li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
                                                        </ul>
                                                    </div>
                                                    <span t-attf-class="oe_kanban_content">
                                                        <field name="just_done"/>
                                                        <div groups='task.group_task_hours'>
                                                            <field name="hours"/>
                                                        </div>
                                                    </span>
                                                </div>
                                            </t>
                                        </templates>
                                    </kanban>
                                </field>
                            </page>
                        </notebook>
                    </sheet>
                </form>
            </field>
        </record>
        <record id="timesheet_kanban" model="ir.ui.view">
            <field name="name">timesheet kanban</field>
            <field name="model">timesheet</field>
            <field name="arch" type="xml">
                <kanban class="o_kanban_mobile">
                    <field name="date"/>
                    <field name="user_id"/>
                    <field name="color"/>
                    <templates>
                        <t t-name="kanban-box">
                            <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click">
                                <ul class="oe_kanban_colorpicker" data-field="color"/>
                                <div class="o_kanban_image">
                                    <t>
                                        <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)"/>
                                    </t>
                                    <p>
                                        <t t-esc="record.user_id.value"/>
                                    </p>
                                </div>
                                <p>
                                    <t t-esc="record.date.value"/>
                                    <!--<t t-esc="record.user_id.value"/>-->
                                </p>
                            </div>
                        </t>
                    </templates>
                </kanban>
            </field>
        </record>
        <record model="ir.ui.view" id="project_tree">
            <field name="name">项目列表</field>
            <field name="model">project</field>
            <field name="arch" type="xml">
                <tree>
                    <field name="name"/>
                    <field name="customer_id"/>
                    <field name="plan_hours" groups='task.group_task_hours'/>
                    <field name="hours" groups='task.group_task_hours'/>
                    <field name='active'  invisible='1'/>
                </tree>
            </field>
        </record>
        <record model="ir.ui.view" id="project_form">
            <field name="name">项目</field>
            <field name="model">project</field>
            <field name="arch" type="xml">
                <form string="项目">
                    <sheet>
                        <group>
                            <group>
                                <field name="name"/>
                                <field name="customer_id"
                                       domain="[('c_category_id', '!=', False)]"
                                       options="{'no_create': True, 'no_open': True}"/>
                                <field name="address" widget='url'/>
                            </group>
                            <group>
                                <field name="plan_hours" groups='task.group_task_hours,base.group_portal'/>
                                <field name="hours" groups='task.group_task_hours,base.group_portal'/>
                            </group>
                        </group>
                        <notebook>
                            <page name='task' string='任务'>
                                <field name="task_ids">
                                    <tree string="任务"  editable='BOTTOM'>
                                        <field name="sequence" widget="handle"/>
                                        <field name="name"/>
                                        <field name="user_id"/>
                                        <field name="next_action"/>
                                        <field name="next_datetime"/>
                                        <field name="plan_hours" groups='task.group_task_hours,base.group_portal' sum="计划工时"/>
                                        <field name="hours" groups='task.group_task_hours,base.group_portal' sum="实际工时"/>
                                    </tree>
                                </field>
                            </page>
                            <page name='project_invoice' string='发票行'>
                                <field name="invoice_ids">
                                    <tree string="发票"  editable='BOTTOM'>
                                        <field name="date_due"/>
                                        <field name="tax_rate"/>
                                        <field name="amount"/>
                                        <field name="tax_amount"/>
                                        <field name="invoice_id"/>
                                        <button name='make_invoice' type='object' string='生成发票' class='oe_highlight'
                                            attrs="{'invisible': [('invoice_id', '!=', False)]}"/>
                                    </tree>
                                </field>
                            </page>
                        </notebook>
                        <field name="note" placeholder='描述......'/>
                        <div class="oe_chatter">
                            <field name="message_follower_ids" widget="mail_followers"/>
                            <field name="message_ids" widget="mail_thread"/>
                        </div>
                    </sheet>
                </form>
            </field>
        </record>
        <record model="ir.ui.view" id="task_tree">
            <field name="name">任务列表</field>
            <field name="model">task</field>
            <field name="arch" type="xml">
                <tree>
                    <field name="sequence" widget="handle"/>
                    <field name="project_id"/>
                    <field name="name"/>
                    <field name="user_id"/>
                    <field name="next_action"/>
                    <field name="next_datetime"/>
                    <field name="status"/>
                    <field name="is_schedule"/>
                    <button name='assign_to_me' type='object' string='指派给我' class='oe_highlight'
                        attrs="{'invisible': [('user_id', '!=', False)]}"/>
                </tree>
            </field>
        </record>
        <record model="ir.ui.view" id="task_form">
            <field name="name">任务</field>
            <field name="model">task</field>
            <field name="arch" type="xml">
                <form string="任务">
                    <header>
                        <field name="status" widget="statusbar" clickable="True"/>
                    </header>
                    <sheet>
                        <group>
                            <group>
                                <field name="project_id" options="{'no_create': True}"/>
                                <field name="name"/>
                                <field name="plan_hours" groups='task.group_task_hours'/>
                                <field name="user_id"/>
                            </group>
                            <group>
                                <field name="next_action"/>
                                <field name="next_datetime"/>
                                <field name="hours" groups='task.group_task_hours'/>
                                <field name="tag_ids" widget="many2many_tags"/>
                            </group>
                        </group>
                        <field name="timeline_ids">
                            <tree string="进展" create='0' edit='0'>
                                <field name="create_uid" string='创建人'/>
                                <field name="create_date" string='创建时间'/>
                                <field name='hours' sum="全天合计" groups='task.group_task_hours'/>
                                <field name='just_done'/>
                            </tree>
                        </field>
                        <field name="note" placeholder='描述......'/>
                    </sheet>
                    <div class="oe_chatter">
                        <field name="message_follower_ids" widget="mail_followers"/>
                        <field name="message_ids" widget="mail_thread"/>
                    </div>
                </form>
            </field>
        </record>
        <record id="task_kanban" model="ir.ui.view">
            <field name="name">task kanban</field>
            <field name="model">task</field>
            <field name="arch" type="xml">
                <kanban class="o_kanban_mobile">
                    <field name="name"/>
                    <field name="user_id"/>
                    <field name="project_id"/>
                    <field name="next_action"/>
                    <field name="next_datetime"/>
                    <field name="hours"/>
                    <field name="plan_hours"/>
                    <field name="color"/>
                    <field name="priority"/>
                    <templates>
                        <t t-name="kanban-box">
                            <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click">
                                <ul class="oe_kanban_colorpicker" data-field="color"/>
                                <div class="o_kanban_image">
                                    <t>
                                        <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)"/>
                                    </t>
                                    <p>
                                        <t t-esc="record.user_id.value"/>
                                    </p>
                                </div>
                                <div class="oe_kanban_details">
                                    <p>
                                        <t t-esc="record.project_id.value"/>
                                        <t t-esc="record.name.value"/>
                                        <div groups='task.group_task_hours'>
                                            <t t-esc="record.hours.value"/>
                                            /
                                            <t t-esc="record.plan_hours.value"/>
                                        </div>
                                    </p>
                                    <p>
                                        <t t-esc="record.next_datetime.value"/>
                                    </p>
                                    <p>
                                        <t t-esc="record.next_action.value"/>
                                    </p>
                                    <field name="priority" widget="priority"/>
                                </div>
                            </div>
                        </t>
                    </templates>
                </kanban>
            </field>
        </record>
        <record id="task_search" model="ir.ui.view">
            <field name="name">task.search</field>
            <field name="model">task</field>
            <field name="arch" type="xml">
                <search string="Search Task">
                    <field name="name" filter_domain="['|',('project_id','ilike',self),('name', 'ilike', self)]"/>
                    <field name="user_id"/>
                    <field name="status"/>
                    <separator/>
                    <filter string="我的任务" name="assigned_to_me"
                            domain="[('user_id', '=', uid)]"
                            help="指派给我的任务"/>
                    <filter string="未指派的" name="unassigned"
                            domain="[('user_id','=', False)]" help="未指派的任务"/>
                    <separator/>
                    <group expand="0" string="分组">
                        <filter name="group_user_id" string="指派给" context="{'group_by':'user_id'}"/>
                        <filter name="project_id" string="项目" context="{'group_by':'project_id'}"/>
                        <filter name="group_status" string="阶段" context="{'group_by':'status'}"/>
                        <separator orientation="vertical" />
                        <filter string="创建月份" context="{'group_by':'create_date:month'}" name="month"/>
                    </group>
                </search>
            </field>
        </record>
        <record model="ir.ui.view" id="task_calendar">
            <field name="name">task.calendar</field>
            <field name="model">task</field>
            <field name="priority" eval="2"/>
            <field name="arch" type="xml">
                <calendar color="user_id" date_start="next_datetime" quick_add="False" string="Task Organization">
                    <field name="project_id"/>
                    <field name="name"/>
                    <field name="next_action"/>
                </calendar>
            </field>
        </record>
        <record model="ir.ui.view" id="timeline_tree">
            <field name="name">工作记录</field>
            <field name="model">timeline</field>
            <field name="arch" type="xml">
                <tree create='0' edit='0' default_order='create_date desc'>
                    <field name='task_id'/>
                    <field name='project_id'/>
                    <field name='just_done'/>
                    <field name='hours' sum="全天合计" groups='task.group_task_hours'/>
                    <field name='set_status'/>
                    <field name="create_uid" string='创建人'/>
                    <field name="create_date" string='创建时间'/>
                </tree>
            </field>
        </record>
        <record id="timeline_search" model="ir.ui.view">
            <field name="name">timeline.search</field>
            <field name="model">timeline</field>
            <field name="arch" type="xml">
                <search string="工作记录">
                    <field name="task_id"/>
                    <field name="project_id"/>
                    <field name="create_uid" string='创建人'/>
                    <separator/>
                    <filter string="今日" name="today_timeline"
                            domain="[('create_date', '&gt;=', time.strftime('%Y-%m-%d 00:00:00')),
                                ('create_date', '&lt;=', time.strftime('%Y-%m-%d 23:59:59'))]"
                            help="今日工作记录"/>
                    <filter name="group_create_uid" string="创建人" context="{'group_by':'create_uid'}"/>
                    <filter name="group_project_id" string="项目" context="{'group_by':'project_id'}"/>
                    <separator/>
                    <filter string="创建月份" context="{'group_by':'create_date:month'}" name="month"/>
                </search>
            </field>
        </record>
        <!-- timeline Form View -->
        <record id="timeline_form" model="ir.ui.view">
            <field name="name">timeline.form</field>
            <field name="model">timeline</field>
            <field name="arch" type="xml">
                <form string="timeline">
                    <sheet>
                        <group>
                            <field name="task_id" domain="[('user_id', 'in', [uid, False]),('status.state', '!=', 'done')]"/>
                            <field name="just_done"/>
                            <field name="hours" groups='task.group_task_hours' class="oe_inline"/>
                            <field name='next_action'/>
                            <field name='next_datetime'/>
                            <field name='set_status'/>
                            <field name='user_id'/>
                            <field name="create_date" string="创建时间" readonly='1'/>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>

        <record model="ir.ui.view" id="task_status_tree">
            <field name="name">任务阶段</field>
            <field name="model">task.status</field>
            <field name="arch" type="xml">
                <tree editable='bottom'>
                    <field name="sequence" widget="handle"/>
                    <field name="name"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>

        <!--门户用户单独的项目视图-->
        <record model="ir.ui.view" id="project_portal_tree">
            <field name="name">项目列表</field>
            <field name="model">project</field>
            <field name="arch" type="xml">
                <tree create='0'>
                    <field name="name"/>
                    <field name="customer_id"/>
                    <field name="plan_hours" groups='task.group_task_hours'/>
                    <field name="hours" groups='task.group_task_hours'/>
                </tree>
            </field>
        </record>
        <record model="ir.ui.view" id="project_portal_form">
            <field name="name">项目</field>
            <field name="model">project</field>
            <field name="arch" type="xml">
                <form string="项目" edit='0' create='0'>
                    <sheet>
                        <group>
                            <group>
                                <field name="name"/>
                                <field name="customer_id"/>
                                <field name="address" widget='url'/>
                            </group>
                            <group>
                                <field name="plan_hours" groups='task.group_task_hours,base.group_portal'/>
                                <field name="hours" groups='task.group_task_hours,base.group_portal'/>
                            </group>
                        </group>
                        <notebook>
                            <page name='task' string='任务'>
                                <field name="task_ids">
                                    <tree string="任务"  editable='BOTTOM'>
                                        <field name="sequence" widget="handle"/>
                                        <field name="name"/>
                                        <field name="user_id"/>
                                        <field name="next_action"/>
                                        <field name="next_datetime"/>
                                        <field name="plan_hours" groups='task.group_task_hours,base.group_portal' sum="计划工时"/>
                                        <field name="hours" groups='task.group_task_hours,base.group_portal' sum="实际工时"/>
                                    </tree>
                                </field>
                            </page>
                            <page name='project_invoice' string='发票行'>
                                <field name="invoice_ids">
                                    <tree string="发票"  editable='BOTTOM'>
                                        <field name="date_due"/>
                                        <field name="tax_rate"/>
                                        <field name="amount"/>
                                        <field name="tax_amount"/>
                                        <field name="invoice_id"/>
                                        <button name='make_invoice' type='object' string='生成发票' class='oe_highlight'
                                            attrs="{'invisible': [('invoice_id', '!=', False)]}"/>
                                    </tree>
                                </field>
                            </page>
                        </notebook>
                        <field name="note" placeholder='描述......'/>
                        <div class="oe_chatter">
                            <field name="message_follower_ids" widget="mail_followers"/>
                            <field name="message_ids" widget="mail_thread"/>
                        </div>
                    </sheet>
                </form>
            </field>
        </record>

        <!--action-->
        <record model="ir.actions.act_window" id="action_project">
            <field name="name">项目</field>
            <field name="res_model">project</field>
            <field name="view_mode">tree,form</field>
            <field name="context">{'type':'project'}</field>
            <field name="help" type="html">
                <p class="oe_view_nocontent_create">点击创建一个项目</p>
            </field>
        </record>
        <!--门户用户只能查看他关注的项目-->
        <record model="ir.actions.act_window" id="action_project_portal">
            <field name="name">项目</field>
            <field name="res_model">project</field>
            <field name="view_mode">tree,form</field>
            <field name="context">{'type':'project'}</field>
            <field name="view_ids" eval="[(5, 0, 0),
                (0, 0, {'view_mode': 'tree', 'view_id': ref('project_portal_tree')}),
                (0, 0, {'view_mode': 'form', 'view_id': ref('project_portal_form')})]"/>
            <field name="help" type="html">
                <p class="oe_view_nocontent_create">您还未关注一个项目</p>
            </field>
        </record>
        <record model="ir.actions.act_window" id="action_task">
            <field name="name">任务</field>
            <field name="res_model">task</field>
            <field name="view_mode">kanban,calendar,tree,form,search</field>
            <field name="context">{
                    'search_default_group_status': 1,
                }
            </field>
            <field name="help" type="html">
                <p class="oe_view_nocontent_create">点击创建一个任务</p>
            </field>
        </record>
        <record model="ir.actions.act_window" id="action_timeline">
            <field name="name">工作日志</field>
            <field name="res_model">timeline</field>
            <field name="view_mode">tree,pivot</field>
            <field name="context">{'search_default_today_timeline': 1}</field>
        </record>
        <record model="ir.actions.act_window" id="action_timesheet_today">
            <field name="name">今日工作日志</field>
            <field name="res_model">timesheet</field>
            <field name="view_mode">kanban,form</field>
            <field name="domain">[('date', '=', context_today().strftime('%Y-%m-%d')),('user_id', '=', uid)]</field>
            <field name="help" type="html">
                <p class="oe_view_nocontent_create">点击创建今日的工作日志</p>
            </field>
        </record>
        <record model="ir.actions.act_window" id="action_task_status">
            <field name="name">任务阶段</field>
            <field name="res_model">task.status</field>
            <field name="view_mode">tree</field>
            <field name="help" type="html">
                <p class="oe_view_nocontent_create">点击创建一个任务阶段</p>
            </field>
        </record>
        <menuitem name="任务" id="menu_task_root" web_icon="task,static/description/icon.png"
        groups='task.group_task'/>
        <menuitem name="今日" id="menu_timesheet" parent="menu_task_root"
        action="action_timesheet_today" sequence='1'/>
        <menuitem name="主数据" id="menu_task_data" parent="menu_task_root" sequence='5'/>
        <menuitem name="任务" id="menu_task" parent="menu_task_data"
        action="action_task" sequence='1'/>
        <menuitem name="项目" id="menu_project" parent="menu_task_data"
        action="action_project" sequence='5' groups='task.group_task'/>
        <menuitem name="报表" id="menu_task_report" parent="menu_task_root"
        groups='task.group_task_manager' sequence='10'/>
        <menuitem name="工作日志" id="menu_task_timesheet" parent="menu_task_report"
        action="action_timeline" sequence='1'/>
        <menuitem name="设置" id="menu_task_configuration" parent="menu_task_root"
        groups='task.group_task_manager' sequence='15'/>
        <menuitem name="任务阶段" id="menu_task_status" parent="menu_task_configuration"
        action="action_task_status" sequence='1'/>

        <!--门户用户的项目菜单-->
        <menuitem name="项目" id="menu_project_portal" web_icon="task,static/description/icon.png"
        action="action_project_portal" groups='base.group_portal'/>
    </data>
</openerp>