<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
<!-- CONTRIBUTION REGISTERS -->
    <record id="res_partner_onss" model="res.partner">
        <field name="name">Office National de Sécurité Sociale (ONSS)</field>
        <field name="supplier">1</field>
        <field eval="0" name="customer"/>
    </record>
    <record id="contrib_register_onss" model="hr.contribution.register">
        <field name="name">ONSS</field>
        <field name="note">National Office of Social Security</field>
        <field name="partner_id" ref="res_partner_onss"/>
    </record>
    <record id="res_partner_pp" model="res.partner">
        <field name="name">Fiscal Administration</field>
        <field name="supplier">1</field>
        <field eval="0" name="customer"/>
    </record>
    <record id="contrib_register_pp" model="hr.contribution.register">
        <field name="name">Fiscal Administration</field>
        <field name="partner_id" ref="res_partner_pp"/>
    </record>
    <record id="res_partner_meal_vouchers" model="res.partner">
        <field name="name">Meal Voucher Supplier</field>
        <field name="supplier">1</field>
        <field eval="0" name="customer"/>
    </record>
    <record id="contrib_register_meal_vouchers" model="hr.contribution.register">
        <field name="name">Meal Voucher Supplier</field>
        <field name="partner_id" ref="res_partner_meal_vouchers"/>
    </record>

<!-- HR SALARY RULE CATEGORIES-->
    <record id="hr_payroll_head_salary" model="hr.salary.rule.category">
        <field name="name">Gross</field>
        <field name="code">BRUT</field>
    </record>
    <record id="hr_payroll.COMP" model="hr.salary.rule.category">
        <field name="name">Company Part</field>
        <field name="code">COMP. PART</field>
    </record>
    <record id="hr_payroll_head_onss" model="hr.salary.rule.category">
        <field name="name">Worker Social Contribution</field>
        <field name="code">ONSS</field>
        <field name="parent_id" ref="hr_payroll.ALW"/>
    </record>
    <record id="hr_payroll_head_div_impos" model="hr.salary.rule.category">
        <field name="name">Misc. Taxable</field>
        <field name="code">DIV. IMPOS</field>
        <field name="parent_id" ref="hr_payroll.ALW"/>
    </record>
    <record id="hr_payroll_head_pp" model="hr.salary.rule.category">
        <field name="name">Withholding Tax Grid 2011 (Precompte Professionnel Bareme 2011)</field>
        <field name="code">P.P.</field>
        <field name="parent_id" ref="hr_payroll.DED"/>
    </record>
    <record id="hr_payroll_head_div_net" model="hr.salary.rule.category">
        <field name="name">Misc. Net</field>
        <field name="code">DIV. NET</field>
        <field name="parent_id" ref="hr_payroll.DED"/>
    </record>
    <record id="hr_payroll_head_child_alw" model="hr.salary.rule.category">
        <field name="name">Child Allowance Belgium</field>
        <field name="code">Ch.A</field>
        <field name="parent_id" ref="hr_payroll.DED"/>
    </record>

