osbzr/gooderp_addons

View on GitHub
staff_hire/views/hire_view.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0"?>
<odoo>
    <data>
    <!-- Applicants -->
    <record model="ir.ui.view" id="hire_applicant_tree_view">
        <field name="name">hire.applicant.tree</field>
        <field name="model">hire.applicant</field>
        <field name="arch" type="xml">
            <tree string="Applicants" decoration-bf="message_needaction==True">
                <field name="message_needaction" invisible="1"/>
                <field name="last_stage_id" invisible="1"/>
                <field name="create_date" string="创建时间"/>
                <field name="date_last_stage_update" invisible="1"/>
                <field name="partner_name"/>
                <field name="email_from"/>
                <field name="partner_mobile"/>
                <field name="job_id"/>
                <field name="stage_id"/>
                <field name="title_action" invisible="context.get('invisible_next_action', True)"/>
                <field name="date_action" invisible="context.get('invisible_next_date', True)"/>
                <field name="source_id"/>
                <field name="priority"/>
                <field name="degree_id" invisible="1"/>
                <field name="date_available" invisible="1"/>
                <field name="department_id" invisible="context.get('invisible_department', True)"/>
                <field name="user_id"/>
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="hire_applicant_form_view">
        <field name="name">hire.applicant.form</field>
        <field name="model">hire.applicant</field>
        <field name="arch" type="xml">
          <form string="Jobs - Recruitment Form">
            <header>
                <button string="创建员工" name="create_employee_from_applicant" type="object"
                        class="oe_highlight" attrs="{'invisible': ['|',('staff_id', '!=', False),('active', '=', False)]}"/>
                <button string="拒绝" name="archive_applicant" type="object" attrs="{'invisible': [('active', '=', False)]}"/>
                <button string="重新打开招聘" name="reset_applicant" type="object" attrs="{'invisible': [('active', '=', True)]}"/>
                <field name="stage_id" widget="statusbar" clickable="True" options="{'fold_field': 'fold'}" attrs="{'invisible': [('active', '=', False),('staff_id', '=', False)]}"/>
            </header>
            <sheet>
                <div class="oe_button_box" name="button_box">
                    <button name="action_makeMeeting" class="oe_stat_button" icon="fa-calendar" type="object"
                         help="Schedule interview with this applicant">
                        <div class="o_form_field o_stat_info">
                            <span class="o_stat_text">会议</span>
                         </div>
                    </button>
                    <button name="action_get_attachment_tree_view"
                        class="oe_stat_button"
                        icon="fa-book"
                        type="object">
                        <field name="attachment_number" widget="statinfo" string="简历"/>
                    </button>
                    <button name="action_get_created_employee"
                        class="oe_stat_button"
                        icon="fa-user"
                        type="object"
                        attrs="{'invisible': [('staff_id', '=', False)]}">
                        <field name="staff_name" widget="statinfo" string="员工"/>
                    </button>
                    <button name="toggle_active" type="object"
                            class="oe_stat_button" icon="fa-archive"
                            attrs="{'invisible': [('active', '=', True)]}">
                        <field name="active" widget="boolean_button"
                            options='{"terminology": "archive"}'/>
                    </button>
                </div>
                <div class="oe_title">
                    <h2 class="o_row">
                        <div>
                            <label for="partner_name" class="oe_edit_only"/>
                            <field name="partner_name"/>
                        </div>
                        <div>
                            <label for="categ_ids" class="oe_edit_only"/>
                            <field name="categ_ids" widget="many2many_tags" options="{'no_create_edit': True}"/>
                        </div>
                    </h2>
                </div>
                <group>
                    <group>
                        <field name="email_from" widget="email"/>
                        <field name="partner_mobile"/>
                        <field name="degree_id" placeholder="学历"/>
                    </group>
                    <group>
                        <field name="user_id"/>
                        <label for="title_action"/>
                        <div>
                            <field name="date_action"/>
                            <field name="title_action" class="oe_inline" placeholder="例如:电话面试"/>
                        </div>
                        <field name="priority" widget="priority"/>
                        <field name="source_id"/>
                        <field name="reference"/>
                    </group>
                    <group string="职位">
                        <field name="job_id"/>
                        <field name="department_id"/>
                        <field name="company_id" groups="base.group_multi_company" options='{"no_open":True}' />
                    </group>
                    <group string="合约">
                        <label for="salary_expected"/>
                        <div>
                            <field name="salary_expected" class="oe_inline"/>
                            <span class="oe_inline" attrs="{'invisible':[('salary_expected_extra','=',False)]}"> + </span>
                            <field name="salary_expected_extra" class="oe_inline" placeholder="额外奖金或补贴..."/>
                        </div>
                        <label for="salary_proposed"/>
                        <div>
                            <field name="salary_proposed" class="oe_inline"/>
                            <span class="oe_inline" attrs="{'invisible':[('salary_proposed_extra','=',False)]}"> + </span>
                            <field name="salary_proposed_extra" class="oe_inline" placeholder="额外奖金或补贴..."/>
                        </div>
                        <field name="date_available"/>
                        <field name="staff_id" invisible="1"/>
                    </group>
                </group>
                <separator string="总结"/>
                <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 model="ir.ui.view" id="hire_applicant_pivot_view">
        <field name="name">hire.applicant.pivot</field>
        <field name="model">hire.applicant</field>
        <field name="arch" type="xml">
              <pivot string="Cases By Stage and Estimates">
                <field name="job_id" type="row"/>
                <field name="stage_id" type="col"/>
            </pivot>
        </field>
    </record>

    <record model="ir.ui.view" id="hire_applicant_graph_view">
        <field name="name">hire.applicant.graph</field>
        <field name="model">hire.applicant</field>
        <field name="arch" type="xml">
              <graph string="Cases By Stage and Estimates" type="bar" orientation="vertical" stacked="True">
                <field name="stage_id" type="col"/>
            </graph>
        </field>
    </record>

    <record id="hire_applicant_filter_view" model="ir.ui.view">
        <field name="name">hire.applicant.search</field>
        <field name="model">hire.applicant</field>
        <field name="arch" type="xml">
            <search string="Search Applicants">
                <field name="partner_name" filter_domain="['|',('partner_name','ilike',self),('email_from','ilike',self)]" string="应聘者"/>
                <filter string="我的" domain="[('user_id', '=', uid)]"/>
                <filter string="未指派" domain="[('user_id', '=', False)]"/>
                <separator/>
                <filter string="下步计划日期" context="{'invisible_next_action':False, 'invisible_next_date':False}"
                    domain="[('date_action','&lt;&gt;',False)]" help="Filter and view on next actions and date"/>
                <separator/>
                <filter string="未读消息" name="message_needaction" domain="[('message_needaction','=',True)]"/>
                <filter string="已归档" name="inactive" domain="[('active','=',False)]"/>
                <field name="job_id"/>
                <field name="department_id"/>
                <field name="user_id"/>
                <field name="stage_id" domain="[]"/>
                <separator/>
                <field name="categ_ids"/>
                <separator/>
                <group expand="0" string="Group By">
                    <filter string="负责人" domain="[]"  context="{'group_by':'user_id'}"/>
                    <filter string="职位" domain="[]" context="{'group_by':'job_id'}"/>
                    <filter string="学历" domain="[]" context="{'group_by':'degree_id'}"/>
                    <filter string="阶段" domain="[]" context="{'group_by':'stage_id'}"/>
                    <filter string="创建日期" context="{'group_by':'create_date'}"/>
                    <filter string="最终阶段更新日期" context="{'group_by':'date_last_stage_update'}"/>
                </group>
           </search>
        </field>
    </record>

    <!-- CRM Lead Calendar View -->
    <record model="ir.ui.view" id="hire_applicant_calendar_view">
        <field name="name">hire.applicant.calendar</field>
        <field name="model">hire.applicant</field>
        <field name="priority" eval="2"/>
        <field name="arch" type="xml">
            <calendar string="Applicants"
                date_start="date_action" color="user_id" quick_add="False">
                <field name="partner_name"/>
                <field name="title_action"/>
            </calendar>
        </field>
    </record>

    <!-- Hr Applicant Kanban View -->
    <record model="ir.ui.view" id="hire_applicant_kanban_view">
        <field name="name">hire.applicant.kanban</field>
        <field name="model">hire.applicant</field>
        <field name="arch" type="xml">
            <kanban default_group_by="stage_id" class="o_kanban_applicant">
                <field name="stage_id" options='{"group_by_tooltip": {"requirements": "Requirements"}}'/>
                <field name="color"/>
                <field name="user_id"/>
                <field name="user_email"/>
                <field name="partner_name"/>
                <field name="degree_id"/>
                <field name="job_id"/>
                <field name="department_id"/>
                <field name="categ_ids"/>
                <templates>
                    <t t-name="kanban-tooltip">
                        <ul class="oe_kanban_tooltip">
                            <li t-if="record.degree_id.raw_value"><b>学历:</b> <field name="degree_id"/></li>
                            <li t-if="record.department_id.raw_value"><b>部门:</b> <field name="department_id"/></li>
                        </ul>
                    </t>
                    <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 oe_applicant_kanban oe_semantic_html_override">
                            <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">
                                    <t t-if="widget.deletable"><li><a type="delete">Delete</a></li></t>
                                    <li><a name="action_makeMeeting" type="object">安排面试</a></li>
                                    <li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
                                </ul>
                            </div>
                            <div class="oe_kanban_content" tooltip="kanban-tooltip">
                                    <field name="categ_ids"/>
                                    <t t-if="record.partner_name.raw_value"><b><field name="partner_name"/></b><br/></t>
                                    <field name="job_id"/><br/>
                                    <t t-if="record.partner_mobile.raw_value">手机: <field name="partner_mobile"/><br/></t>
                                    <t t-if="record.date_action.raw_value and record.date_action.raw_value lt (new Date())" t-set="red">oe_kanban_text_red</t>
                                    <span t-attf-class="#{red || ''}"><field name="date_action"/></span>
                                        <t t-if="record.date_action.raw_value"> : </t>
                                        <field name="title_action"/>
                                <div class="oe_kanban_bottom_right">
                                    <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar pull-right"/>
                                    <div class="pull-left" groups="base.group_user">
                                        <field name="priority" widget="priority"/>
                                    </div>
                                </div>
                                <div class="oe_kanban_bottom_left oe_margin_top_4">
                                    <a t-if="record.attachment_number" name="action_get_attachment_tree_view" type="object"> <field name="attachment_number"/> 简历</a>
                                </div>
                                <div class="oe_kanban_footer_left oe_margin_top_4">
                                </div>
                            </div>
                            <div class="oe_clear"></div>
                        </div>
                    </t>
                </templates>
            </kanban>
        </field>
    </record>

    <record model="ir.actions.act_window" id="action_staff_job_applications">
        <field name="name">招聘</field>
        <field name="res_model">hire.applicant</field>
        <field name="view_mode">kanban,tree,form,graph,calendar,pivot</field>
        <field name="help" type="html">
              <p>
                Odoo helps you track applicants in the recruitment
                process and follow up all operations: meetings, interviews, etc.
              </p><p>
                Applicants and their attached CV are created automatically when an email is sent.
                If you install the document management modules, all resumes are indexed automatically,
                so that you can easily search through their content.
              </p>
         </field>
    </record>

    <!-- 工作职位form视图右上角员工按钮 -->
    <record model="ir.actions.act_window" id="action_staff_job_no_employee">
        <field name="name">员工</field>
        <field name="res_model">staff</field>
        <field name="view_mode">kanban,tree,form</field>
        <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to add a new employee.
              </p><p>
                With just a quick glance on the Odoo employee screen, you
                can easily find all the information you need for each person;
                contact data, job position, date_available, etc.
              </p>
            </field>
    </record>

    <record id="staff_job_survey" model="ir.ui.view">
        <field name="name">staff.job.form1</field>
        <field name="model">staff.job</field>
        <field name="inherit_id" ref="staff.view_staff_job_form"/>
        <field name="arch" type="xml">
            <sheet position="before">
                <header>
                    <button name="set_open" string="启动招聘" states="close" type="object" class="oe_highlight" groups="base.group_user"/>
                    <button name="set_close" string="结束招聘" states="open" type="object" groups="base.group_user"/>
                    <field name="state" widget="statusbar" statusbar_visible="open,close"/>
                </header>
            </sheet>
            <group name="staff_data" position="inside">
                <group>
                    <field name="address_id" context="{'show_address': 1}"  options="{'always_reload': True}"/>
                </group>
            </group>
            <xpath expr="//field[@name='department_id']" position="after">
                <field name="no_of_recruitment"/>
                <field name="user_id"/>
            </xpath>
            <div name="button_box" position="inside">
                <button class="oe_stat_button"
                    icon="fa-file-o"
                    name="%(action_staff_job_applications)d"
                    context="{'default_user_id': user_id}"
                    type="action">
                    <field name="application_count" widget="statinfo" string="招聘"/>
                </button>
                <button class="oe_stat_button"
                    icon="fa-users"
                    name="%(action_staff_job_no_employee)d"
                    type="action">
                    <field name="no_of_employee" widget="statinfo" string="员工"/>
                </button>
                <button class="oe_stat_button"
                    icon="fa-book"
                    name="action_get_attachment_tree_view"
                    type="object">
                    <field name="documents_count" widget="statinfo" string="简历"/>
                </button>
            </div>
        </field>
    </record>

    <record model="ir.actions.act_window" id="action_hire_applicant">
        <field name="name">招聘</field>
        <field name="res_model">hire.applicant</field>
        <field name="view_mode">kanban,tree,form,pivot,graph,calendar</field>
        <field name="view_id" eval="False"/>
        <field name="search_view_id" ref="hire_applicant_filter_view"/>
        <field name="context">{}</field>
        <field name="help" type="html">
          <p>
            Odoo helps you track applicants in the recruitment
            process and follow up all operations: meetings, interviews, etc.
          </p><p>
            Applicants and their attached CV are created automatically when an email is sent.
            If you install the document management modules, all resumes are indexed automatically,
            so that you can easily search through their content.
          </p>
        </field>
    </record>

    <record model="ir.actions.act_window.view" id="action_hr_sec_kanban_view_act_job">
        <field name="sequence" eval="0"/>
        <field name="view_mode">kanban</field>
        <field name="view_id" ref="hire_applicant_kanban_view"/>
        <field name="act_window_id" ref="action_hire_applicant"/>
    </record>

    <record model="ir.actions.act_window.view" id="action_hr_sec_tree_view_act_job">
        <field name="sequence" eval="1"/>
        <field name="view_mode">tree</field>
        <field name="view_id" ref="hire_applicant_tree_view"/>
        <field name="act_window_id" ref="action_hire_applicant"/>
    </record>

    <record model="ir.actions.act_window.view" id="action_hr_sec_form_view_act_job">
        <field name="sequence" eval="3"/>
        <field name="view_mode">form</field>
        <field name="view_id" ref="hire_applicant_form_view"/>
        <field name="act_window_id" ref="action_hire_applicant"/>
    </record>

    <record model="ir.actions.act_window.view" id="action_hr_sec_graph_view_act_job">
        <field name="sequence" eval="4"/>
        <field name="view_mode">graph</field>
        <field name="view_id" ref="hire_applicant_graph_view"/>
        <field name="act_window_id" ref="action_hire_applicant"/>
    </record>

    <menuitem
        name="招聘"
        parent="staff.menu_staff_main"
        id="menu_action_hire_applicant" action="action_hire_applicant" sequence="15"/>

    <!-- Resume and Letters -->
    <record id="ir_attachment_view_search_inherit_staff_hire" model="ir.ui.view">
        <field name="name">ir.attachment.search.inherit.staff.hire</field>
        <field name="model">ir.attachment</field>
        <field name="mode">primary</field>
        <field name="inherit_id" ref="base.view_attachment_search"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='create_date']" position="after">
                <field name="index_content" string="Content"/>
            </xpath>
            <xpath expr="//filter[@name='my_documents_filter']" position="attributes">
                <attribute name='invisible'>1</attribute>
            </xpath>
            <xpath expr="//filter[@name='url_filter']" position="attributes">
                <attribute name='invisible'>1</attribute>
            </xpath>
            <xpath expr="//filter[@name='binary_filter']" position="attributes">
                <attribute name='invisible'>1</attribute>
            </xpath>
        </field>
    </record>

    <!-- Stage Tree View -->
    <record model="ir.ui.view" id="staff_hire_stage_tree">
        <field name="name">staff.hire.stage.tree</field>
        <field name="model">staff.hire.stage</field>
        <field name="arch" type="xml">
            <tree string="Stages">
                <field name="sequence" widget="handle"/>
                <field name="name"/>
                <field name="fold"/>
            </tree>
        </field>
    </record>

    <!-- Stage Form View -->
    <record model="ir.ui.view" id="staff_hire_stage_form">
        <field name="name">staff.hire.stage.form</field>
        <field name="model">staff.hire.stage</field>
        <field name="arch" type="xml">
            <form string="Stage">
                <group name="group_stage_def">
                    <group>
                        <field name="name"/>
                        <field name="sequence" groups="base.group_no_one"/>
                        <field name="job_id"/>
                    </group>
                    <group>
                         <field name="fold"/>
                        <field name="template_id" domain= "[('model_id.model', '=', 'hire.applicant')]"/>
                    </group>
                </group>
                <field name="requirements" placeholder="要求"/>
            </form>
        </field>
    </record>

    <!-- Stage Action -->
    <record id="staff_hire_stage_act" model="ir.actions.act_window">
        <field name="name">阶段</field>
        <field name="res_model">staff.hire.stage</field>
        <field name="view_type">form</field>
        <field name="view_id" ref="staff_hire_stage_tree"/>
        <field name="help" type="html">
          <p class="oe_view_nocontent_create">
            Click to add a new stage in the recruitment process.
          </p><p>
            Don't forget to specify the department if your recruitment process
            is different according to the job position.
          </p>
        </field>
    </record>

    <menuitem
        id="menu_staff_hire_stage"
        name="阶段"
        parent="staff.menu_staff_configuration"
        action="staff_hire_stage_act"
        sequence="10"/>

    </data>
</odoo>