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


 <record id="action_sos_order_delivery_plan_form_list" model="ir.actions.act_window">
    <field name="name">Order Delivery Plan</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">sos_order_delivery_plan</field>
    <field name="view_mode">tree,form,kanban</field>

</record>
<record id="sos_order_delivery_plan_view_panel" model="ir.ui.view">
<field name="name">sos_order_delivery_plan.search</field>
<field name="model">sos_order_delivery_plan</field>
<field name="arch" type="xml">
<search position="inside">

 <field name="sales_id" string="Sales Order No"/>
</search>

</field>
</record>
    <record id="sos_order_delivery_plan_view_tree" model="ir.ui.view">
        <field name="name">sos_order_delivery_plan.view.tree</field>
        <field name="model">sos_order_delivery_plan</field>
        <field name="arch" type="xml">
            <tree>
            <field name="sales_id"/>
            <field name="customer_name"/>
                 <field name="customer_po_no"/>

                 <field name="lead_time"/>
                 <field name="final_cost"/>
  <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_order_delivery_plan_form_view" model="ir.ui.view">
      <field name="name">Form</field>
        <field name="model">sos_order_delivery_plan</field>
        <field name="arch" type="xml">
<form string="Model Form">

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

    <group>

    <group>
    <field name="sales_id"/>
    <field name="fg_name"/>
    <field name="quantity"/>
    </group>
    <group>
    <field name="customer_name"/>
    <field name="lead_time"/>
    <field name="customer_po_no"/>
    <field name="customer_po_date"/>
    </group>
    </group>
<notebook>
<page string="Accessories">

    <div class="new_header">Finished Goods</div>
     <field name="line_ids_fg">
    <tree editable="bottom" create="false">
    <field name="fg_code"/>
    <field name="fg_name"/>
    <field name="quantity"/>
    <field name="unit_price"/>
    <field name="total_price"/>
    </tree>
    </field>
    <group colspan="2"
    class="oe_subtotal_footer oe_right">

    <label for="total_cost"/>
    <field name="total_cost" nolabel="1"
    sum="Total amount" widget="monetary"/>
    </group>
 
        <div class="new_header">Semi-Finished Goods</div>
  
    <field name="line_ids_sfg">
        <tree editable="bottom" create="false">
    <field name="sfg_code"/>
    <field name="sfg_name"/>
    <field name="quantity"/>
    <field name="unit_price"/>
    <field name="assembling_charges"/>
    <field name="total_price"/>
    </tree>
    </field>
     <group colspan="2"
    class="oe_subtotal_footer oe_right">

    <label for="sfg_total_cost"/>
    <field name="sfg_total_cost" nolabel="1"
    sum="Total amount" widget="monetary"/>
    </group>
 
       <div class="new_header">Materials</div>
    <field name="line_ids_material">
        <tree editable="bottom" create="false">
    <field name="material_code"/>
    <field name="material_name"/>
    <field name="quantity"/>
    <field name="unit_price"/>
    <field name="total_price"/>
    </tree>
    </field>
     <group colspan="2"
    class="oe_subtotal_footer oe_right">

    <label for="material_total_cost"/>
    <field name="material_total_cost" nolabel="1"
    sum="Total amount" widget="monetary"/>
    </group>


 
    </page>
    <page string="Spare">
 <div class="new_header">Finished Goods</div>
     <field name="line_ids_fg_spare">
        <tree editable="bottom" create="false">
    <field name="fg_code"/>
    <field name="fg_name"/>
    <field name="quantity"/>
    <field name="unit_price"/>
    <field name="total_price"/>
    </tree>
    </field>
     <group colspan="2"
    class="oe_subtotal_footer oe_right">

    <label for="total_cost_spare"/>
    <field name="total_cost_spare" nolabel="1"
    sum="Total amount" widget="monetary"/>
    </group>
      <div class="new_header">Semi-Finished Goods</div>
  
    <field name="line_ids_sfg_spare">
        <tree editable="bottom" create="false">
    <field name="sfg_code"/>
    <field name="sfg_name"/>
    <field name="quantity"/>
    <field name="unit_price"/>
    <field name="assembling_charges"/>
    <field name="total_price"/>
    </tree>
    </field>
     <group colspan="2"
    class="oe_subtotal_footer oe_right">

    <label for="sfg_total_cost_spare"/>
    <field name="sfg_total_cost_spare" nolabel="1"
    sum="Total amount" widget="monetary"/>
    </group>
      <div class="new_header">Materials</div>
    <field name="line_ids_material_spare">
        <tree editable="bottom" create="false">
    <field name="material_code"/>
    <field name="material_name"/>
    <field name="quantity"/>
    <field name="unit_price"/>
    <field name="total_price"/>
    </tree>
    </field>
     <group colspan="2"
    class="oe_subtotal_footer oe_right">

    <label for="material_total_cost_spare"/>
    <field name="material_total_cost_spare" nolabel="1"
    sum="Total amount" widget="monetary"/>
    </group>

    </page>
   <page string="Installation Kit">
      <field name="line_ids_installation_kit">
        <tree editable="bottom" create="false">
    <field name="material_code"/>
    <field name="material_name"/>
    <field name="quantity"/>
    <field name="unit_price"/>
    <field name="total_price"/>
    </tree>
    </field>
