<odoo>

<record model="ir.actions.act_window" id="action_view_event_registration_questionnaire">
      <field name="name">Booking Questionnaire</field>
      <field name="res_model">event.registration_questionnaire</field>
      <field name="view_mode">tree,form</field>
      <field name="context">{'search_default_event_registration_id': active_id}</field>
    </record>

<record id="event_registration_questionnaire_search" model="ir.ui.view">
      <field name="name">event_registration_questionnaire.search</field>
      <field name="model">event.registration_questionnaire</field>
      <field name="arch"  type="xml">
        <search string="Search registrant">
          <field name="event_registration_id"/>
        </search>
      </field>
  </record>

  <record model="ir.actions.act_window" id="action_view_event_registration_option_frontoffice">
      <field name="name">Booking Options</field>
      <field name="res_model">event.registration_option</field>
      <field name="view_mode">tree,form</field>
      <field name="domain">[('booking_option_backoffice', '=', False)]</field>
      <field name="context">{'frontoffice':True,'search_default_event_registration_id': active_id,'search_default_booking_option_backoffice': False}</field>
    </record>

<record model="ir.actions.act_window" id="action_view_event_registration_option_backoffice">
      <field name="name">Booking Options Backoffice</field>
      <field name="res_model">event.registration_option</field>
      <field name="view_mode">tree,form</field>
      <field name="domain">[('booking_option_backoffice', '=', True)]</field>
      <field name="context">{'frontoffice':False,'search_default_event_registration_id': active_id,'search_default_booking_option_backoffice': True}</field>
    </record>

<record id="registration_action_orders" model="ir.actions.act_window">
            <field name="name">Sales Orders</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order</field>
            <field name="view_mode">tree,kanban,form,calendar,pivot,graph,activity</field>
            <field name="search_view_id" ref="sale.sale_order_view_search_inherit_sale"/>
            <field name="context">{}</field>
            <field name="domain">[('state', 'not in', ('draft', 'sent', 'cancel'))]</field>
            <field name="help" type="html">
                <p class="o_view_nocontent_smiling_face">
                    Create a new quotation, the first step of a new sale!
                </p><p>
                    Once the quotation is confirmed, it becomes a sales order.<br/> You will be able to create an invoice and collect the payment.
                </p>
            </field>
        </record>

<record id="event_registration_option_search" model="ir.ui.view">
      <field name="name">event_registration_option.search</field>
      <field name="model">event.registration_option</field>
      <field name="arch"  type="xml">
        <search string="Search registrant">
          <field name="event_registration_id"/>
        </search>
      </field>
  </record>

