<?xml version="1.0" encoding="UTF-8"?>
<odoo>
 <record id="action_dc_form_list" model="ir.actions.act_window">
    <field name="name">Delivery Challan</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">sos_dc</field>
    <field name="view_mode">tree,form,kanban</field>
</record>
    <record id="sos_dc_view_tree" model="ir.ui.view">
        <field name="name">sos_dc.view.tree</field>
        <field name="model">sos_dc</field>
        <field name="arch" type="xml">
            <tree>
                
                <field name="dc_no"/>
                 <field name="dc_date"/>
                 <field name="to_station" optional="hide"/>
                 <field name="purpose"/>
                 <field name="purpose_remarks"/>
                 
                 <field name="dc_type"/>
                 <field name="approval_name" string="Prepared By" widget="many2one_avatar_user"/>
            <field name="dept_in_charge_name" string="Department In-Charge" widget="many2one_avatar_user"/>
            <field name="top_management_name" string="Top Management Approved By" widget="many2one_avatar_user"/>
           
                 <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_dc_form_view" model="ir.ui.view">
      <field name="name">Form</field>
        <field name="model">sos_dc</field>
        <field name="arch" type="xml">
  <form string="Model Form">
<header>
<button class="btn btn-primary" type="object"
name="action_report_dc_btn"><i class="fa fa-print"></i> Print</button>


</header>
                    <sheet>
 <h2 style="text-align: center;text-transform: uppercase;text-shadow: 1px 1p 1px #140718;color: #65407c;padding:5px;">Delivery Challan</h2><hr></hr><br></br>  
          <!-- Topmost Group -->
                        <group>
                            <!-- First Column -->
                            
                            <group>
                                
                                <field name="dc_no"/>
                                <field name="dock_audit_no"/>
                                <field name="from_station"/>
                                <field name="dispatch_mode"/>
                               
                                <field name="purpose"/>
                                <field name="purpose_remarks"/>
                                <field name="indent_no"/>
                                <field name="po_no"/>
                                <field name="invoice_no"/>
                      <field name="carried_by"/>
                                <field name="sosaley_gst_no"/>
                            </group>
                            <!-- Second Column -->
                            <group>
                            <field name="dc_date"/>
                            
                                 <field name="dc_type"/> 
                                 <field name="auto_load_sfg_items_domain" invisible="1"/>
                                 <field name="service_provider_name" invisible="dc_type != 'out_souce_return' and dc_type != 'out_souce_noreturn'"/>

                                 <field name="wo_no" invisible="dc_type != 'out_souce_return' and dc_type != 'out_souce_noreturn'"/>
                                 <field name="auto_load_sfg_items" domain="auto_load_sfg_items_domain" invisible="dc_type != 'out_souce_return' and dc_type != 'out_souce_noreturn'" widget="many2many_tags"/>
                                 <field name="order_qty" invisible="dc_type != 'out_souce_return' and dc_type != 'out_souce_noreturn'"/>
                            <field name="to_station"/>
                             <field name="to_address"/>
                             <field name="billing_address"/>
                             <field name="customer_gst_no"/>
                             
                              
                            </group>
                        </group>
                        
                
                          <notebook>
                           <page string="Outsourcing" invisible="dc_type != 'out_souce_return' and dc_type != 'out_souce_noreturn'">
                                <field name="line_ids" readonly="top_management_name">
                                    <tree editable="bottom">
                                    <field name="component_id"/>
                                    <field name="display_name"/>
                                     <field name="uom"/>
                                    <field name="req_qty"/>
                                    <field name="given_qty"/>

                                    </tree>
                                 
                                </field>
                                </page>
                                 <page string="Materials" invisible="dc_type == 'out_souce_return' or dc_type == 'out_souce_noreturn'">
                                <field name="line_ids_materials" readonly="top_management_name">
                                    <tree editable="bottom">
                                    <field name="component_id"/>
                                    <field name="display_name"/>
                                    <field name="uom"/>
                                    <field name="qty"/>

                                    </tree>
                                 
                                </field>
                                </page>
                                <page  string="Semi-Finished Goods" invisible="dc_type == 'out_souce_return' or dc_type == 'out_souce_noreturn'">
                                <field name="line_ids_sfg" readonly="top_management_name">
                                    <tree editable="bottom">
                                    <field name="component_id"/>
                                    <field name="uom"/>
                                    <field name="qty"/>

                                    </tree>
                                 
                                </field>
                                </page>
                                <page string="Finished Goods" invisible="dc_type == 'out_souce_return' or dc_type == 'out_souce_noreturn'">
                                <field name="line_ids_fg" readonly="top_management_name">
                                   <tree editable="bottom">
                                   
                                    <field name="component_id"/>
                                    <field name="serial_no"/>
                                    <field name="uom"/>
                                    <field name="qty"/>

                                    </tree>
                                 
                                </field>
                                </page>
                          <page string="Miscellaneous">
                                <field name="line_ids_miscellaneous" readonly="top_management_name">
                                    <tree editable="bottom">
                                    <field name="description"/>
                                    <field name="qty"/>
                                    <field name="uom"/>

                                    </tree>
                                 
                                </field>
                                </page>
                                
                                </notebook>

    <br></br>
    <templates>
