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

    <record id="channel_backend_view_form" model="ir.ui.view">
        <field name="name">channel.backend.form</field>
        <field name="model">channel.backend</field>
        <field name="arch" type="xml">
            <form string="Hotel Channel Backend">
                <header>
                  <button name="synchronize_push_urls"
                    type="object"
                    class="oe_highlight"
                    string="Synchronize Push URL's"/>
                </header>
                <sheet>
                    <label for="name" class="oe_edit_only"/>
                    <h1>
                        <field name="name" class="oe_inline" />
                    </h1>
                    <group name="channel" string="Channel Configuration">
                        <notebook>
                            <page string="API" name="api">
                                <group colspan="4" col="4">
                                    <field name="version" colspan="2"/>
                                    <field name="server" colspan="2"/>
                                    <field name="username" colspan="2"/>
                                    <field name="passwd" password="1" colspan="2"/>
                                </group>
                            </page>
                            <page string="Security" name="security">
                                <group colspan="4" col="4">
                                    <field name="security_token" colspan="4"/>
                                    <button colspan="1" name="generate_key"
                                            string="Generate New Token" type="object"
                                            class="oe_edit_only" />
                                </group>
                            </page>
                        </notebook>
                    </group>
                    <notebook>
                        <page name="import" string="Imports">
                            <group>
                                <label string="Import Reservations" class="oe_inline"/>
                                <div>
                                    <button name="import_reservations"
                                        type="object"
                                        class="oe_highlight"
                                        string="Import in background"/>
                                </div>
                            </group>
                            <group>
                                <label string="Import Reservations in a Range" class="oe_inline"/>
                                <div>
                                    <field name="reservation_from" class="oe_inline" nolabel="1"/>
                                    <field name="reservation_to" class="oe_inline" nolabel="1"/>
                                    <button name="import_reservations_range"
                                        type="object"
                                        class="oe_highlight"
                                        string="Import in background"/>
                                </div>
                            </group>
                            <group>
                                <label string="Import Reservation" class="oe_inline"/>
                                <div>
                                    <field name="reservation_id_str" class="oe_inline" nolabel="1"/>
                                    <button name="import_reservation"
                                        type="object"
                                        class="oe_highlight"
                                        string="Import in background"/>
                                </div>
                            </group>
                            <group>
                                <label string="Import Rooms" class="oe_inline"/>
                                <div>
                                    <button name="import_rooms"
                                        type="object"
                                        class="oe_highlight"
                                        string="Import in background"/>
                                </div>
                            </group>
                            <group>
                                <label string="Import OTA's Info" class="oe_inline"/>
                                <div>
                                    <button name="import_otas_info"
                                        type="object"
                                        class="oe_highlight"
                                        string="Import in background"/>
                                </div>
                            </group>
                            <group>
                                <label string="Import Availability" class="oe_inline"/>
                                <div>
                                    <field name="avail_from" class="oe_inline" nolabel="1"/>
                                    <field name="avail_to" class="oe_inline" nolabel="1"/>
                                    <button name="import_availability"
                                        type="object"
                                        class="oe_highlight"
                                        string="Import in background"/>
                                </div>
                            </group>
                            <group>
                                <label string="Import Restriction Plans" class="oe_inline"/>
                                <div>
                                    <button name="import_restriction_plans"
                                        type="object"
                                        class="oe_highlight"
                                        string="Import in background"/>
                                </div>
                                <label string="Import Restriction Values" class="oe_inline"/>
                                <div>
                                    <field name="restriction_id" class="oe_inline" nolabel="1"/>
                                    <field name="restriction_from" class="oe_inline" nolabel="1"/>
                                    <field name="restriction_to" class="oe_inline" nolabel="1"/>
                                    <button name="import_restriction_values"
                                        type="object"
                                        class="oe_highlight"
                                        string="Import in background"/>
                                </div>
                            </group>
                            <group>
                                <label string="Import Pricelist Plans" class="oe_inline"/>
                                <div>
                                    <button name="import_pricelist_plans"
                                        type="object"
                                        class="oe_highlight"
                                        string="Import in background"/>
                                </div>
                                <label string="Import Pricelist Values" class="oe_inline"/>
                                <div>
                                    <field name="pricelist_id" class="oe_inline" nolabel="1"/>
                                    <field name="pricelist_from" class="oe_inline" nolabel="1"/>
                                    <field name="pricelist_to" class="oe_inline" nolabel="1"/>
                                    <button name="import_pricelist_values"
                                        type="object"
                                        class="oe_highlight"
                                        string="Import in background"/>
                                </div>
                            </group>
                        </page>
                        <page name="export" string="Exports">
                            <group>
                                <label string="Push Availability" class="oe_inline"/>
                                <div>
                                    <button name="push_availability"
                                        type="object"
                                        class="oe_highlight"
                                        string="Export in background"/>
                                </div>
                            </group>
                            <group>
                                <label string="Push Restrictions" class="oe_inline"/>
                                <div>
                                    <button name="push_restriction"
                                        type="object"
                                        class="oe_highlight"
                                        string="Export in background"/>
                                </div>
                            </group>
                            <group>
                                <label string="Push Pricelists" class="oe_inline"/>
                                <div>
                                    <button name="push_pricelist"
                                        type="object"
                                        class="oe_highlight"
                                        string="Export in background"/>
                                </div>
                            </group>
                        </page>
                        <page name="otas" string="OTA's">
                          <field name="ota_ids" nolabel="1">
                              <tree>
                                  <field name="name"/>
                                  <field name="ota_id"/>
                              </tree>
                          </field>
                        </page>
                        <page name="issues" string="Issues">
                          <field name="issue_ids" nolabel="1">
                              <tree>
                                  <field name="section"/>
                                  <field name="internal_message"/>
                                  <field name="channel_message"/>
                                  <field name="date_start"/>
                                  <field name="date_end"/>
                              </tree>
                          </field>
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>

    <record id="channel_backend_view_tree" model="ir.ui.view">
        <field name="name">channel.backend.tree</field>
        <field name="model">channel.backend</field>
        <field name="arch" type="xml">
            <tree string="Channel Backend">
                <field name="name"/>
                <field name="username"/>
            </tree>
        </field>
    </record>

    <record id="action_channel_backend" model="ir.actions.act_window">
        <field name="name">Hotel Channel Backends</field>
        <field name="res_model">channel.backend</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="view_id" ref="channel_backend_view_tree"/>
    </record>

</odoo>