<record id="booking_event_registration_view_form" model="ir.ui.view">
        <field name="name">booking.event.type.view.form.inherit.booking</field>
        <field name="model">event.registration</field>
        <field name="inherit_id" ref="event.view_event_registration_form"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='name']" position="after">
            <field name="firstname" attrs="{'invisible':[('booking_event','!=',True)]}"/>
            </xpath>
            <xpath expr="//group[@name='attendee']" position="inside">
            
            <field name="start_day_individual_booking" widget="date" attrs="{'invisible':[('individual_booking_event','!=',True)]}"/>
            <field name="end_day_individual_booking" widget="date" attrs="{'invisible':[('individual_booking_event','!=',True)]}"/>
            <field name="days_duration" attrs="{'invisible':[('individual_booking_event','!=',True)]}"/>
            <field name="price_individual_booking" attrs="{'invisible':[('individual_booking_event','!=',True)]}"/>
            
            <field name='individual_booking_event' invisible="1"/>

            <field name="gender" attrs="{'invisible':[('booking_event','!=',True)]}"/>
            <field name="age" attrs="{'invisible':[('booking_event','!=',True)]}"/>
            <field name="city" attrs="{'invisible':[('booking_event','!=',True)]}"/>
            <field name="medical_concern" attrs="{'invisible':[('booking_event','!=',True)]}"/>
            <field name="medical_information" attrs="{'invisible':[('booking_event','!=',True)]}"/>
            <field name="medical_contact_name" attrs="{'invisible':[('booking_event','!=',True)]}"/>
            <field name="medical_contact_phone" attrs="{'invisible':[('booking_event','!=',True)]}"/>
            <field name="room_id" attrs="{'invisible':[('booking_event','!=',True)]}"/>
            <field name="train_arrival_date" widget="date" attrs="{'invisible':[('booking_event','!=',True)]}"/>
            <field name="train_arrival_time" widget="float_time" attrs="{'invisible':[('booking_event','!=',True)]}"/>
            <field name="image_permission"  attrs="{'invisible':[('booking_event','!=',True)]}"/>
            
            </xpath>
            
            <xpath expr="//div[@name='button_box']" position="inside">
            <t t-if="booking_event" >
                <button name="%(action_view_event_registration_questionnaire)d" type="action"
                        class="oe_stat_button" icon="fa-question" string="Questionnaire" attrs="{'invisible':[('booking_event','!=',True)]}">
                </button>
            </t>
            </xpath>
            <xpath expr="//div[@name='button_box']" position="inside">
            <t t-if="booking_event" >
                <button name="%(action_view_event_registration_option_frontoffice)d" type="action"
                        class="oe_stat_button" icon="fa-bed" string="Options front-office" attrs="{'invisible':[('booking_event','!=',True)]}">
                </button>
            </t>
            </xpath>
            <xpath expr="//div[@name='button_box']" position="inside">
            <t t-if="booking_event" >
                <button name="%(action_view_event_registration_option_backoffice)d" type="action"
                        class="oe_stat_button" icon="fa-bed" string="Options backoffice" attrs="{'invisible':[('booking_event','!=',True)]}">
                </button>
            </t>
            </xpath>
          
            <xpath expr="//button[@name='action_cancel']" position="after">
            
                <button name="action_event_registration_generate_invoice" type="object"
                   string="Generate invoice(s)" attrs="{'invisible':[('booking_event','!=',True)]}">
                </button>
                <button name="action_event_registration_generate_end_of_stay_invoice" type="object"
                   string="Generate end of stay invoice" attrs="{'invisible':[('booking_event','!=',True)]}">
                </button>
                <field name='booking_event' invisible="1"/>
               

                
            </xpath>

            <xpath expr="//group[@name='event']" position="after">
                <group string="Payments" name="payments">
                                <field name="down_payment" attrs="{'invisible':[('booking_event','!=',True)]}"/> 
                                <field name="payment_adjustement" style="color:red" attrs="{'invisible':[('booking_event','!=',True)]}"/>  
                                <field name="invoice_id"/>
                                <field name="end_of_stay_invoice_id" attrs="{'invisible':[('booking_event','!=',True)]}"/>
                                <field name="down_payment_invoice_id" attrs="{'invisible':[('booking_event','!=',True)]}"/>
                                <field name="balance_invoice_id" attrs="{'invisible':[('booking_event','!=',True)]}"/>
                                
                            </group>
            </xpath>

        </field>
</record>



