<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <!-- Tree View -->
    <record id="view_sos_sales_leads_tree" model="ir.ui.view">
        <field name="name">sos_sales_leads.tree</field>
        <field name="model">sos_sales_leads</field>
        <field name="arch" type="xml">
            <tree>
                <field name="company_name"/>
                  <field name="location"/>
                   <field name="vertical_domain" widget="many2many_tags"/>
                <field name="interested_in"/>
                <field name="lead_generated_by"/>
                <field name="status" decoration-success="status == 'Moved to Customer'"/>
                <field name="write_uid" string="Last Edited By" optional="hide"/>
                <field name="write_date" string="Last Edited On" optional="hide"/>
            </tree>
        </field>
    </record>
<record id="sos_sales_leads_view_panel" model="ir.ui.view">
    <field name="name">sos_sales_leads.search</field>
    <field name="model">sos_sales_leads</field>
    <field name="arch" type="xml">
        <search>
           <searchpanel>

<field name="sales_type" string="Type" icon="fa-list-ul" enable_counters="1"/>

</searchpanel>

            <!-- Add fields to search on -->
            <field name="company_name" string="Company Name"/>
            <field name="vertical_domain" string="Domain/Vertical"/>
            
      
        </search>
    </field>
</record>
    <!-- Form View -->
    <record id="view_sos_sales_leads_form" model="ir.ui.view">
        <field name="name">sos_sales_leads.form</field>
        <field name="model">sos_sales_leads</field>
        <field name="arch" type="xml">
            <form>
                <sheet>
                <header>
                    <button class="btn btn-primary" type="object" invisible="convert_to_customer_btn_display == False" 
                            name="action_convert_to_customer"><i class="fa fa-card"></i> Convert to Customer</button>
                    
                            
                </header>
       <h2 style="text-align: center;text-transform: uppercase;text-shadow: 1px 1p 1px #140718;color: #65407c;padding:5px;">Leads</h2><hr></hr><br></br>  
         
                 <group>
                    <group>
                    <field name="sales_type"/>
                    <field name="lead_generated_by" readonly="source == 'inside_sales'"/>
                        <field name="company_name"/>
                        <field name="convert_to_customer_btn_display" invisible="1"/>
                        <field name="transferred_on" invisible="1"/>
                        <field name="country" invisible="sales_type != 'International'"/>

                        <field name="website_url"/>
                        <field name="linkedin_profile"/>
                        <field name="correspondence_address"/>
                        </group>
                        <group>
                        <field name="interested_in"/>
                        <field name="project_name" invisible="interested_in == 'Product'"/>
                        <field name="products_interested" 
                        options="{'no_create': True, 'no_edit': True, 'no_create_edit': True}"
                        widget="many2many_tags" invisible="interested_in != 'Product'"/>
                        <field name="location"/>
                        <field name="vertical_domain" widget="many2many_tags"/>
                        <field name="source"/>
                        <field name="expo_name" invisible="source != 'expo'"/>
                    </group>
                    </group>
                    <br></br>
                    <h3 style="text-transform: uppercase;
    text-decoration: underline;">Contact Details</h3>
                    
                        <field name="line_ids_contacts">
                            <tree editable="bottom">
                            <field name="set_as_primary"/>
                            <field name="name"/>
                            <field name="dept"/>
                            <field name="email"/>
                            <field name="mobile_number"/>
                            <field name="linkedin_profile"/>
                              <field name="remarks"/>
                            
                            </tree>
                        </field>
                  
                </sheet>
            </form>
        </field>
    </record>

    <!-- Action -->
    <record id="action_sos_sales_leads" model="ir.actions.act_window">
        <field name="name">Leads</field>
        <field name="res_model">sos_sales_leads</field>
        <field name="view_mode">tree,form</field>
    </record>

    <!-- Menu -->
    <menuitem id="menu_sos_sales_leads" name="LEADS" parent="sos_sales_menu_root" action="action_sos_sales_leads" sequence="1" groups="sos_inventory.sos_finance_user,sos_inventory.sos_sales_user,sos_inventory.sos_management_user,sos_inventory.sos_ce_head,sos_inventory.sos_sales_reviewer,sos_inventory.sos_sales_sapl_user"/>
</odoo>
