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

        <record id="hotel_checkin_partner_view_form" model="ir.ui.view">
            <field name="name">hotel.checkin.partner.view.form</field>
            <field name="model">hotel.checkin.partner</field>
            <field name="inherit_id" ref="hotel.hotel_checkin_partner_view_form"/>
            <field name="arch" type="xml">
              <xpath expr="//field[@name='partner_id']" position="before">
                  <field name="document_type"/>
                  <field name="document_number"/>
                  <field name="lastname"/>
                  <field name="firstname"/>
              </xpath>
                <xpath expr="//field[@name='exit_date']" position="after">
                  <field name="document_expedition_date"/>
                </xpath>
                <xpath expr="//field[@name='reservation_id']" position="after">
                    <field name="gender"/>
                    <field name="birthdate_date"/>
                    <field name="code_ine_id" />
                    <button type="action" class="oe_stat_button"
                        icon="fa-file-pdf-o"
                        name="%(action_report_viajero)d"
                        context="{'partner_id': partner_id,'enter_date': enter_date,
                                  'exit_date': exit_date,'reservation_ids': reservation_id,
                                  'hidden_cardex': True, 'edit_cardex': True }"
                        string="Print in PDF" />
                </xpath>
            </field>
        </record>

        <record id="hotel_checkin_partner_view_tree" model="ir.ui.view">
            <field name="name">hotel.checkin.partner.view.tree</field>
            <field name="model">hotel.checkin.partner</field>
            <field name="inherit_id" ref="hotel.hotel_checkin_partner_view_tree"/>
            <field name="arch" type="xml">
                <xpath expr="//button[@name='action_on_board']" position="before">
                    <button type="action" class="oe_stat_button"
                        icon="fa fa-2x fa-file-pdf-o"
                        name="%(action_report_viajero)d"
                        context="{'partner_id': partner_id,'enter_date': enter_date,
                                  'exit_date': exit_date,'reservation_ids': reservation_id,
                                  'hidden_cardex': True, 'edit_cardex': True }"
                        string="Print in PDF"
                        attrs="{'invisible': [('state','not in', ('booking','done'))]}"
                        />
                </xpath>
                <xpath expr="//field[@name='partner_id']" position="before">
                    <field name="document_type"/>
                    <field name="document_number" string="Doc. Number"/>
                    <field name="firstname"/>
                    <field name="lastname"/>
                </xpath>
                <xpath expr="//field[@name='partner_id']" position="after">
                    <field name="gender"/>
                    <field name="document_expedition_date" string="Exp. Date"/>
                    <field name="birthdate_date" string="Birthdate" />
                    <field name="code_ine_id" />
                </xpath>
            </field>
        </record>

        <record id="hotel_checkin_partner_reservation_view_tree" model="ir.ui.view">
                <field name="name">hotel.checkin.partner.view.tree</field>
                <field name="model">hotel.checkin.partner</field>
                <field name="inherit_id" ref="hotel.hotel_checkin_partner_reservation_view_tree"/>
                <field name="arch" type="xml">
                        <xpath expr="//field[@name='partner_id']" position="after">
                                <field name="firstname" attrs="{'required': [
                                        ('lastname','==', False)
                                        ]}" />
                                <field name="lastname" attrs="{'required': [
                                        ('firstname','==', False)
                                        ]}" />
                                <field name="document_type"
                                       attrs="{'required': [
                                               ('document_number','!=', False)
                                               ]}" />
                                <field name="document_number" string="Doc. Number" />
                                <field name="document_expedition_date" string="Exp. Date" />
                                <field name="birthdate_date" string="Birthdate" />
                                <field name="code_ine_id" />
                                <field name="gender" />
                        </xpath>
                        <xpath expr="//field[@name='partner_id']" position="attributes">
                                <attribute name="options">{"no_create": True}</attribute>
                                <attribute name="required">False</attribute>
                                <attribute name="string">Search</attribute>
                        </xpath>
                        <xpath expr="//button[@name='action_on_board']" position="before">
                            <button type="action" class="oe_stat_button"
                                icon="fa fa-2x fa-file-pdf-o"
                                name="%(action_report_viajero)d"
                                context="{'partner_id': partner_id,'enter_date': enter_date,
                                          'exit_date': exit_date,'reservation_ids': reservation_id,
                                          'hidden_cardex': True, 'edit_cardex': True }"
                                attrs="{'invisible': [('state','not in', ('booking','done'))]}"/>
                        </xpath>
                        <xpath expr="//field[@name='enter_date']" position="attributes">
                                <attribute name="invisible">True</attribute>
                        </xpath>
                        <xpath expr="//field[@name='exit_date']" position="attributes">
                                <attribute name="invisible">True</attribute>
                        </xpath>
               </field>
        </record>

</odoo>