<record model="ir.ui.view" id="event_registration_questionnaire_list" >
      <field name="name">event registration questionnaire List</field>
      <field name="model">event.registration_questionnaire</field>
      <field name="arch" type="xml">
        <tree editable="bottom">
          <field name="question"/>
          <field name="answer"/>
        </tree>
     
      </field>
  </record>

  <record model="ir.ui.view" id="event_registration_option_list" >
      <field name="name">event registration option List</field>
      <field name="model">event.registration_option</field>
      <field name="arch" type="xml">
        <tree editable="bottom">
          
          <field name="booking_option_id"/>
          <field invisible="context.get('frontoffice')" name="booking_option_price"/>
        </tree>
     
      </field>
  </record>

  <record model="ir.ui.view" id="event_registration_option_form" >
      <field name="name">event registration option Form</field>
      <field name="model">event.registration_option</field>
      <field name="arch" type="xml">
        <form>
          <group>
          <field name="booking_option_id"/>
          <field name="selectable_option_ids" invisible="1"/>
         </group>
         
        </form>
     
      </field>
  </record>


  <record id="event_registration_view_kanban" model="ir.ui.view">
        <field name="name">booking.event.registration.kanban.inherit</field>
        <field name="model">event.registration</field>
        <field name="inherit_id" ref="event.event_registration_view_kanban"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='email']" position="after">
            <field name="room_id" attrs="{'invisible':[('booking_event','!=',True)]}" />
            <field name='booking_event' invisible="1"/>
            </xpath>
            <xpath expr="//field[@name='event_ticket_id']" position="after">
            <field name="kanban_color" />
            </xpath>

            <xpath expr="//kanban[@class='o_event_attendee_kanban_view']" position="attributes">
            <attribute name="default_group_by">room_id</attribute>
      
            </xpath>

  
            <xpath expr="/kanban/templates/t[3]/div" position="replace">
            <!-- <attribute name="style">background-color:red</attribute> -->
             <div t-attf-class="oe_kanban_global_click oe_kanban_color_#{record.kanban_color.raw_value} o_event_registration_kanban container-fluid p-0" t-attf-style="background-color:##{record.kanban_color.raw_value};">
                                <div class="row h-100">
                                    <div class="col-9 pr-0">
                                        <div class="oe_kanban_content h-100">
                                            <div class="o_kanban_record_body pt-1 pl-2 h-100 d-flex flex-column">
                                                <b class="o_kanban_record_title"><field name="name"/></b>
                                                <field name="event_id" invisible="context.get('default_event_id')" />
                                                <span attrs="{'invisible': [('partner_id', '=', False)]}">Booked by <field name="partner_id" /></span>
                                                <div id="event_ticket_id" class="o_field_many2manytags o_field_widget d-flex mt-auto">
                                                    <t t-if="record.event_ticket_id.raw_value">
                                                        <div t-attf-class="badge badge-pill o_tag_color_#{(record.event_ticket_id.raw_value % 11) + 1}" >
                                                            <b><span class="o_badge_text"><t t-esc="record.event_ticket_id.value"/></span></b>
                                                        </div>
                                                    </t>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div id="event_attendees_kanban_icons" class="col-3 pl-0">
                                        <t t-call="event_attendees_kanban_icons_desktop"/>
                                        <t t-call="event_attendees_kanban_icons_mobile"/>
                                    </div>
                                </div>
                            </div>
            </xpath>
        </field>
  </record>

  <record id="event_registration_view_tree" model="ir.ui.view">
        <field name="name">booking.event.registration.tree.inherit</field>
        <field name="model">event.registration</field>
        <field name="inherit_id" ref="event.view_event_registration_tree"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='name']" position="after">
            <field name="gender"  invisible="context.get('booking_view')==False"/>
            </xpath>
            <xpath expr="//field[@name='event_ticket_id']" position="replace">
            <field name="online"  invisible="context.get('booking_view')==True"/>
            <!-- <field name="invoice_options" invisible="context.get('booking_view')==False"/>
            <field name="invoice_options_amount" invisible="context.get('booking_view')==False"/>
            <field name="membership_amount" invisible="context.get('booking_view')==False"/>
            <field name="booking_amount" invisible="context.get('booking_view')==False"/>
            <field name="amount_to_be_paid" invisible="context.get('booking_view')==False"/> -->
            <!-- <field name="amount_paid" invisible="context.get('booking_view')==False"/>
            <field name="payment_mode" invisible="context.get('booking_view')==False"/> -->
            <!-- <field name="payment_mode" invisible="context.get('booking_view')==False"/> -->
            
           <field name="room_id"  invisible="context.get('booking_view')==False"/>
            <field name="city" invisible="context.get('booking_view')==False"/>
            <field name="train_arrival_date" invisible="context.get('booking_view')==False" widget="date"/> 
            <field name="train_arrival_time" invisible="context.get('booking_view')==False" widget="float_time"/> 
            <field name="payment_status"/>
            <field name="individual_room" invisible="context.get('booking_view')==False" />
            <field name="image_permission"  invisible="context.get('booking_view')==False"/>
            
            
            

            </xpath>
            <xpath expr="//button[@name='action_confirm']" position="replace">
            </xpath>
            <xpath expr="//button[@name='action_set_done']" position="replace">
            </xpath>
            <xpath expr="//button[@name='action_cancel']" position="replace">
            </xpath>
            <xpath expr="//field[@name='activity_exception_decoration']" position="replace">
            </xpath>


        </field>
</record> 

<record id="view_registration_search" model="ir.ui.view">
        <field name="name">event.registration.search.inherit</field>
        <field name="model">event.registration</field>
        <field name="inherit_id" ref="event.view_registration_search"/>
        <field name="arch" type="xml">
            <xpath expr="//filter[@name='partner']" position="after">
             <filter string="Room" name="room_id" domain="[]" context="{'group_by':'room_id'}"/>
            </xpath>
        </field>
</record>


</odoo>