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

<record id="event_tag_category_view_form" model="ir.ui.view">
        <field name="name">event_tag_category_view_form_inherit_kalachakra</field>
        <field name="model">event.tag.category</field>
        <field name="inherit_id" ref="event.event_tag_category_view_form" />
        <field name="arch" type="xml">
        <xpath expr="//div[@class='oe_title']" position="after">
        <group>  
                <field name="calendar_id"/>
        </group>
            </xpath>
        </field>
</record>


<record id="kalachakra_event_view_form" model="ir.ui.view">
        <field name="name">event.view.form.inherit.kalachakra</field>
        <field name="model">event.event</field>
        <field name="inherit_id" ref="event.view_event_form" />
        <field name="arch" type="xml">
        <xpath expr="//field[@name='stage_id']" position="before">
                
                <button name="add_event_to_google_agenda" type="object" attrs="{'invisible':[('calendar_event_id','!=',False)]}" string="Add event to google agenda" class="btn btn-warning"/>
                <button name="remove_event_from_google_agenda" attrs="{'invisible':[('calendar_event_id','=',False)]}" type="object" string="Remove event from google agenda" class="btn btn-danger"/>
                 <button name="generate_events" attrs="{'invisible':['|',('generated_events','=',True),'|','|',('frequency','=',False),('end_generation_date','=',False),('parent_event_id','!=',False)]}" type="object" string="generate the events" class="btn btn-primary"/>
                  <button name="remove_generated_events" attrs="{'invisible':['|',('generated_events','=',False),'|','|',('frequency','=',False),('end_generation_date','=',False),('parent_event_id','!=',False)]}" type="object" string="remove generated events" class="btn btn-danger"/>

                <field name="calendar_event_id" invisible="1"/>
                <field name="parent_event_id" invisible="1"/>
                <field name="frequency" invisible="1"/> 
                <field name="end_generation_date" widget="date" invisible="1"/>
                <field name="generated_events" invisible="1"/>
            </xpath>
        
        <xpath expr="//field[@name='tag_ids']" position="after">
                
                        
                    <field name="online_event" attrs="{'invisible':[('booking_event','=',True)]}"/>
                    <field name="free_participation" attrs="{'invisible':[('booking_event','=',True)]}"/>
                    <field name="recurring_event" attrs="{'invisible':[('booking_event','=',True)]}"/>
                    
                    <field name="frequency" attrs="{'invisible':['|',('booking_event','=',True),('recurring_event','=',False)]}"/>
                    <field name="weekly_day" attrs="{'invisible':[('frequency','!=','weekly')]}"/> 
                    <field name="end_generation_date" widget="date" attrs="{'invisible':['|',('booking_event','=',True),('recurring_event','=',False)]}"/> 
                    <field name="parent_event_id" attrs="{'invisible':['|',('booking_event','=',True),('recurring_event','=',False)]}"/>

                    <field name="recurring_event_newsletter_id" attrs="{'invisible':['|',('booking_event','=',True),('recurring_event','=',False)]}"/> 
                    <field name="find_out_more_link"/>
                
            </xpath>

        
        <xpath expr="//page[@name='event_communication']" position="before">
            
                <page string="Participations" name="Participations" attrs="{'invisible':['|',('free_participation','=',True),('booking_event','=',True)]}">
                
                <group style="width:40%%">
                <field name="booking_event" invisible="1"/> 
                <field name="participation_product_id" attrs="{'required': [('free_participation','!=',True),('booking_event','!=',True)]}"/>
                <field name="participation_standard_price" attrs="{'required': [('free_participation','=', False)]}"/>
                <field name="participation_member_price" attrs="{'required': [('free_participation','=', False)]}"/>
                <field name="participation_super_member_price" attrs="{'required': [('free_participation','=', False)]}"/>
                
                </group>
                </page>
                
                <page string="Subscriptions" name="Subscriptions" attrs="{'invisible':['|',('free_participation','=',True),('booking_event','=',True)]}">
                <group style="width:40%%">
                
                <field name="subscription_product_id"/>
                <field name="subscription_standard_price"/>
                <field name="subscription_member_price"/>
                <field name="subscription_super_member_price"/>
                
                </group>
                </page>

                <page string="Online options" name="Online" attrs="{'invisible':['|',('online_event','=',False),('booking_event','=',True)]}">
                <group style="width:80%%">
                
                <field name="online_link" attrs="{'required': [('online_event','=', True)]}"/>
                <field name="online_id"/>
                <field name="online_password"/>
                
                </group>
                </page>

                <page string="Media links" name="Media links">
                <group style="width:80%%">
                
                <field name="media_link_ids">
                <tree editable="bottom">
                <field name="media_link"/>
                </tree>
                </field>
                
                </group>
                </page>

            
            </xpath>
        
        

        </field>
</record>


<record id="kalachakra.view_form_inherit_website" model="ir.ui.view">
        <field name="name">event.view.form.inherit.website.kalachakra</field>
        <field name="model">event.event</field>
        <field name="inherit_id" ref="website_event.event_event_view_form" />
        <field name="arch" type="xml">
        <xpath expr="//button[@name='action_open_badge_editor']" position="replace">
                
            </xpath>
        </field>
</record>

</odoo>