<!-- HR SALARY RULES-->
    <record id="hr_payroll_rules_maj" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_salary"/> 
        <field name="name">Worker Salary. Premium pay of 108%</field>
        <field name="code">SALARY</field>
        <field name="condition_select">none</field>
        <field name="amount_select">code</field>
        <field name="amount_python_compute">result = contract.wage * 1.08</field>
    </record>
    <record id="hr_payroll_rules_employee" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_salary"/> 
        <field name="name">Employee Salary</field>
        <field name="code">SALARY</field>
        <field name="condition_select">none</field>
        <field name="amount_select">code</field>
        <field name="amount_python_compute">result = contract.wage * 1</field>
        <field name="appears_on_payslip" eval="False"/>
    </record>
    <record id="hr_payroll_rules_onss_rule" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_onss"/> 
        <field name="name">Social contribution</field>
        <field name="code">ONSS</field>
        <field name="sequence">41</field>
        <field name="condition_select">none</field>
        <field name="amount_select">percentage</field>
        <field name="amount_percentage_base">SALARY</field>
        <field name="amount_percentage">-13.07</field>
        <field name="register_id" ref="contrib_register_onss"/>
   </record>
   <record id="hr_payroll_rules_p_p_b1" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_pp"/> 
        <field name="name">Withholding Tax Grid 2011</field>
        <field name="code">P.P</field>
        <field name="sequence">120</field>
        <field name="amount_select">fix</field>
        <field name="condition_select">none</field>
        <field name="appears_on_payslip" eval="False"/>
    </record>
    <record id="hr_payroll_rules_bareme" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_pp"/>
        <field name="parent_rule_id" ref="hr_payroll_rules_p_p_b1"/>
        <field name="name">Withholding Tax</field>
        <field name="code">B.I.</field>
        <field name="amount_select">fix</field>
        <field name="sequence">120</field>
        <field name="condition_select">python</field>
        <field name="appears_on_payslip" eval="False"/>
        <field name="condition_python">result = (((employee.marital=='single') or (employee.marital=='married' and employee.spouse_fiscal_status=='with income')) and (employee.resident_bool!=True))</field>
    </record>
    <record id="hr_payroll_rules_baremeII" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_pp"/>
        <field name="parent_rule_id" ref="hr_payroll_rules_p_p_b1"/>
        <field name="name">Withholding Tax</field>
        <field name="code">B.II</field>
        <field name="amount_select">fix</field>
        <field name="sequence">120</field>
        <field name="condition_select">python</field>
        <field name="appears_on_payslip" eval="False"/>
        <field name="condition_python">result = ((employee.marital=='married' and employee.spouse_fiscal_status=='without income') and (employee.resident_bool!=True))</field>
    </record>
    <record id="hr_payroll_rules_baremeIII" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_pp"/>
        <field name="parent_rule_id" ref="hr_payroll_rules_p_p_b1"/>
        <field name="name">Withholding Tax</field>
        <field name="code">B.III</field>
        <field name="amount_select">fix</field>
        <field name="sequence">120</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = employee.resident_bool==True</field>
        <field name="appears_on_payslip" eval="False"/>
    </record>
    <record id="hr_payroll_rules_child_alw" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll.DED"/>
        <field name="name">Child Allowance Belgium</field>
        <field name="code">Child.Allowance</field>
        <field name="sequence">140</field>
        <field name="amount_select">fix</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = bool(employee.children)</field>
    </record>
    <record id="hr_payroll_rules_child" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll.DED"/>
        <field name="parent_rule_id" ref="hr_payroll_rules_child_alw"/>
        <field name="name">Child Allowance Belgium</field>
        <field name="code">Ch.A</field>
        <field name="amount_select">fix</field>
        <field name="sequence">141</field>
        <field name="note">The recipient of income is an isolated or spouse beneficiary's income has also
                                        earned income (Schedule I / II scale)

                                        A. When the gross monthly earnings do not exceed € 7,500, the withholding tax is determined according to the Schedule I.
                                        The following reductions are then deducted from the payroll tax determined in accordance with this schedule:

                                                a) Reduction for dependent children</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = bool(employee.children)</field>
    </record>
    <record id="hr_payroll_rules_child_handicap" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll.DED"/>
        <field name="parent_rule_id" ref="hr_payroll_rules_child_alw"/>
        <field name="name">Child Allowance for the Disabled Belgium</field>
        <field name="code">Ch.Handicap</field>
        <field name="amount_select">fix</field>
        <field name="sequence">143</field>
        <field name="note">"Disabled child" means:

                    the child reaches at least 66% of failure or reduced physical or mental capacity
                    the head of one or more conditions;


                    the child that is established, regardless of age, that due to developments and recognized
                    before age 65</field>
                <field name="condition_select">python</field>
                <field name="condition_python">result = bool(employee.disabled_children_number)</field>
    </record>
    <record id="hr_payroll_rules_spouse_handicap" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_div_net"/>
        <field name="name">Disabled Spouse Allowance</field>
        <field name="code">Sp.handicap</field>
        <field name="amount_select">fix</field>
        <field name="sequence">145</field>
        <field name="amount_fix">31</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = employee.disabled_spouse_bool==True</field>
    </record>
    <record id="hr_payroll_rules_company_car_parent" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_div_impos"/>
        <field name="name">Company Car</field>
        <field name="code">car</field>
        <field name="amount_select">fix</field>
        <field name="sequence">15</field>
        <field name="condition_select">none</field>
        <field name="appears_on_payslip" eval="False"/>
    </record>
    <record id="hr_payroll_rules_parent_company_car" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_div_impos"/>
        <field name="name">Company car</field>
        <field name="parent_rule_id" ref="hr_payroll_rules_company_car_parent"/>
        <field name="code">CAR 1</field>
        <field name="sequence">15</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = bool(contract.car_employee_deduction)</field>
        <field name="amount_select">code</field>
        <field name="amount_python_compute">result = contract.car_employee_deduction</field>
    </record>
    <record id="hr_payroll_rules_company_car_2" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_div_net"/>
        <field name="name">Retenue Company car</field>
        <field name="parent_rule_id" ref="hr_payroll_rules_company_car_parent"/>
        <field name="code">CAR 2</field>
        <field name="sequence">160</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = contract.car_employee_deduction</field>
        <field name="amount_select">code</field>
        <field name="amount_python_compute">result = -contract.car_employee_deduction</field>
    </record>
    <record id="hr_payroll_rules_company_car_emp" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll.COMP"/>
        <field name="name">Company car, Company part</field>
        <field name="parent_rule_id" ref="hr_payroll_rules_company_car_parent"/>
        <field name="code">CAR 3</field>
        <field name="sequence">160</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = bool(contract.car_company_amount)</field>
        <field name="amount_select">code</field>
        <field name="amount_python_compute">result = -contract.car_company_amount</field>
        <field name="appears_on_payslip" eval="False"/>
    </record>
    <record id="hr_payroll_rules_parent_ch" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_div_net"/>
        <field name="name">Meal Voucher</field>
        <field name="code">MEAL_V</field>
        <field name="amount_select">fix</field>
        <field name="sequence">165</field>
        <field name="condition_select">none</field>
        <field name="appears_on_payslip" eval="False"/>
    </record>
    <record id="hr_payroll_rules_ch_value" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll.COMP"/>
        <field name="parent_rule_id" ref="hr_payroll_rules_parent_ch"/>
        <field name="name">Meal Voucher, Company Part</field>
        <field name="code">MEAL_V_COMP</field>
        <field name="amount_select">fix</field>
        <field name="sequence">165</field>
        <field name="amount_select">code</field>
        <field name="amount_python_compute">result = -(contract.meal_voucher_amount - contract.meal_voucher_employee_deduction) * worked_days.WORK100.number_of_days</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = bool(contract.meal_voucher_amount)</field>
        <field name="appears_on_payslip" eval="False"/>
        <field name="register_id" ref="contrib_register_meal_vouchers"/>
    </record>
    <record id="hr_payroll_rules_ch_worker" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_div_net"/>
        <field name="name">Retain on Meal Voucher</field>
        <field name="parent_rule_id" ref="hr_payroll_rules_parent_ch"/>
        <field name="code">MEAL_V_EMP</field>
        <field name="sequence">165</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = bool(contract.meal_voucher_employee_deduction)</field>
        <field name="amount_select">percentage</field>
        <field name="amount_percentage">-100.0</field>
        <field name="amount_percentage_base">contract.meal_voucher_employee_deduction</field>
        <field name="quantity">worked_days.WORK100.number_of_days</field>
        <field name="appears_on_payslip" eval="True"/>
        <field name="register_id" ref="contrib_register_meal_vouchers"/>
    </record>
    <record id="hr_payroll_rules_reim_travel" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll.DED"/>
        <field name="name">Reimbursement of travel expenses</field>
        <field name="code">Tr.E</field>
        <field name="amount_select">code</field>
        <field name="sequence">65</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = bool(contract.travel_reimbursement_amount)</field>
        <field name="amount_python_compute">result = contract.travel_reimbursement_amount</field>
    </record>
    <record id="hr_payroll_rules_mis_ex_onss" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll.DED"/>
        <field name="name">Miscellaneous exempt ONSS</field>
        <field name="code">M.ONSS</field>
        <field name="amount_select">code</field>
        <field name="sequence">165</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = bool(contract.misc_onss_deduction)</field>
        <field name="amount_python_compute">result = -contract.misc_onss_deduction</field>
    </record>
    <record id="hr_payroll_rules_insurance" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll.DED"/>
        <field name="name">Insurance</field>
        <field name="code">Ins</field>
        <field name="amount_select">code</field>
        <field name="sequence">165</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = bool(contract.insurance_employee_deduction)</field>
        <field name="amount_python_compute">result = -contract.insurance_employee_deduction</field>
    </record>
    <record id="hr_payroll_rules_advantage" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll.ALW"/>
        <field name="name">Benefits of various nature</field>
        <field name="code">Ben</field>
        <field name="amount_select">code</field>
        <field name="sequence">10</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = bool(contract.misc_advantage_amount)</field>
        <field name="amount_python_compute">result = contract.misc_advantage_amount</field>
    </record>
    <record id="hr_payroll_rules_suppl_net" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_div_net"/>
        <field name="name">Net Supplement</field>
        <field name="code">Net.S</field>
        <field name="amount_select">code</field>
        <field name="sequence">185</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = bool(contract.additional_net_amount)</field>
        <field name="amount_python_compute">result = contract.additional_net_amount</field>
    </record>
    <record id="hr_payroll_rules_retained_net" model="hr.salary.rule">
        <field name="category_id" ref="hr_payroll_head_div_net"/>
        <field name="name">Net retained</field>
        <field name="code">Net.R</field>
        <field name="amount_select">code</field>
        <field name="sequence">190</field>
        <field name="condition_select">python</field>
        <field name="condition_python">result = bool(contract.retained_net_amount)</field>
        <field name="amount_python_compute">result = -contract.retained_net_amount</field>
    </record>
    <record id="hr_payroll_salary_structure_employee" model="hr.payroll.structure">
        <field name="code">C.P.218</field>
        <field name="name">Belgian Employee</field>
        <field eval="[(6, 0, [ref('hr_payroll_rules_company_car_parent'),ref('hr_payroll_rules_onss_rule'),ref('hr_payroll_rules_employee'),ref('hr_payroll_rules_p_p_b1'),ref('hr_payroll_rules_child_alw'),ref('hr_payroll_rules_parent_ch'),ref('hr_payroll_rules_reim_travel'),ref('hr_payroll_rules_mis_ex_onss'),ref('hr_payroll_rules_insurance'),ref('hr_payroll_rules_advantage'),ref('hr_payroll_rules_suppl_net'),ref('hr_payroll_rules_retained_net')])]" name="rule_ids"/>
        <field name="company_id" ref="base.main_company"/>    
        <field name="parent_id" ref="hr_payroll.structure_base"/>
    </record>
    <record id="hr_payroll_salary_structure_worker" model="hr.payroll.structure">
        <field name="code">C.P.219</field>
        <field name="name">Belgian Worker</field>
        <field eval="[(6, 0, [ref('hr_payroll_rules_maj'), ref('hr_payroll_rules_onss_rule'),ref('hr_payroll_rules_p_p_b1'),ref('hr_payroll_rules_child_alw'),ref('hr_payroll_rules_parent_ch'),ref('hr_payroll_rules_reim_travel'),ref('hr_payroll_rules_mis_ex_onss'),ref('hr_payroll_rules_insurance'),ref('hr_payroll_rules_advantage'),ref('hr_payroll_rules_suppl_net'),ref('hr_payroll_rules_retained_net')])]" name="rule_ids"/>
        <field name="company_id" ref="base.main_company"/>
        <field name="parent_id" ref="hr_payroll.structure_base"/>
        </record>
    </data>
</openerp>
