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

        <!-- Tree view of hotel reservation -->
        <record model="ir.ui.view" id="view_hotel_toassign_reservation_tree">
            <field name="name">hotel.toassign.reservation.tree</field>
            <field name="model">hotel.reservation</field>
            <field name="arch" type="xml">
                <tree string="Hotel Reservation"
                decoration-muted="state == 'cancelled' and not overbooking"
                decoration-warning="overbooking"
                >
                    <button icon="fa fa-2x fa-thumb-tack"
                        type="object"
                        class="oe_stat_button"
                        id="mark_readed"
                        name="mark_as_readed"
                        attrs="{'invisible':[('to_read','=', False)]}"
                        help="Mark as Read"
                    />
                    <button icon="fa fa-1x fa-chain-broken"
                        type="object"
                        class="oe_stat_button"
                        id="splitted"
                        name="open_master"
                        attrs="{'invisible':[('splitted','=', False)]}"
                    />
                    <field name="state" />
                    <button type="object" class="oe_stat_button"
                        id="go_folio" icon="fa fa-2x fa-file"
                        name="open_folio"
                    />
                    <field name="folio_id"/>
                    <field name="product_id" string="Room"/>
                    <button type="action" class="oe_stat_button"
                        id="reservations_partner" icon="fa fa-2x fa-list-ul"
                        name="%(hotel.open_hotel_reservation_form_tree_all)d"
                        context="{'search_default_partner_id': partner_id}"
                    />
                    <field name="partner_id"/>
                    <field name="splitted" invisible="1" />
                    <field name="parent_reservation" invisible="1" />
                    <field name="virtual_room_id" string="Reserved Room Type"/>
                    <field name="nights" />
                    <field name="to_read" invisible="1"/>
                    <field name="adults" string="Persons"/>
                    <field name="checkin" widget="date"/>
                    <field name="checkout"  widget="date"/>
                    <field name="create_date"/>
                    <field name="overbooking" invisible="1" />
                    <field name="last_updated_res" string="Updated on"/>
                    <field name="origin_sale"/>
                    <field name="overbooking" invisible="1" />
                    <field name="to_assign" invisible="1"/>
                    <!-- cardex_smart_button attrs depends on cardex_pending to be showed -->
                    <field name="cardex_pending" invisible="1"/>
                    <field name="price_unit" string="Reservation Price"/>
                    <field name="discount" groups="sale.group_discount_per_so_line"/>
                    <field name="price_total" string="Final Price"/>
                    <field name="folio_pending_amount" string="Folio Pending Amount"/>
                    <button type="object" class="oe_stat_button"
                        id="cardex_smart_button" icon="fa fa-3x fa-money"
                        name="action_pay_folio"
                        attrs="{'invisible':[('folio_pending_amount','==',0)]}"
                    />
                </tree>
            </field>
        </record>

        <record id="hotel_reservation_view_form" model="ir.ui.view">
        <field name="model">hotel.reservation</field>
        <field name="inherit_id" ref="hotel.view_hotel_reservation_form" />
        <field name="arch" type="xml">
            <xpath expr="//button[@name='unify']" position="after">
                <button name="mark_as_readed" string="Mark as Read"
                    type="object" class="oe_highlight"
                    icon="fa-1x fa-thumb-tack"
                    attrs="{'invisible':[('to_read','=', False)]}"
                />
            </xpath>
        </field>
    </record>
    </data>
</openerp>