<div class="row">
<div class="col-4">
<table class="table_custom" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;background-color: #fff;border: solid 4px #9689c1;">
      <tr>
            <td style="padding: 8px;" class="column"><b>Remarks</b></td>
            <td><field name="remarks"/></td>
        </tr>
    <tr style="border-bottom: solid 1px #ccc;">
            <td style="padding: 8px;" class="column"><b>Prepared by Sign</b><br></br><br></br>
                <button string="Approve" invisible="approval_image" class="btn-primary custom_btn" type="object" name="approved_by_sign_btn"></button>
            </td>
            <td><field name="approval_image" widget="image"/></td>
        </tr>
        <tr invisible="approval_image == False">
            <td style="padding: 8px;" class="column"><b>Prepared On</b></td>
            <td><field name="approval_name" readonly="1"/></td>
        </tr>
        <tr invisible="approval_image == False">
            <td style="padding: 8px;" class="column"><b>Prepared By</b></td>
            <td><field name="approved_on" readonly="1"/></td>
        </tr>
    </table>
</div>
<div class="col-4">
<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>Dept Incharge Sign</b><br></br><br></br>
                <button string="Approve" invisible="dept_in_charge_image" class="btn-primary custom_btn" type="object" name="deptincharge_sign_btn"></button>
            </td>
            <td><field name="dept_in_charge_image" widget="image"/></td>
        </tr>
        <tr invisible="dept_in_charge_image == False">
            <td style="padding: 8px;" class="column"><b>Approved On</b></td>
            <td><field name="dept_in_charge_approved_on" readonly="1"/></td>
        </tr>
        <tr invisible="dept_in_charge_image == False">
            <td style="padding: 8px;" class="column"><b>Approved By</b></td>
            <td><field name="dept_in_charge_name" readonly="1"/></td>
        </tr>
    </table></div>
<div class="col-4">


<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>Top Management</b><br></br><br></br>
                <button string="Approve" invisible="top_management_approval_image" class="btn-primary custom_btn" type="object" name="action_top_esign"></button>
            </td>
            <td><field name="top_management_approval_image" widget="image"/></td>
        </tr>
        <tr invisible="top_management_approval_image == False">
            <td style="padding: 8px;" class="column"><b>Approved On</b></td>
            <td><field name="top_management_approved_on" readonly="1"/></td>
        </tr>
        <tr invisible="top_management_approval_image == False">
            <td style="padding: 8px;" class="column"><b>Approved By</b></td>
            <td><field name="top_management_name" readonly="1"/></td>
        </tr>
    </table>
</div>
</div>
    </templates>
                    </sheet>
                </form>
        </field>
    </record>
<menuitem id="delivery_challan_menu"
              name="Delivery Challan (DC)"
              parent="scg_forms_menu_root" action="action_dc_form_list"  groups="sos_inventory.sos_healthcare_user,sos_inventory.sos_scg_group_manager,sos_inventory.sos_logistics_user,sos_inventory.sos_scg_group_user,sos_inventory.sos_management_user,sos_inventory.sos_finance_user,sos_inventory.sos_sys_admin_user"/>
              

</odoo>
