<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <!-- Tree View -->
       <record model="ir.ui.view" id="sos_case_diary_graph">
                               <field name="name">sos.case.diary.graph</field>
                               <field name="model">sos_case_diary</field>
                               <field name="type">graph</field>
                               <field name="arch" type="xml">
                                   <graph string="Example" type="bar">
                                   <field name="sales_person" group="True"/>                                    
                                   </graph>
                               </field>
                            </record>
    <record id="view_sos_case_diary_tree" model="ir.ui.view">
        <field name="name">sos.case.diary.tree</field>
        <field name="model">sos_case_diary</field>
        <field name="arch" type="xml">
            <tree>
                <field name="status" widget="badge" decoration-success="status == 'open'" decoration-warning="status == 'close'"/>
                  <field name="quote_no"/>
                <field name="customer_name"/>
                <field name="sales_person" widget="many2one_avatar_user"/>
                <field name="interested_in"/>
                <field name="spenco_status"/>
                <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_case_diary_view_panel" model="ir.ui.view">
    <field name="name">sos_case_diary.search</field>
    <field name="model">sos_case_diary</field>
    <field name="arch" type="xml">
        <search>
            <searchpanel>
                <field name="products" string="Products" icon="fa-list-ul" enable_counters="1"/>
                <field name="ce_product_type" string="Type" icon="fa-list-ul" enable_counters="1" groups="sos_inventory.sos_ce_head,sos_inventory.sos_finance_user,sos_inventory.sos_management_user"/>

            </searchpanel>

            <!-- Add fields to search on -->
            <field name="sales_person" string="Sales Person"/>
            <field name="customer_name" string="Customer Name"/>
      
        </search>
    </field>
</record>
    <!-- Form View -->
    <record id="view_sos_case_diary_form" model="ir.ui.view">
        <field name="name">sos.case.diary.form</field>
        <field name="model">sos_case_diary</field>
        <field name="arch" type="xml">
            <form>
            <header>          
            <field name="spenco_status" widget="statusbar"/>
            <button name="action_transfer_sales_person" string="Transfer" type="object" class="oe_highlight"/>

            </header>
                <sheet>
                 <h2 style="text-align: center;text-transform: uppercase;text-shadow: 1px 1p 1px #140718;color: #65407c;padding:5px;">Case Diary</h2><hr></hr><br></br>  

                 <group>
                    <group>
                        <field name="status"/>
                          <field name="quote_no"/>
                        <field name="customer_name"/>
                         <field name="end_customer_name"/>

                        <field name="customer_city"/>
                        <field name="correspondence_address"/>
                         <field name="sales_person"/>
                         <field name="lead_generated_by"/>
                        <field name="lead_generated_by_others" invisible="lead_generated_by != 'Others'"/>
                        <field name="inside_sales_person" invisible="lead_generated_by != 'Inside Sales'"/>
                       
                        </group>
                        <group>
                        <field name="account_start_date" widget="month"/>
                        
                        
                        <field name="interested_in"/>
                        <field name="project_name" invisible="interested_in == 'products'"/>
                        <field name="products" invisible="interested_in == 'projects'"/>
                        <field name="ce_product_type" groups="sos_inventory.sos_ce_head,sos_inventory.sos_finance_user,sos_inventory.sos_management_user"/>
                        <field name="proposal_value"/>
                        <field name="currency_id" invisible="1"/>
                        <field name="order_expected_on"/>
                        <field name="quantity"/>
                        
                    </group>
                    </group>

                    <hr></hr>
                    
                           <h3 style="text-transform: uppercase;
    text-decoration: underline;">Customer 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"/>
                            
                            </tree>
                        </field>
                    <notebook>
