odoo/addons/hr_contract/data/hr_contract_data.xml

113 lines
5.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!-- Contract Types -->
<record id="hr_contract_type_emp" model="hr.contract.type">
<field name="name">Employee</field>
<field name="sequence">5</field>
</record>
<record id="hr_contract_type_wrkr" model="hr.contract.type">
<field name="name">Worker</field>
<field name="sequence">10</field>
</record>
<record id="hr_contract_type_sub" model="hr.contract.type">
<field name="name">Subcontractor</field>
<field name="sequence">15</field>
</record>
<!-- Contract-related subtypes for messaging / Chatter -->
<record id="mt_contract_pending" model="mail.message.subtype">
<field name="name">To Renew</field>
<field name="res_model">hr.contract</field>
<field name="default" eval="True"/>
<field name="description">Contract about to expire</field>
</record>
<record id="mt_contract_close" model="mail.message.subtype">
<field name="name">Expired</field>
<field name="res_model">hr.contract</field>
<field name="default" eval="False"/>
<field name="description">Contract expired</field>
</record>
<!-- Department-related (parent) subtypes for messaging / Chatter -->
<record id="mt_department_contract_pending" model="mail.message.subtype">
<field name="name">Contract to Renew</field>
<field name="res_model">hr.department</field>
<field name="default" eval="False"/>
<field name="parent_id" eval="ref('mt_contract_pending')"/>
<field name="relation_field">department_id</field>
<field name="description">Contract about to expire</field>
</record>
<!-- base action rule about "Expiring Soon" contracts -->
<record id="contract_open" model="ir.filters">
<field name="name">Open Contracts</field>
<field name="model_id">hr.contract</field>
<field name="domain">[('state', '=', 'open')]</field>
<field name="user_id" eval="False"/>
</record>
<record id="contract_set_as_pending" model="ir.actions.server">
<field name="name">HR Contract: set as pending</field>
<field name="model_id" ref="model_hr_contract"/>
<field name="condition">True</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="code">record.set_as_pending()</field>
</record>
<record id="rule_contract_1_set_as_pending" model="base.action.rule">
<field name="name">HR Contract: check for pending</field>
<field name="model_id" ref="model_hr_contract"/>
<field name="sequence">50</field>
<field name="kind">on_time</field>
<field name="filter_id" ref="contract_open"/>
<field name="trg_date_id" ref="hr_contract.field_hr_contract_date_end"/>
<field name="trg_date_range">-7</field>
<field name="trg_date_range_type">day</field>
<field name="server_action_ids" eval="[(6, 0, [ref('contract_set_as_pending')])]"/>
</record>
<record id="rule_contract_2_set_as_pending" model="base.action.rule">
<field name="name">HR Contract: check for pending</field>
<field name="model_id" ref="model_hr_contract"/>
<field name="sequence">51</field>
<field name="kind">on_time</field>
<field name="filter_id" ref="contract_open"/>
<field name="trg_date_id" ref="hr_contract.field_hr_contract_visa_expire"/>
<field name="trg_date_range">-60</field>
<field name="trg_date_range_type">day</field>
<field name="server_action_ids" eval="[(6, 0, [ref('contract_set_as_pending')])]"/>
</record>
<!-- base action rule about "Expired" contracts -->
<record id="contract_set_as_close" model="ir.actions.server">
<field name="name">HR Contract: set as close</field>
<field name="model_id" ref="model_hr_contract"/>
<field name="condition">True</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="code">record.set_as_close()</field>
</record>
<record id="rule_contract_3_set_as_close" model="base.action.rule">
<field name="name">HR Contract: check for close</field>
<field name="model_id" ref="model_hr_contract"/>
<field name="sequence">52</field>
<field name="kind">on_time</field>
<field name="trg_date_id" ref="hr_contract.field_hr_contract_date_end"/>
<field name="trg_date_range">1</field>
<field name="trg_date_range_type">day</field>
<field name="server_action_ids" eval="[(6, 0, [ref('contract_set_as_close')])]"/>
</record>
<record id="rule_contract_4_set_as_close" model="base.action.rule">
<field name="name">HR Contract: check for close</field>
<field name="model_id" ref="model_hr_contract"/>
<field name="sequence">53</field>
<field name="kind">on_time</field>
<field name="trg_date_id" ref="hr_contract.field_hr_contract_visa_expire"/>
<field name="trg_date_range">1</field>
<field name="trg_date_range_type">day</field>
<field name="server_action_ids" eval="[(6, 0, [ref('contract_set_as_close')])]"/>
</record>
</data>
</odoo>