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

        <record id="hr_contract_form_in_inherit" model="ir.ui.view">
            <field name="name">hr.contract.form.in.inherit</field>
            <field name="model">hr.contract</field>
            <field name="inherit_id" ref="hr_payroll.hr_contract_form_inherit"/>
            <field name="arch" type="xml">
            <data>
                 <xpath expr="//field[@name='struct_id']" position="after">
                 <group col="2" colspan="2" name="right_column">
                    <separator colspan="2" string="Allowance"/>
                        <field name="driver_salay"/>
                        <field name="house_rent_allowance_metro_nonmetro"/>
                        <field name="supplementary_allowance"/>
                 </group>
                 <group col="2" colspan="2" name="left_column">
                    <separator colspan="2" string="Deduction"/>
                        <field name="tds"/>
                        <field name="voluntary_provident_fund"/>
                        <field name="medical_insurance"/>
                 </group>
                 </xpath>
            </data>
            </field>
        </record>

        <record id="hr_payslip_run_form_inherit" model="ir.ui.view">
            <field name="name">hr.payslip.run.form.inherit</field>
            <field name="model">hr.payslip.run</field>
            <field name="inherit_id" ref="hr_payroll.hr_payslip_run_form"/>
            <field name="arch" type="xml">
            <data>
                <xpath expr="//field[@name='credit_note']" position="after">
                    <newline/>
                    <field name="available_advice"/>
                </xpath>
                 <xpath expr="//button[@string='Set to Draft']" position="after">
                    <button name="create_advice" string="Create Advice" type="object" states="close" />
                 </xpath>
            </data>
            </field>
        </record>

        <record id="hr_payslip_run_search_inherit" model="ir.ui.view">
            <field name="name">hr.payslip.run.search.inherit</field>
            <field name="model">hr.payslip.run</field>
            <field name="inherit_id" ref="hr_payroll.hr_payslip_run_filter"/>
            <field name="arch" type="xml">
            <data>
                <xpath expr="//field[@name='date_end']" position="after">
                    <separator orientation="vertical"/>
                    <filter icon="terp-gtk-go-back-rtl" string="To Advice" domain="[('available_advice','=', False)]" help="Payslip Batches ready to be Adviced"/>
                </xpath>
            </data>
            </field>
        </record>

        <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="arch" type="xml">
                <tree string="Bank Advice">
                    <field name="date"/>
                    <field name="number"/>
                    <field name="name"/>
                    <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                    <field name="bank_id"/>
                    <field name="state"/>
                </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="arch" type="xml">
                <form string="Bank Advice" version="7.0">
                    <header>
                        <button name="confirm_sheet"  string="Confirm Sheet" states="draft" type="object" class="oe_highlight"/>
                        <button name="compute_advice" string="Compute Advice" states="draft" type="object" class="oe_highlight"/>
                        <button name="cancel_sheet" string="Cancel Advice" states="draft"  type="object"/>
                        <button name="set_to_draft" string="Set to Draft" states="cancel,confirm" type="object"/>
                        <div class="oe_right">
                            <field name="state" widget="statusbar" nolabel="1" statusbar_visible="draft"/>
                        </div>
                        <div class="oe_clear"/>
                    </header>
                    <sheet>
                        <group>
                            <label for="Name" class="oe_edit_only" string="Name"/>
                            <h2><field name="name"/></h2>
                            <label for="date" class="oe_edit_only"/>
                            <h2><field name="date"/></h2>
                            <group colspan="3" col="6">
                                <field name="bank_id"/>
                                <field name="number"/>
                            </group>
                        </group>
                        <notebook colspan="4">
                            <page string="Payment Lines">
                                <field name="line_ids" colspan="4" nolabel="1">
                                    <tree string="Payment Lines" editable="bottom">
                                        <field name="employee_id" on_change="onchange_employee_id(employee_id)"/>
                                        <field name="name"/>
                                        <field name="ifsc" invisible="1"/>
                                        <field name="ifsc_code" attrs="{'invisible':[('ifsc','=', False)]}" />
                                        <field name="bysal"/>
                                        <field name="debit_credit"/>
                                    </tree>
                                </field>
                            </page>
                            <page string="Other Information">
                                <group colspan="4" col="6">
                                <field name="company_id" on_change="onchange_company_id(company_id)" groups="base.group_multi_company" widget="selection"/>
                                <field name="chaque_nos"/>
                                <newline/>
                                <field name="neft"/>
                                <field name="batch_id"/>
                                </group>
                                <separator colspan="4" string="Letter Details"/>
                                <field name="note" colspan="4" nolabel="1"/>
                            </page>
                        </notebook>
                    </sheet>
                </form>
            </field>
        </record>

        <record id="view_hr_payroll_advice_filter" model="ir.ui.view">
            <field name="name">hr.payroll.advice.select</field>
            <field name="model">hr.payroll.advice</field>
            <field name="arch" type="xml">
                <search string="Search Payment advice">
                    <group>
                        <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Advices"/>
                        <filter icon="terp-camera_test" string="Confirm" domain="[('state','=','confirm')]" help="Confirm Advices"/>
                        <separator orientation="vertical"/>
                        <field name="date"/>
                        <field name="number"/>
                        <field name="name"/>
                        <field name="bank_id"/>
                        <field name="batch_id"/>
                    </group>
                    <newline/>
                    <group expand="0" string="Group By...">
                        <filter string="Bank" name="bank_id" icon="terp-go-home" context="{'group_by':'bank_id'}"/>
                        <separator orientation="vertical"/>
                        <filter string="Status" name="state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
                        <separator orientation="vertical" />
                        <filter string="Company" name="company_id" groups="base.group_multi_company" icon="terp-go-home" context="{'group_by':'company_id'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="action_view_hr_bank_advice_tree" model="ir.actions.act_window">
            <field name="name">Payment Advices</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"/>
            <field name="search_view_id" ref="view_hr_payroll_advice_filter"/>
        </record>

        <menuitem
            action="action_view_hr_bank_advice_tree"
            id="hr_menu_payment_advice"
            parent="hr_payroll.menu_hr_root_payroll"
        />

        <record id="view_advice_line_form" model="ir.ui.view">
            <field name="name">advice.line.form</field>
            <field name="model">hr.payroll.advice.line</field>
            <field name="arch" type="xml">
                <form string="Advice Lines" version="7.0">
                    <sheet>
                    <label for="advice_id" class="oe_edit_only"/>
                    <h1><field name="advice_id"/></h1>
                        <group>
                            <field name="employee_id" on_change="onchange_employee_id(employee_id)" />
                            <field name="name" />
                            <field name="ifsc" invisible="1"/>
                            <field name="ifsc_code" attrs="{'invisible':[('ifsc','=', False)]}" />
                            <field name="bysal" />
                            <field name="debit_credit" />
                        </group>
                    </sheet>
                </form>
            </field>
        </record>

        <record id="view_res_company_da" model="ir.ui.view">
            <field name="name">res.company.inherit</field>
            <field name="model">res.company</field>
            <field name="inherit_id" ref="base.view_company_form"/>
            <field name="arch" type="xml">
            <data>
                 <page string="Configuration" position="inside">
                    <group name="rule" string="Payroll">
                        <field name="dearness_allowance"/>
                    </group>
                 </page>
            </data>
            </field>
        </record>

        <!--  Shortcuts -->

        <act_window name="Payslips"
            domain="[('advice_id', '=', active_id)]"
            res_model="hr.payslip"
            src_model="hr.payroll.advice"
            view_id ="hr_payroll.view_hr_payslip_tree"
            id="act_hr_emp_payslip_list"
         />

    </data>
</openerp>
