<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <!-- Tree View -->
    <record id="view_benefit_expense_line_tree" model="ir.ui.view">
        <field name="name">benefit.expense.line.tree</field>
        <field name="model">benefit.expense.line</field>
        <field name="arch" type="xml">
            <tree string="Benefit Expense Lines">
                <field name="family_id"/>
                <field name="branch_id"/>
                <field name="family_category_id"/>
                <field name="start_date" invisible="1"/>
                <field name="end_date" invisible="1"/>
                <field name="meal_card"/>
                <field name="benefit_member_count"/>
                <field name="family_monthly_income"/>
                <field name="family_monthly_meals"/>
                <field name="family_monthly_clotting"/>
                <field name="family_monthly_othaime"/>
                <field name="total_family_expenses"/>
                <field name="researcher_id"/>
                <field name="is_return" optional="hide"/>
                <field name="return_reason_id" optional="hide"/>
                <field name="payment_order_id" invisible="1"/>
            </tree>
        </field>
    </record>

    <!-- Form View -->
    <record id="view_benefit_expense_line_form" model="ir.ui.view">
        <field name="name">benefit.expense.line.form</field>
        <field name="model">benefit.expense.line</field>
        <field name="arch" type="xml">
            <form string="Benefit Expense Line">
                <header>
                    <button name="action_process_return" string="Process"
                            groups="odex_benefit.group_family_services_manager"
                            type="object"
                            states="waiting_processing"
                            class="oe_highlight"/>
                    <field name="state" widget="statusbar"
                           statusbar_visible="draft,waiting_processing,processing_done"/>
                </header>
                <sheet>
                    <group>
                        <group>
                            <field name="family_id"/>
                            <field name="branch_id"/>
                            <field name="researcher_id"
                                   attrs="{'invisible': [('researcher_id','=',False)]}"/>
                            <field name="family_category_id"/>
                            <field name="meal_card"/>
                            <field name="benefit_member_count"/>
                            <field name="payment_order_id" invisible="1"/>
                            <field name="is_return" attrs="{'invisible': [('is_return', '=', False)]}"/>
                            <field name="return_reason_id" attrs="{'invisible': [('return_reason_id', '=', False)]}"/>
                        </group>
                        <group>
                            <field name="family_monthly_income"/>
                            <field name="family_monthly_meals"/>
                            <field name="family_monthly_clotting"/>
                            <field name="total_family_expenses" readonly="1"/>
                            <field name="family_monthly_othaime"/>
                        </group>
                    </group>
                    <group invisible="1">
                        <field name="start_date"/>
                        <field name="end_date"/>
                    </group>
                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
                    <field name="activity_ids"/>
                    <field name="message_ids" widget="mail_thread"/>
                </div>
            </form>
        </field>
    </record>


    <record id="action_bank_return_benefit_expense" model="ir.actions.act_window">
        <field name="name">Bank Return Processing</field>
        <field name="res_model">benefit.expense.line</field>
        <field name="view_mode">tree,form</field>
        <field name="context">{'create': False}</field>
        <field name="domain">[('state','=','waiting_processing')]</field>
    </record>

    <!-- Action -->
    <record id="action_benefit_expense_line" model="ir.actions.act_window">
        <field name="name">Benefit Expense Lines</field>
        <field name="res_model">benefit.expense.line</field>
        <field name="view_mode">tree,form</field>
    </record>

</odoo>