<hr></hr>

                    <page string="Action">
                     <field name="line_ids" options="{'no_create': True, 'no_edit': True, 'no_delete': True}" readonly="1">
                    <tree>
                    <field name="spenco_status"/>
                    <field name="status_changed_on"/>
                    <field name="action_type"/>
                    <field name="action_plan_date"/>
                    <field name="action_plan"/>
                    <field name="current_state_value"/>
                    <field name="next_action_date"/>
                    <field name="notes"/>
                    </tree>
                                 
                                </field>
                    </page>
                    <page string="Purchase Order">
                    <group><field name="po_no"/></group>
                    <br></br>
                     <field name="po_copy" widget="pdf_viewer" filename="po_copy_filename"/>
                                <field name="po_copy_filename" invisible="1"/>
                    </page>
                    <page string="Approval">
                <div class="col-4">
                <h5>Witness For Commercial Order</h5>
                <table class="table_custom" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;background-color: #fff;border: solid 4px #9689c1;">        <tr style="border-bottom: solid 1px #ccc;">
                <td style="padding: 8px;" class="column"><b>Department In-Charge</b>
                <br></br><br></br>
                <button string="Approve" invisible="dept_incharge_approval_image" class="btn-primary custom_btn" type="object" name="action_deptincharge_esign_btn"></button>
                </td>
                <td><field name="dept_incharge_approval_image" widget="image"/></td>
                </tr>
                <tr invisible="dept_incharge_approval_image == False">
                <td style="padding: 8px;" class="column"><b>Approved On</b></td>
                <td><field name="dept_incharge_approved_on" readonly="1"/></td>
                </tr>
                <tr invisible="dept_incharge_approval_image == False">
                <td style="padding: 8px;" class="column"><b>Approved By</b></td>
                <td><field name="dept_incharge_name" readonly="1"/></td>
                </tr>
                </table>
                </div>
                    </page>
                                <page string="Transfer History">
                <field name="transfer_history_ids" nolabel="1">
                    <tree delete="false" create="false">
                        <field name="previous_sales_person"/>
                        <field name="new_sales_person"/>
                        <field name="transfer_date"/>
                        <field name="status"/>
                        <field name="top_management_name" column_invisible="1"/>
                        <field name="top_management_approval_image" widget="image"/>
                        <button name="action_top_esign_btn" class="btn-primary custom_btn" type="object" string="Approve" invisible="top_management_name"/>
                    </tree>
                </field>
                </page>

                    <page string="Billing &amp; Collection" groups="sos_inventory.sos_finance_user,sos_inventory.sos_management_user">
                    <div class="row">

                    <div class="col-md-5">
                    <h3 style="text-transform: uppercase;
    text-decoration: underline;">Billed</h3>
    <br></br>
                       <field name="line_ids_billed" context="{'default_action_status': 'Billed'}">
        <tree editable="bottom">
            <field name="action_status" column_invisible="1"/>
            <field name="date_of_action"/>
            <field name="value"/>
        </tree>
    </field>
    </div>
     <div class="col-md-2"></div>
     <div class="col-md-5">
     <h3 style="text-transform: uppercase;
    text-decoration: underline;">Collected</h3>
     <br></br>
      <field name="line_ids_collected" context="{'default_action_status': 'Collected'}">
        <tree editable="bottom">
            <field name="action_status" column_invisible="1"/>
            <field name="date_of_action"/>
            <field name="value"/>
        </tree>
    </field>
    </div>
    </div>
                    </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>
 <!-- Form View -->
    <record id="view_sos_case_diary_line_form" model="ir.ui.view">
        <field name="name">sos.case.diary.line.form</field>
        <field name="model">sos_case_diary_line</field>
        <field name="arch" type="xml">
            <form string="Case Diary Line">
           
                <sheet>
                    <group>
                    <group>
                       <field name="spenco_status"/>
                        <field name="status_changed_on"/>
                        <field name="action_type"/>
                        <field name="action_plan_date"/>
                        </group>
                        <group>
                        <field name="action_plan"/>
                        <field name="next_action_date"/>
                        <field name="current_state_value"/>
                        <field name="notes"/>
                        <field name="currency_id" invisible="1"/>
                         
                      </group>
                    </group>

                    

                </sheet>
            </form>
        </field>
    </record>
    <!-- Action -->
    <record id="action_sos_case_diary" model="ir.actions.act_window">
        <field name="name">Case Diary</field>
        <field name="res_model">sos_case_diary</field>
        <field name="view_mode">tree,form,graph</field>
    </record>

<record id="action_spenco_report_salesperson_wizard" model="ir.actions.act_window">
    <field name="name">SPENCO Report</field>
    <field name="res_model">spenco_salespersonwise_wizard</field>
    <field name="view_mode">form</field>
    <field name="target">new</field>
</record>
<record id="action_pipeline_report_wizard" model="ir.actions.act_window">
    <field name="name">Pipeline Report</field>
    <field name="res_model">pipeline_report_wizard</field>
    <field name="view_mode">form</field>
    <field name="target">new</field>
