<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <!-- Contribution Register -->

        <record id="hr_houserent_register" model="hr.contribution.register">
            <field name="name">House Rent Allowance Register</field>
        </record>

        <record id="hr_provident_fund_register" model="hr.contribution.register">
            <field name="name">Provident Fund Register</field>
        </record>

        <record id="hr_professional_tax_register" model="hr.contribution.register">
            <field name="name">Professional Tax Register</field>
        </record>

        <record id="hr_meal_voucher_register" model="hr.contribution.register">
            <field name="name">Meal Voucher Register</field>
        </record>

        <!-- Salary Rules -->

        <record id="hr_salary_rule_houserentallowance1" model="hr.salary.rule">
            <field name="amount_select">percentage</field>
            <field eval="40.0" name="amount_percentage"/>
            <field name="amount_percentage_base">contract.wage</field>
            <field name="code">HRA</field>
            <field name="category_id" ref="hr_payroll.ALW"/>
            <field name="register_id" ref="hr_houserent_register"/>
            <field name="name">House Rent Allowance</field>
            <field name="sequence" eval="5"/>
        </record>

        <record id="hr_salary_rule_convanceallowance1" model="hr.salary.rule">
            <field name="amount_select">fix</field>
            <field eval="800.0" name="amount_fix"/>
            <field name="code">CA</field>
            <field name="category_id" ref="hr_payroll.ALW"/>
            <field name="name">Conveyance Allowance</field>
            <field name="sequence" eval="10"/>
        </record>

        <record id="hr_salary_rule_professionaltax1" model="hr.salary.rule">
            <field name="amount_select">fix</field>
            <field eval="150" name="sequence"/>
            <field eval="-200.0" name="amount_fix"/>
            <field name="code">PT</field>
            <field name="category_id" ref="hr_payroll.DED"/>
            <field name="register_id" ref="hr_professional_tax_register"/>
            <field name="name">Professional Tax</field>
        </record>

        <record id="hr_salary_rule_providentfund1" model="hr.salary.rule">
            <field name="amount_select">percentage</field>
            <field eval="120" name="sequence"/>
            <field eval="-12.5" name="amount_percentage"/>
            <field name="amount_percentage_base">contract.wage</field>
            <field name="code">PF</field>
            <field name="category_id" ref="hr_payroll.DED"/>
            <field name="register_id" ref="hr_provident_fund_register"/>
            <field name="name">Provident Fund</field>
        </record>

        <record id="hr_salary_rule_ca_paolino" model="hr.salary.rule">
            <field name="amount_select">fix</field>
            <field eval="600.0" name="amount_fix"/>
            <field name="code">CA</field>
            <field name="category_id" ref="hr_payroll.ALW"/>
            <field name="name">Conveyance Allowance For Paolino</field>
            <field name="sequence" eval="15"/>
        </record>

        <record id="hr_salary_rule_meal_voucher" model="hr.salary.rule">
            <field name="amount_select">fix</field>
            <field eval="10" name="amount_fix"/>
            <field name="quantity">worked_days.WORK100.number_of_days</field>
            <field name="code">MA</field>
            <field name="category_id" ref="hr_payroll.ALW"/>
            <field name="register_id" ref="hr_meal_voucher_register"/>
            <field name="name">Meal Voucher</field>
            <field name="sequence" eval="16"/>
         </record>

        <record id="hr_salary_rule_sales_commission" model="hr.salary.rule">
            <field name="amount_select">code</field>
            <field name="code">SALE</field>
            <field name="category_id" ref="hr_payroll.ALW"/>
            <field name="name">Get 1% of sales</field>
            <field name="sequence" eval="17"/>
            <field name="amount_python_compute">result = (inputs.SALEURO.amount + inputs.SALASIA.amount) * contract.wage * 0.01</field>
         </record>

        <!-- Rule Inputs -->

        <record id="hr_rule_input_sale_a" model="hr.rule.input">
            <field name="code">SALEURO</field>
            <field name="name">Sales to Europe</field>
            <field name="input_id" ref="hr_salary_rule_sales_commission"/>
        </record>

        <record id="hr_rule_input_sale_b" model="hr.rule.input">
            <field name="code">SALASIA</field>
            <field name="name">Sales to Asia</field>
            <field name="input_id" ref="hr_salary_rule_sales_commission"/>
        </record>

        <!-- Salary Structure -->

         <record id="structure_001" model="hr.payroll.structure">
            <field name="code">ME</field>
            <field name="name">Marketing Executive</field>
            <field eval="[(6, 0, [ref('hr_salary_rule_houserentallowance1'), ref('hr_salary_rule_convanceallowance1'),ref('hr_salary_rule_professionaltax1'),ref('hr_salary_rule_providentfund1')])]" name="rule_ids"/>
            <field name="company_id" ref="base.main_company"/>
            <field name="parent_id" ref="structure_base"/>
        </record>

        <record id="structure_002" model="hr.payroll.structure">
            <field name="code">MEQP</field>
            <field name="name">Marketing Executive for Quentin Paolino</field>
            <field eval="[(6, 0, [ref('hr_salary_rule_ca_paolino'), ref('hr_salary_rule_meal_voucher')])]" name="rule_ids"/>
            <field name="company_id" ref="base.main_company"/>
            <field name="parent_id" ref="structure_001"/>
        </record>

        <!-- Employee -->

        <record id="hr_employee_bonamy0" model="hr.employee">
            <field eval="0" name="manager"/>
            <field eval="1.0" name="time_efficiency"/>
            <field name="company_id" ref="base.main_company"/>
            <field eval="1" name="active"/>
            <field name="name">Bonamy</field>
            <field name="resource_type">user</field>
        </record>

        <!-- Employee Contract -->

        <record id="hr_contract_firstcontract1" model="hr.contract">
            <field name="name">Marketing Executive Contract</field>
            <field name="type_id" ref="hr_contract.hr_contract_type_emp"/>
            <field name="date_start" eval="time.strftime('%Y-%m')+'-1'"/>
            <field name="date_end" eval="time.strftime('%Y')+'-12-31'"/>
            <field name="struct_id" ref="hr_payroll.structure_001"/>
            <field name="employee_id" ref="hr_employee_bonamy0"/>
            <field name="notes">This is a First Contract</field>
            <field eval="4000.0" name="wage"/>
            <field eval="5" name="working_days_per_week"/>
        </record>

        <record id="hr_contract_quentin_paolino" model="hr.contract">
            <field name="name">Contract For Quentin Paolino</field>
            <field name="type_id" ref="hr_contract.hr_contract_type_emp"/>
            <field name="date_start" eval="time.strftime('%Y-%m')+'-1'"/>
            <field name="date_end" eval="time.strftime('%Y')+'-12-31'"/>
            <field name="struct_id" ref="hr_payroll.structure_002"/>
            <field name="employee_id" ref="hr.employee2"/>
            <field name="notes">This is Quentin Paolino's contract</field>
            <field eval="5000.0" name="wage"/>
            <field eval="5" name="working_days_per_week"/>
            <field name="working_hours" ref="resource.timesheet_group1"/>
        </record>

    </data>
</openerp>
