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

    <!-- Form view of hotel service -->
    <record model="ir.ui.view" id="hotel_service_view_form">
        <field name="name">.hotel.service.form</field>
        <field name="model">hotel.service</field>
        <field name="arch" type="xml">
            <form string="Reservation Service">
                <sheet>
                    <h1>
                        <field name="name" readonly="1"/>
                    </h1>
                    <field name="per_day" invisible="1"/>
                    <field name="is_board_service" invisible="1" />
                    <field name="folio_id" invisible="1"/>
                    <field name="company_id" invisible="1"/>
                    <field name="hotel_id" invisible="1"/>
                    <field name="product_id"
                        domain="[('sale_ok', '=', True)]"
                        options="{'create': False, 'create_edit': False}"
                        invisible="1" />
                    <!-- <field name="layout_category_id" groups="sale.group_sale_layout"/> -->
                    <group>
                        <field name="product_qty"
                            attrs="{'readonly': [('per_day','=',True)]}"
                            force_save="1"/>
                    </group>
                    <field name="days_qty" invisible="1"/>
                    <field name="price_unit" invisible="1" />
                    <field name="discount" invisible="1"/>
                    <field name="tax_ids" widget="many2many_tags"
                        invisible="1"/>
                    <field name="price_subtotal" invisible="1"/>
                    <field name="price_tax" invisible="1"/>
                    <field name="price_total" invisible="1"/>
                    <field name="service_line_ids" nolabel="1">
                        <tree string="Days" editable="bottom" >
                            <field name="date" />
                            <field name="day_qty" />
                        </tree>
                    </field>
                </sheet>
            </form>
        </field>
    </record>

    <!-- Tree view of hotel service -->
    <record model="ir.ui.view" id="hotel_service_view_tree">
        <field name="name">.hotel.service.view.tree</field>
        <field name="model">hotel.service</field>
        <field name="arch" type="xml">
           <tree string="Services" editable="bottom"
            decoration-success="is_board_service == True">
                <field name="is_board_service" invisible="1" />
                <field name="to_print" />
                <button type="object" class="oe_stat_button"
                    icon="fa fa-1x fa-bed"
                    name="open_service_lines"
                    attrs="{'invisible':[('is_board_service','=', False)]}" />
                <field name="per_day" invisible="1" readonly="1"/>
                <field name="folio_id" invisible="1"/>
                <field name="company_id" invisible="1"/>
                <field name="hotel_id" invisible="1"/>
                <field name="ser_room_line"
                    attrs = "{'required': [('per_day','=',True)]}" />
                <field name="product_id"
                    domain="[('sale_ok', '=', True)]"
                    options="{'create': False, 'create_edit': False}"/>
                <field name="name"/>
                <field name="product_qty" attrs="{'readonly': [('per_day','=',True)]}" force_save="1"/>
                <button type="object" class="oe_stat_button"
                    icon="fa fa-2x fa-bars"
                    name="open_service_lines"
                    attrs="{'invisible': [('per_day','=',False)]}"/>
                <field name="days_qty" invisible="1"/>
                <field name="price_unit" />
                <field name="discount" />
                <field name="tax_ids" widget="many2many_tags"/>
                <field name="price_subtotal" />
                <field name="price_tax" />
                <field name="price_total" />
                <field name="service_line_ids" invisible="1">
                    <tree string="Days" >
                        <field name="date" />
                        <field name="day_qty" />
                    </tree>
                </field>
            </tree>
        </field>
    </record>

    <!-- search view of hotel service -->
    <record model="ir.ui.view" id="hotel_service_view_search">
        <field name="name">hotel.service.search</field>
        <field name="model">hotel.service</field>
        <field name="arch" type="xml">
            <search string="Reservation Service">
                <field name="name" />
                <field name="product_id"/>
                <field name="product_qty"  />
                <newline />
                <group expand="0" string="Group By...">
                <!--    <filter name="categ_id" string="Catagory"
                        icon="terp-stock_symbol-selection" domain="[]"
                        context="{'group_by':'categ_id'}" /> -->
                </group>
            </search>
        </field>
    </record>


    <!-- Action for hotel service -->
    <record model="ir.actions.act_window" id="action_hotel_services_form">
        <field name="name">Hotel Services</field>
        <field name="res_model">hotel.service</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
    </record>




</odoo>