</record>
<record id="action_sales_action_plan_wizard" model="ir.actions.act_window">
    <field name="name">Sales Action Plan Report</field>
    <field name="res_model">action_plan_report_wizard</field>
    <field name="view_mode">form</field>
    <field name="target">new</field>
</record>
<record id="action_sos_suspects_report_wizard" model="ir.actions.act_window">
    <field name="name">Suspects Report</field>
    <field name="res_model">sos_suspects_wizard</field>
    <field name="view_mode">form</field>
    <field name="target">new</field>
</record>
<record id="action_sos_case_diary_report_wizard" model="ir.actions.act_window">
    <field name="name">Case Diary Report</field>
    <field name="res_model">sos_case_diary_report_wizard</field>
    <field name="view_mode">form</field>
    <field name="target">new</field>
</record>
<record id="action_week_summary_wizard" model="ir.actions.act_window">
    <field name="name">SPENCO Movement Summary</field>
    <field name="res_model">week_summary_wizard</field>
    <field name="view_mode">form</field>
    <field name="target">new</field>
</record>
<record id="action_plan_summary_wizard" model="ir.actions.act_window">
    <field name="name">Action Plan Summary Report</field>
    <field name="res_model">action_plan_summary_wizard</field>
    <field name="view_mode">form</field>
    <field name="target">new</field>
</record>
<record id="report_paperformat_landscape" model="report.paperformat">
    <field name="name">A4 Landscape</field>
    <field name="default" eval="False"/>
    <field name="format">A4</field>
    <field name="page_height">0</field>
    <field name="page_width">0</field>
    <field name="orientation">Landscape</field>
    <field name="margin_top">20</field>
    <field name="margin_bottom">20</field>
    <field name="margin_left">10</field>
    <field name="margin_right">10</field>
    <field name="header_line" eval="False"/>
    <field name="dpi">90</field>
</record>
<record id="action_billing_target_report" model="ir.actions.report">
    <field name="name">Billing Target Report</field>
    <field name="model">sos_sales_plan_target</field>
    <field name="report_type">qweb-html</field>
    <field name="report_name">sos_sales.report_billing_target</field>
    <field name="print_report_name">Billing_Target_%(object.financial_year)s</field>
    <field name="paperformat_id" ref="sos_sales.report_paperformat_landscape"/>
</record>
<record id="action_open_business_performance_wizard" model="ir.actions.act_window">
    <field name="name">Business Performance Wizard</field>
    <field name="res_model">sos_business_performance_wizard</field>
    <field name="view_mode">form</field>
    <field name="target">new</field>
</record>


    <!-- Menu -->
    <menuitem id="menu_sos_case_diary" name="CASE DIARY" parent="sos_sales_menu_root" action="action_sos_case_diary" sequence="6"/>
    <menuitem id="menu_sos_spenco_report"
          name=" SPENCO Report"
          parent="sos_sales_report"
          action="action_spenco_report_salesperson_wizard"
          sequence="4"/>
    
           <menuitem id="menu_sos_pipeline_report"
          name=" Pipeline Reports"
          parent="sos_sales_report"
          action="action_pipeline_report_wizard"
          sequence="5"/>
          <menuitem id="menu_sos_action_plan_report"
          name="Action Plan Report"
          parent="sos_sales_report"
          action="action_sales_action_plan_wizard"
          sequence="6"/>
          <menuitem id="menu_spenco_week_summary_report"
          name="SPENCO Movement Summary"
          parent="sos_top_sales_report"
          action="action_week_summary_wizard"
          sequence="7"/>
          <menuitem id="menu_action_plan_summary_report"
          name="Action Plan Summary Report"
          parent="sos_top_sales_report"
          action="action_plan_summary_wizard"
          sequence="8"/>
          <menuitem id="menu_billing_target_report"
          name="Billing Target Report"
          parent="sos_top_sales_report"
          action="action_billing_target_report"
          sequence="9"/>
          <menuitem id="menu_business_performance_report"
          name="Business Performance Report"
          parent="sos_top_sales_report"
          action="action_open_business_performance_wizard"
          sequence="10"/>
    <menuitem id="menu_sos_all_suspects" name="Suspects Report" parent="sos_sales_report" action="action_sos_suspects_report_wizard"/>
<menuitem id="sos_case_diary_report" name="Case Diary Report"
          parent="sos_sales_report"
          action="action_sos_case_diary_report_wizard"/>
</odoo>