<group colspan="2"
    class="oe_subtotal_footer oe_right">

    <label for="installation_kit_total_cost"/>
    <field name="installation_kit_total_cost" nolabel="1"
    sum="Total amount" widget="monetary"/>
    </group>
 
</page>
<page string="Miscellaneous">
    <field name="line_ids_miscellaneous">
        <tree editable="bottom" create="false">
    <field name="name"/>
    <field name="cost"/>
    <field name="quantity"/>
    <field name="total_price"/>
    </tree>
    </field>
    <group colspan="2"
    class="oe_subtotal_footer oe_right">

    <label for="miscellaneous_total_cost"/>
    <field name="miscellaneous_total_cost" nolabel="1"
    sum="Total amount" widget="monetary"/>
    </group>
 
</page>
</notebook>
   <div class="oe_subtotal_footer new_footer">
<table class="table_custom">
<tr><td>Accessories Cost</td><td>₹ <field name="overall_cost" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_inline"/></td></tr>
<tr><td>Spare Cost</td><td>₹ <field name="overall_cost_spare" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_inline"/></td></tr>
<tr><td>Installation Kit Cost</td><td>₹ <field name="installation_kit_total_cost" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_inline"/></td></tr>
<tr><td>Miscellaneous Cost</td><td>₹ <field name="miscellaneous_total_cost" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_inline"/></td></tr>
<tr><td>Total Cost</td><td style="font-size: 18px;">₹ <field name="final_cost" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_inline"/></td></tr>
</table>

    </div>
 <templates>
   <div class="row" style="margin-top:30px">
  <div class="col-6"> <table  class="table_custom" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;width:100%;color: #000; background-color: #fff; border: solid 4px #9689c1;">
        <tr style="border-bottom: solid 1px #ccc;">
<td colspan="2" class="column" style="background-color: #9689c1;color: #fff;">
    To Be Filled By <span style="font-size: 18px;padding: 0px; color: #ffcc00;">Accounts</span> Team
</td>        </tr>
        <tr>
           <td class="column">Comments</td> <td><field name="accounts_comments"/></td>
 
        </tr>
        <tr>
            <td class="column">Authorised Signatory <button string="Approve" invisible="accounts_reviewed_by_image" class="btn-primary custom_btn" type="object" name="action_accounts_esign_btn"></button></td>
            <td><field name="accounts_reviewed_by_image" widget="image"/></td>
        </tr>
         <tr invisible="accounts_reviewed_by_image == False">
            <td style="padding: 8px;" class="column"><b>Approved On</b></td>
            <td><field name="accounts_reviewed_on" readonly="1"/></td>
        </tr>
        <tr invisible="accounts_reviewed_by_image == False">
            <td style="padding: 8px;" class="column"><b>Approved By</b></td>
            <td><field name="accounts_reviewed_by" readonly="1"/></td>
        </tr>
    </table></div>
  
  <div class="col-6"><table class="table_custom" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;width:100%;color: #000; background-color: #fff; border: solid 4px #9689c1;">
        <tr style="border-bottom: solid 1px #ccc;">
        <td colspan="2" class="column" style="background-color: #9689c1;color: #fff;">
    To Be Filled By <span style="font-size: 18px;padding: 0px; color: #ffcc00;">Top Management</span>
</td>
        </tr>
 <tr>
           <td class="column">Comments</td> <td><field name="top_management_comments"/></td>
 
        </tr>
        <tr>
            <td class="column">Authorised Signatory <button string="Approve" invisible="top_management_reviewed_by_image" class="btn-primary custom_btn" type="object" name="action_top_management_esign_btn"></button></td>
            <td><field name="top_management_reviewed_by_image" widget="image"/></td>
        </tr>
         <tr invisible="top_management_reviewed_by_image == False">
            <td style="padding: 8px;" class="column"><b>Approved On</b></td>
            <td><field name="top_management_reviewed_on" readonly="1"/></td>
        </tr>
        <tr invisible="top_management_reviewed_by_image == False">
            <td style="padding: 8px;" class="column"><b>Approved By</b></td>
            <td><field name="top_management_reviewed_by" readonly="1"/></td>
        </tr>
    </table></div>
  </div>
</templates>



                    </sheet>
                </form>
        </field>
    </record>
<menuitem id="sos_order_delivery_plan_menu"
              name="Order Delivery Plan"
              parent="sales_root_menu" action="action_sos_order_delivery_plan_form_list" groups="sos_inventory.sos_sales_user,sos_inventory.sos_finance_user,sos_inventory.sos_ce_user,sos_inventory.sos_management_user"/>
              

</odoo>
