<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <!-- Root Menus -->
        <menuitem id="menu_hr_root_payroll" parent="hr.menu_hr_root" name="Payroll" groups="base.group_system,group_hr_payroll" sequence="9"/>
        <menuitem id="payroll_configure" parent="hr.menu_hr_configuration" name="Payroll" groups="base.group_system"/>
        <menuitem id="menu_hr_payroll_reporting" parent="hr.menu_hr_reporting" name="Payroll" groups="base.group_hr_manager"/>

        <!-- Passport Views    -->
        <record id="hr_passport_form" model="ir.ui.view">
            <field name="name">hr.passport.form</field>
            <field name="model">hr.passport</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Passport">
                    <group col="6" colspan="4">
                        <field name="name" select="1" colspan="4"/>
                        <field name="employee_id" />
                    </group>
                    <group col="2" colspan="2">
                        <separator string="Country &amp; Address" colspan="4"/>
                        <field name="country_id" select="1"/>
                        <field name="address_id" select="1"/>
                    </group>
                    <group col="2" colspan="2">
                        <separator string="Valid From" colspan="2"/>
                        <field name="date_issue" select="1"/>
                        <field name="date_expire" select="1"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Description">
                            <separator string="Description" colspan="2"/>
                            <field name="note" colspan="4" nolabel="1"/>
                        </page>
                        <page string="Contracts">
                            <field name="contracts_ids" colspan="4" nolabel="1"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>
        <record id="hr_passport_tree" model="ir.ui.view">
            <field name="name">hr.passport.tree</field>
            <field name="model">hr.passport</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Passport">
                    <field name="name" />
                    <field name="employee_id" />
                    <field name="address_id"/>
                    <field name="country_id" />
                    <field name="date_expire"/>
                    <field name="date_issue" />
                </tree>
            </field>
        </record>

        <record id="view_hr_passport_filter" model="ir.ui.view">
            <field name="name">hr.passport.select</field>
            <field name="model">hr.passport</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Search Passport">
                    <group col="8" colspan="4">
                        <field name="name"/>
                        <field name="employee_id"/>
                        <field name="country_id"/>
                        <field name="address_id"/>
                    </group>
                    <newline/>
                    <group col="8" colspan="4" expand="0" string="Group By...">
                        <filter string="Employees" icon="terp-partner" name="employee_id" context="{'group_by':'employee_id'}"/>
                        <filter string="Country" name="country_id" icon="terp-go-home" context="{'group_by':'country_id'}"/>
                        <filter string="Expire" name="date_expire" icon="terp-go-month" context="{'group_by':'date_expire'}"/>
                        <filter string="Issue" name="date_issue" icon="terp-go-month" context="{'group_by':'date_issue'}"/>
                    </group>
                </search>
            </field>
        </record>
        <record id="action_hr_passport_tree" model="ir.actions.act_window">
            <field name="name">All Passports</field>
            <field name="res_model">hr.passport</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="hr_passport_tree"/>
            <field name="search_view_id" ref="view_hr_passport_filter"/>
        </record>
        <!-- End Passport Views -->

        <!-- Employee View -->
        <record id="hr_contract.hr_hr_employee_view_form2" model="ir.ui.view">
            <field name="name">hr.hr.employee.view.form2</field>
            <field name="model">hr.employee</field>
            <field name="inherit_id" ref="hr.view_employee_form"/>
            <field name="arch" type="xml">
            <data>
                <xpath expr="/form/notebook/page[@string='Personal Information']" position="after">
                    <page string="Miscellaneous">
                        <group colspan="2" col="2">
                            <separator string="Personal Info" colspan="2"/>
                            <field name="otherid" select="1"/>
                            <field name="bank_account_id"/>
                            <field name="place_of_birth"/>
                            <field name="children"/>
                        </group>
                        <group colspan="2" col="2">
                            <separator string="Job Info" colspan="2"/>
                            <field name="manager" select="1"/>
                            <field name="vehicle" select="1"/>
                            <field name="vehicle_distance" select="1"/>
                        </group>
                        <group col="2" colspan="2">
                            <separator colspan="2" string="ESI Information"/>
                            <field name="esi_account" string="Account"/>
                            <field name="hospital_id" string="Hospital"/>
                            <field name="medic_exam" select="1" string="Medical Examination"/>
                            <field name="esp_account" select="1"/>
                        </group>
                        <group col="2" colspan="2">
                            <separator colspan="2" string="Providend Fund"/>
                            <field name="pf_account" string="Account"/>
                            <field name="pg_joining" string="Join Date"/>
                        </group>
                    </page>
                    <page string="Contracts">
                        <field colspan="4" mode="form,tree" name="contract_ids" nolabel="1">
                            <tree string="Contracts">
                                <field name="name"/>
                                <field name="job_id"/>
                                <field name="date_start"/>
                                <field name="date_end"/>
                                <field name="working_hours"/>
                                <field name="wage_type_id"/>
                                <field name="wage"/>
                            </tree>
                            <form string="Contracts">
                                <group colspan="4" col="6">
                                    <field name="name" select="1"/>
                                    <field name="job_id"/>
                                    <newline/>
                                    <field name="wage"/>
                                    <field name="wage_type_id" widget="selection"/>
                                    <field name="type_id" widget="selection"/>
                                </group>
                                <notebook colspan="4">
                                    <page string="Main Data">
                                        <group col="2" colspan="2">
                                            <separator colspan="2" string="Duration"/>
                                            <field name="date_start" select="1"/>
                                            <field name="date_end" select="1"/>
                                            <field name="working_hours"/>
                                        </group>
                                        <group col="2" colspan="2">
                                            <separator colspan="2" string="Advantages"/>
                                            <field name="struct_id" select="1"/>
                                            <field name="advantages_net"/>
                                            <field name="advantages_gross"/>
                                            <field name="advantages" nolabel="1" colspan="2"/>
                                        </group>
                                    </page>
                                    <page string="Work Permit">
                                        <group col="2" colspan="2">
                                            <separator colspan="2" string="Passport"/>
                                            <field name="passport_id"/>
                                        </group>
                                        <group col="2" colspan="2">
                                            <separator colspan="2" string="Valid for"/>
                                            <field name="visa_no"/>
                                            <field name="permit_no"/>
                                            <field name="visa_expire"/>
                                        </group>
                                    </page>
                                </notebook>
                                <separator colspan="4" string="Notes"/>
                                <field colspan="4" name="notes" nolabel="1"/>
                            </form>
                        </field>
                    </page>
                </xpath>
                <xpath expr="/form/notebook/page[@string='Notes']" position="before">
                    <page string="Salary Structure">
                        <field name="line_ids" nolabel="1" colspan="4" string="Salary Structure">
                            <tree string="Salary Structure" editable="bottom">
                                <field name="category_id" on_change="onchange_category(category_id)"/>
                                <field name="sequence"/>
                                <field name="name"/>
                                <field name="code"/>
                                <field name="type"/>
                                <field name="amount_type"/>
                                <field name="amount" on_change="onchange_amount(amount, amount_type)"/>
                                <field name="account_id"/>
                                <field name="analytic_account_id" groups="base.group_extended"/>
                            </tree>
                        </field>
                    </page>
                    <page string="Accounting">
                        <field name="property_bank_account"/>
                        <field name="salary_account"/>
                        <field name="employee_account"/>
                        <field name="analytic_account" groups="base.group_extended"/>
                        <field name="slip_ids" colspan="4" nolabel="1"/>
                    </page>
                </xpath>
            </data>
            </field>
        </record>

        <record id="view_employee_passport_form" model="ir.ui.view">
            <field name="name">hr.employee.passport.form</field>
            <field name="model">hr.employee</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="hr.view_employee_form"/>
            <field name="arch" type="xml">
                <field name="identification_id" position="after">
                    <field name="passport_id"/>
                </field>
            </field>
        </record>
        <!-- End Employee View -->
        <!-- Contract View -->
        <record id="hr_contract.hr_contract_view_form" model="ir.ui.view">
            <field name="name">hr.contract.view.form</field>
            <field name="model">hr.contract</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Contract">
                    <group colspan="4" col="6">
                        <field name="name" select="1"/>
                        <field name="employee_id" select="1" on_change="on_change_employee_id(employee_id)"/>
                        <field name="job_id"/>
                        <field name="wage"/>
                        <field name="wage_type_id" widget="selection"/>
                        <field name="type_id" widget="selection"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Main Data">
                            <group col="2" colspan="2">
                                <separator colspan="2" string="Duration"/>
                                <field name="date_start" select="1"/>
                                <field name="date_end" select="1"/>
                                <field name="working_hours"/>
                                <field name="working_days_per_week" select="1"/>
                                <separator colspan="2" string="Trial Period"/>
                                <field name="trial_date_start" />
                                <field name="trial_date_end" />
                            </group>
                            <group col="2" colspan="2">
                                <separator colspan="2" string="Advantages"/>
                                <field name="struct_id" select="1"/>
                                <field name="advantages_net"/>
                                <field name="advantages_gross"/>
                                <field name="advantages" nolabel="1" colspan="2"/>
                            </group>
                        </page>
                        <page string="Work Permit">
                            <group col="2" colspan="2">
                                <separator colspan="2" string="Passport"/>
                                <field name="passport_id"/>
                            </group>
                            <group col="2" colspan="2">
                                <separator colspan="2" string="Valid for"/>
                                <field name="visa_no"/>
                                <field name="permit_no"/>
                                <field name="visa_expire"/>
                            </group>
                        </page>
                    </notebook>
                    <separator colspan="4" string="Notes"/>
                    <field colspan="4" name="notes" nolabel="1"/>
                </form>
            </field>
        </record>
        <menuitem action="hr_contract.action_hr_contract" id="hr_menu_contract" parent="payroll_configure" name="Contracts" sequence="4"/>
        <!-- End Contract View-->

        <!-- Salary structure -->
        <record id="view_hr_employee_grade_tree" model="ir.ui.view">
            <field name="name">hr.payroll.structure.tree</field>
            <field name="model">hr.payroll.structure</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Employee Function">
                    <field name="name"/>
                    <field name="code"/>
                    <field name="line_ids"/>
                    <field name="company_id"/>
                </tree>
            </field>
        </record>

        <record id="view_hr_employee_grade_form" model="ir.ui.view">
            <field name="name">hr.payroll.structure.form</field>
            <field name="model">hr.payroll.structure</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Employee Function">
                    <group col="6" colspan="4">
                        <field name="name" colspan="4" select="1"/>
                        <field name="code" select="1"/>
                        <field name="account_id" select="1" groups="base.group_extended"/>
                        <field name="company_id"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Salary Structure">
                            <field name="line_ids" nolabel="1" colspan="4"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>

        <record id="action_view_hr_employee_grade_form" model="ir.actions.act_window">
            <field name="name">Salary Structure</field>
            <field name="res_model">hr.payroll.structure</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_hr_employee_grade_tree"/>
        </record>
        <menuitem
            id="menu_hr_employee_function"
            action="action_view_hr_employee_grade_form"
            parent="payroll_configure"
        />
        <!-- End Salary structure -->

        <!-- Holiday Status -->
        <record model="ir.ui.view" id="view_holiday_status_form1">
            <field name="name">hr.holidays.status.inherit</field>
            <field name="model">hr.holidays.status</field>
            <field name="inherit_id" ref="hr_holidays.edit_holiday_status_form"/>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <field name="color_name" position="after">
                    <group col="2" colspan="2">
                        <separator colspan="4" string="Payroll Accounting"/>
                        <field name="company_id" widget="selection" select="2"/>
                        <field name="code"/>
                        <field name="analytic_account_id" groups="base.group_extended"/>
                        <field name="account_id"/>
                    </group>
                    <group col="2" colspan="2">
                        <separator colspan="4" string="Payroll Configurtion"/>
                        <field name="type"/>
                        <field name="head_id"/>
                    </group>
                </field>
            </field>
        </record>
        <!-- End Holiday Status -->

        <!-- Payslip Line -->
        <record id="view_hr_payslip_line_tree" model="ir.ui.view">
            <field name="name">hr.payslip.line.tree</field>
            <field name="model">hr.payslip.line</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Salary Structure" editable="bottom">
                    <field name="category_id" on_change="onchange_category(category_id)"/>
                    <field name="sequence"/>
                    <field name="name"/>
                    <field name="code"/>
                    <field name="type"/>
                    <field name="amount_type"/>
                    <field name="amount" on_change="onchange_amount(amount, amount_type)"/>
                    <field name="account_id"/>
                    <field name="analytic_account_id" groups="base.group_extended"/>
                </tree>
            </field>
        </record>
        <record id="view_hr_payslip_line_form" model="ir.ui.view">
            <field name="name">hr.payslip.line.form</field>
            <field name="model">hr.payslip.line</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Payslip Line">
                    <group col="6" colspan="4">
                        <field name="name" colspan="4" select="1"/>
                        <field name="code" select="1"/>
                        <field name="slip_id" select="1"/>
                        <field name="employee_id"/>
                        <field name="function_id"/>
                    </group>
                    <group col="2" colspan="2">
                        <separator colspan="4" string="Calculations"/>
                        <field name="category_id" on_change="onchange_category(category_id)"/>
                        <field name="type"/>
                        <field name="amount_type"/>
                        <field name="amount" on_change="onchange_amount(amount, amount_type)" attrs="{'readonly':[('amount_type','=','func')]}"/>
                        <field name="sequence"/>
                    </group>
                    <group col="2" colspan="2">
                        <separator colspan="4" string="Accounting Informations"/>
                        <field name="account_id"/>
                        <field name="analytic_account_id" groups="base.group_extended"/>
                        <separator colspan="4" string="Company contribution"/>
                        <field name="company_contrib"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Function">
                            <field name="line_ids" colspan="4" nolabel="1" attrs="{'readonly':[('amount_type','!=','func')]}">
                                <tree string="Function Arguments" editable="bottom">
                                    <field name="name"/>
                                    <field name="sequence"/>
                                    <field name="from_val"/>
                                    <field name="to_val"/>
                                    <field name="amount_type"/>
                                    <field name="value"/>
                                </tree>
                            </field>
                        </page>
                        <page string="Description">
                            <separator colspan="4" string="Description"/>
                            <field name="note" colspan="4" nolabel="1"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>

        <record id="view_hr_payslip_tree" model="ir.ui.view">
            <field name="name">hr.payslip.tree</field>
            <field name="model">hr.payslip</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree colors="blue:state in ('draft');black:state in ('confirm','new','hr_check','accont_check');gray:state in('done','cancel')" string="Payslip">
                    <field name="number"/>
                    <field name="employee_id"/>
                    <field name="register_id" invisible="1"/>
                    <field name="name"/>
                    <field name="date"/>
                    <field name="grows"/>
                    <field name="net"/>
                    <field name="state"/>
                    <field name="company_id"/>
                </tree>
            </field>
        </record>

        <record id="view_hr_payslip_form" model="ir.ui.view">
            <field name="name">hr.payslip.form</field>
            <field name="model">hr.payslip</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Payslip">
                    <group col="6" colspan="4">
                        <field name="employee_id"/>
                        <field name="name"/>
                        <field name="number" select="1"/>
                        <field name="journal_id"/>
                        <field name="bank_journal_id" domain="[('type','=','cash')]"/>
                        <field name="date"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Salary Detail">
                            <field name="line_ids" colspan="4" nolabel="1">
                                <tree string="Salary Structure" editable="bottom">
                                    <field name="category_id" on_change="onchange_category(category_id)"/>
                                    <field name="sequence"/>
                                    <field name="name"/>
                                    <field name="code"/>
                                    <field name="type"/>
                                    <field name="amount_type"/>
                                    <field name="amount" on_change="onchange_amount(amount, amount_type)"/>
                                    <field name="total"/>
                                    <field name="account_id"/>
                                    <field name="analytic_account_id" groups="base.group_extended"/>
                                </tree>
                            </field>

                            <group col="6" colspan="4">
                                <separator string="Computation Overview" colspan="6"/>
                                <field name="working_days"/>
                                <field name="holiday_days"/>
                                <field name="worked_days"/>

                                <field name="basic_before_leaves"/>
                                <field name="leaves"/>
                                <field name="basic"/>

                                <field name="allounce"/>
                                <field name="deduction"/>
                                <field name="other_pay"/>

                                <field name="grows"/>
                                <field name="net"/>
                                <field name="total_pay"/>
                            </group>
                        </page>
                        <page string="Accounting Details">
                            <group col="2" colspan="1">
                                <separator colspan="2" string="Other Informations"/>
                                <field name="paid" readonly="1"/>
                                <field name="company_id"/>
                                <field name="register_id"/>
                                <field name="deg_id"/>
                                <field name="contract_id" domain="[('employee_id','=',employee_id)]"/>
                            </group>
                            <newline/>
                            <separator colspan="4" string="Description"/>
                            <field name="note" colspan="4" nolabel="1"/>
                        </page>
                    </notebook>
                    <group col="10" colspan="4">
                        <field name="state"/>
                        <button string="Cancel" icon="terp-dialog-close" name="cancel_sheet" states="draft,hr_check,confirm"/>
                        <button string="Compute Sheet" icon="terp-stock_format-scientific" name="compute_sheet" states="new"/>
                        <button string="Recompute Sheet" icon="terp-stock_format-scientific" name="compute_sheet" type="object" states="draft"/>
                        <button string="Verify Sheet" icon="terp-camera_test" name="verify_sheet" states="draft"/>
                        <button string="Approve Sheet" icon="terp-camera_test" name="final_verify_sheet" states="hr_check"/>
                        <button string="Pay Salary" icon="terp-dolar_ok!" name="process_sheet" states="confirm"/>
                        <button string="Set to Draft" icon="terp-stock_effects-object-colorize" name="set_to_draft" states="cancel"/>
                    </group>
                </form>
            </field>
        </record>
        <record id="view_hr_payslip_filter" model="ir.ui.view">
            <field name="name">hr.payslip.select</field>
            <field name="model">hr.payslip</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Search Payslips">
                    <group col="8" colspan="4">
                        <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Slip"/>
                        <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Slip"/>
                        <separator orientation="vertical"/>
                        <filter icon="terp-dolar_ok!" string="Paid" domain="[('state','=','done'),('paid','=',True)]" help="Paid Slip"/>
                        <separator orientation="vertical"/>
                        <field name="name"/>
                        <field name="employee_id"/>
                        <field name="number"/>
                        <field name="date"/>
                    </group>
                    <newline/>
                    <group col="8" colspan="4" expand="0" string="Group By...">
                        <filter string="Employees" icon="terp-personal" name="employee_id" context="{'group_by':'employee_id'}"/>
                        <separator orientation="vertical"/>
                        <filter string="Register" icon="terp-folder-yellow" name="register_id" context="{'group_by':'register_id'}"/>
                        <separator orientation="vertical"/>
                        <filter string="Companies" name="company_id"  icon="terp-go-home" context="{'group_by':'company_id'}"/>
                        <separator orientation="vertical"/>
                        <filter string="States" name="state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
                    </group>
                </search>
            </field>
        </record>
        <record id="action_view_hr_payslip_form" model="ir.actions.act_window">
            <field name="name">Employee Payslip</field>
            <field name="res_model">hr.payslip</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_hr_payslip_tree"/>
            <field name="search_view_id" ref="view_hr_payslip_filter"/>
        </record>
        <menuitem action="action_view_hr_payslip_form" id="menu_department_tree" parent="menu_hr_root_payroll"/>



        <!-- Payment Heads -->
        <record id="hr_allounce_deduction_categoty_form" model="ir.ui.view">
            <field name="name">hr.allounce.deduction.categoty.form</field>
            <field name="model">hr.allounce.deduction.categoty</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Salary Heads">
                    <group col="6" colspan="6">
                        <field name="name" select="1"/>
                        <field name="code" select="1"/>
                        <field name="type" select="1"/>
                        <group col="2" colspan="4">
                            <separator colspan="4" string="Based on"/>
                            <field name="base" colspan="4" nolabel="1"/>
                        </group>
                        <group col="2" colspan="2">
                            <separator colspan="4" string="Dynamic Computation"/>
                            <field name="condition"/>
                            <field name="sequence"/>
                        </group>
                    </group>
                    <notebook colspan="4">
                        <page string="Description">
                            <field name="note" colspan="4" nolabel="1"/>
                        </page>
                        <page string="Contribution">
                            <field name="contribute_ids" colspan="4" nolabel="1" height="300"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>
        <record id="hr_allounce_deduction_categoty_tree" model="ir.ui.view">
            <field name="name">hr.allounce.deduction.categoty.tree</field>
            <field name="model">hr.allounce.deduction.categoty</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Salary Heads">
                    <field name="name"/>
                    <field name="code"/>
                    <field name="type"/>
                    <field name="base"/>
                    <field name="condition"/>
                    <field name="sequence"/>
                </tree>
            </field>
        </record>

        <record id="view_allounce_deduction_categoty_filter" model="ir.ui.view">
            <field name="name">hr.allounce.deduction.categoty.select</field>
            <field name="model">hr.allounce.deduction.categoty</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Salary Heads">
                    <filter icon="terp-document-new" string="Allowance" domain="[('type','=','allowance')]"/>
                    <filter icon="terp-check" string="Deduction" domain="[('type','=','deduction')]"/>
                    <separator orientation="vertical"/>
                    <field name="name" select="1"/>
                     <field name="code" select="1"/>
                    <field name="type"/>
                    <newline/>
                    <group expand="0" string="Group By..." colspan="4" col="4" groups="base.group_extended">
                        <filter string="Based" icon="terp-go-month" domain="[]" context="{'group_by':'base'}"/>
                        <filter string="Type" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'type'}"/>
                    </group>
               </search>
            </field>
        </record>

        <record id="hr_allounce_deduction_tree" model="ir.actions.act_window">
            <field name="name">Salary Heads</field>
            <field name="res_model">hr.allounce.deduction.categoty</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="hr_allounce_deduction_categoty_tree"/>
           <field name="search_view_id" ref="view_allounce_deduction_categoty_filter"/>
        </record>
        <menuitem
            id="menu_hr_allounce_deduction_tree"
            action="hr_allounce_deduction_tree"
            parent="payroll_configure"
        />
        <!-- End Payment Heads -->

        <!-- Company Contribution -->
        <record id="hr_company_contribution_form" model="ir.ui.view">
            <field name="name">company.contribution.form</field>
            <field name="model">company.contribution</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Company Contribution">
                    <group col="6" colspan="6">
                        <field name="name" select="1"/>
                        <field name="code" select="1"/>
                        <field name="category_id"/>
                    </group>
                    <group col="2" colspan="2">
                        <separator colspan="2" string="Contributions"/>
                        <field name="amount_type" attrs="{'required': [('contribute','=',True)]}"/>
                        <field name="contribute_per" attrs="{'required': [('contribute','=',True)], 'readonly':[(('amount_type','=','func'))]}"/>
                        <field name="register_id" attrs="{'required': [('contribute','=',True)]}"/>
                    </group>
                    <group col="2" colspan="2">
                        <separator colspan="2" string="Other Information"/>
                        <field name="company_id" select="1"/>
                        <field name="active" select="1"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Function" attrs="{'readonly': [('amount_type','!=','func')]}">
                            <field name="line_ids" colspan="4" nolabel="1">
                                <tree string="Function Arguments" editable="bottom">
                                    <field name="name"/>
                                    <field name="sequence"/>
                                    <field name="from_val"/>
                                    <field name="to_val"/>
                                    <field name="amount_type"/>
                                    <field name="value"/>
                                </tree>
                            </field>
                        </page>
                        <page string="Description">
                            <field name="note" colspan="4" nolabel="1"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>
        <record id="hr_company_contribution_tree" model="ir.ui.view">
            <field name="name">company.contribution.tree</field>
            <field name="model">company.contribution</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Company Contribution">
                    <field name="name"/>
                    <field name="code"/>
                    <field name="contribute_per"/>
                    <field name="amount_type"/>
                    <field name="register_id"/>
                     <field name="category_id"/>
                </tree>
            </field>
        </record>

    <record id="view_hr_company_contribution_filter" model="ir.ui.view">
            <field name="name">company.contribution.select</field>
             <field name="model">company.contribution</field>
            <field name="type">search</field>
             <field name="arch" type="xml">
                <search string="Search Company Contribution">
                    <group col="8" colspan="4">
                        <filter icon="terp-document-new" string="Fixed Amount" domain="[('amount_type','=','fix')]" help="Draft Slip"/>
                        <filter icon="terp-camera_test" string="Function Calculation" domain="[('amount_type','=','func')]" help="Posted Slip"/>
                        <separator orientation="vertical"/>
                        <field name="name"/>
                        <field name="code"/>
                        <field name="contribute_per"/>
                        <field name="register_id"/>
                    </group>
                    <newline/>
                    <group col="8" colspan="4" expand="0" string="Group By...">
                        <filter string="Type" icon="terp-partner" name="amount_type" context="{'group_by':'amount_type'}"/>
                        <filter string="Category" name="category_id" icon="terp-go-month"  context="{'group_by':'category_id'}"/>
                    </group>
                </search>
            </field>
        </record>
        <record id="action_hr_company_contribution_tree" model="ir.actions.act_window">
            <field name="name">Company Contributions</field>
            <field name="res_model">company.contribution</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="hr_company_contribution_tree"/>
             <field name="search_view_id" ref="view_hr_company_contribution_filter"/>
        </record>
        <menuitem
            id="menu_hr_company_contribution_tree"
            action="action_hr_company_contribution_tree"
            parent="payroll_configure"
        />
        <!-- End Company Contribution -->

        <record id="view_hr_bank_advice_tree" model="ir.ui.view">
            <field name="name">hr.payroll.advice.tree</field>
            <field name="model">hr.payroll.advice</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Bank Advice">
                    <field name="name" select="1"/>
                    <field name="date" select="1"/>
                    <field name="number" select="1"/>
                    <field name="company_id"/>
                </tree>
            </field>
        </record>

        <record id="view_hr_bank_advice_form" model="ir.ui.view">
            <field name="name">hr.payroll.advice.form</field>
            <field name="model">hr.payroll.advice</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Bank Advice">
                    <group col="6" colspan="4">
                        <field name="name" colspan="4" select="1"/>
                        <field name="account_id" select="1"/>
                        <newline/>
                        <field name="date" select="1"/>
                        <field name="number" select="1"/>
                        <field name="register_id"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Paymeny Lines">
                            <field name="line_ids" colspan="4" nolabel="1">
                                <tree string="Payment Lines" editable="bottom">
                                    <field name="employee_id" on_change="onchange_employee_id(parent.date, employee_id)"/>
                                    <field name="name"/>
                                    <field name="amount"/>
                                    <field name="bysal"/>
                                    <field name="flag"/>
                                </tree>
                            </field>
                        </page>
                        <page string="Letter Content">
                            <group colspan="4" col="6">
                              <field name="company_id" on_change="onchange_company_id(company_id)"/>
                              <field name="chaque_nos"/>
                              <field name="bank"/>
                            </group>
                            <separator colspan="4" string="Letter Details"/>
                            <field name="note" colspan="4" nolabel="1"/>
                        </page>
                    </notebook>
                    <group col="6" colspan="6">
                        <field name="state"/>
                        <button name="confirm_sheet"  icon="gtk-apply" string="Confirm Sheet" states="draft" type="object"/>
                        <button name="set_to_draft" string="Set to Draft"  icon="gtk-convert"  states="cancel,confirm" type="object"/>
                        <button name="cancel_sheet" string="Cancel Sheet" states="draft" icon="gtk-cancel"  type="object"/>
                    </group>
                </form>
            </field>
        </record>
        <record id="action_view_hr_bank_advice_tree" model="ir.actions.act_window">
            <field name="name">Payment Advice</field>
            <field name="res_model">hr.payroll.advice</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="view_hr_bank_advice_tree"/>
        </record>
        <menuitem
            action="action_view_hr_bank_advice_tree"
            id="hr_menu_payment_advice"
            parent="menu_hr_root_payroll"
        />

        <record id="view_hr_payroll_register_tree" model="ir.ui.view">
            <field name="name">hr.payroll.register.tree</field>
            <field name="model">hr.payroll.register</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree  colors="blue:state in ('draft');black:state in ('confirm','new','hr_check','accont_check');gray:state in('done','cancel')" string="Payroll Register">
                    <field name="number"/>
                    <field name="name"/>
                    <field name="date"/>
                    <field name="journal_id"/>
                    <field name="bank_journal_id"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>
        <record id="view_hr_payroll_register_form" model="ir.ui.view">
            <field name="name">hr.payroll.register.form</field>
            <field name="model">hr.payroll.register</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Payroll Register">
                    <group col="6" colspan="4">
                        <field name="name" select="1"/>
                        <field name="date" select="1"/>
                        <field name="number" select="1"/>
                        <field name="journal_id"/>
                        <field name="bank_journal_id"/>
                        <field name="active"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Payslips">
                            <field name="line_ids" colspan="4" nolabel="1">
                                <tree colors="blue:state in ('draft');black:state in ('confirm','new','hr_check','accont_check');gray:state in('done','cancel')" string="Payslip">
                                    <field name="number"/>
                                    <field name="employee_id"/>
                                    <field name="name"/>
                                    <field name="date"/>
                                    <field name="basic"/>
                                    <field name="allounce"/>
                                    <field name="grows"/>
                                    <field name="deduction"/>
                                    <field name="net"/>
                                    <field name="state"/>
                                </tree>
                            </field>
                            <group col="2" colspan="2">
                                <separator colspan="4" string="Allowance / Deduction"/>
                                <field name="allounce"/>
                                <field name="deduction"/>
                            </group>
                            <group col="2" colspan="2">
                                <separator colspan="4" string="Salary Information"/>
                                <field name="grows"/>
                                <field name="net"/>
                            </group>
                        </page>
                    </notebook>
                    <group col="8" colspan="4">
                        <field name="state"/>
                        <button string="Compute" name="compute_sheet" states="new" icon="terp-document-new" type="object"/>
                        <button string="Verify Sheet" icon="gtk-ok" name="verify_sheet" states="draft" type="object"/>
                        <button string="Complete HR Checking"  icon="gtk-apply" name="final_verify_sheet" type="object" states="hr_check"/>
                        <button string="Pay Salary" icon="gtk-apply"  name="process_sheet" states="confirm" type="object" />
                        <button string="Cancel" name="cancel_sheet" icon="gtk-cancel" states="draft,hr_check,accont_check,confirm" type="object"/>
                        <button string="Set to Draft" name="set_to_draft" states="cancel" type="object" icon="gtk-convert" />
                    </group>
                </form>
            </field>
        </record>
        <record id="action_view_hr_payroll_register_form" model="ir.actions.act_window">
            <field name="name">Payroll Register</field>
            <field name="res_model">hr.payroll.register</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>
        <menuitem
            action="action_view_hr_payroll_register_form"
            id="hr_menu_payroll_register"
            parent="menu_hr_root_payroll"
        />

        <!--
        Contribution Register
        -->
        <record id="hr_contibution_register_tree" model="ir.ui.view">
            <field name="name">hr.contibution.register.tree</field>
            <field name="model">hr.contibution.register</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Contribution Registers">
                    <field name="name" select="1"/>
                    <field name="company_id" select="1"/>
                    <field name="monthly_total_by_emp"/>
                    <field name="monthly_total_by_comp"/>
                    <field name="yearly_total_by_emp"/>
                    <field name="yearly_total_by_comp"/>
                </tree>
            </field>
        </record>
        <record id="hr_contibution_register_form" model="ir.ui.view">
            <field name="name">hr.contibution.register.form</field>
            <field name="model">hr.contibution.register</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Contribution">
                    <field name="name" select="1"/>
                    <field name="account_id"/>
                    <field name="analytic_account_id" groups="base.group_extended"/>
                    <field name="company_id" select="1"/>
                    <notebook colspan="4">
                        <page string="Contribution Lines">
                            <field colspan="4" name="register_line_ids" nolabel="1" select="1">
                                <tree string="Register Lines" editable="top">
                                    <field name="code"/>
                                    <field name="employee_id"/>
                                    <field name="period_id"/>
                                    <field name="emp_deduction"/>
                                    <field name="comp_deduction"/>
                                    <field name="total"/>
                                </tree>
                             </field>
                         </page>
                         <page string="Description">
                            <separator colspan="4" string="Description"/>
                            <field name="note" colspan="4" nolabel="1"/>
                        </page>
                    </notebook>
                    <group col="2" colspan="2">
                        <separator colspan="4" string="Year"/>
                        <field name="yearly_total_by_emp"/>
                        <field name="yearly_total_by_comp"/>
                    </group>
                    <group col="2" colspan="2">
                        <separator colspan="2" string="Month"/>
                        <field name="monthly_total_by_emp"/>
                        <field name="monthly_total_by_comp"/>
                    </group>
                </form>
            </field>
        </record>
        <record id="action_contibution_register_form" model="ir.actions.act_window">
            <field name="name">Contibution Register</field>
            <field name="res_model">hr.contibution.register</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="hr_contibution_register_tree"/>
        </record>
        <menuitem
            id="menu_action_hr_contibution_register_form"
            action="action_contibution_register_form"
            parent="payroll_configure"
        />
        <record id="hr_contibution_register_line_form" model="ir.ui.view">
            <field name="name">hr.contibution.register.line.form</field>
            <field name="model">hr.contibution.register.line</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Contribution">
                      <field name="name"/>
                      <field name="code"/>
                      <field name="employee_id"/>
                      <field name="period_id"/>
                      <field name="emp_deduction"/>
                      <field name="comp_deduction"/>
                      <field name="total"/>
                </form>
            </field>
        </record>

        <record id="hr_payslip_line_condition_tree" model="ir.ui.view">
            <field name="name">hr.payslip.line.condition.tree</field>
            <field name="model">hr.payslip.line.condition</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <form string="Condition">
                    <field name="name"/>
                    <field name="date_start"/>
                    <field name="date_end"/>
                    <field name="state"/>
                </form>
            </field>
        </record>
    </data>
</openerp>

