<?xml version="1.0" encoding="UTF-8"?>
<odoo>
 <record id="action_min_form_list" model="ir.actions.act_window">
    <field name="name">Issue Note</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">sos_min</field>
    <field name="view_mode">tree,form,kanban</field>
    <field name="context">{'create': False}</field>

</record>
    <record id="sos_min_view_tree" model="ir.ui.view">
        <field name="name">sos_min.view.tree</field>
        <field name="model">sos_min</field>
        <field name="arch" type="xml">
            <tree>
                <field name="mon_no"/>
               <field name="min_no"/>
             <field name="mon_created_by" optional="hide"/>
             <field name="ref_no" optional="hide"/>
               <field name="stores_approval_name" string="Stores Approved By" widget="many2one_avatar_user"/>
                <field name="scg_manager_approval_name" string="SCG Manager Approved By" widget="many2one_avatar_user"/>

               
           
<field name="status" widget="badge" decoration-success="status == 'close'" decoration-danger="status == 'open'"/>

<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_min_form_view" model="ir.ui.view">
      <field name="name">Form</field>
        <field name="model">sos_min</field>
        <field name="arch" type="xml">
<form string="Model Form" >
                              <header>
                    <button class="btn btn-primary" type="object"
                            name="action_report_min_btn"><i class="fa fa-print"></i> Print</button>
                   
                 
                            
                </header>
                    <sheet>
                    <widget name="web_ribbon" text="Open" bg_color="bg-danger" invisible="status == 'close'"/>
      <widget name="web_ribbon" text="Closed" bg_color="bg-success" invisible="status == 'open'"/>
      
<h2 style="text-align: center;text-transform: uppercase;text-shadow: 1px 1p 1px #140718;color: #65407c;padding:5px;">Material / SFG / FG <br></br>Issue Note</h2><hr></hr><br></br>  

<table class="table table_custom" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;">
<tr><td><group><field name="material_option"/></group></td>
<td><group><field name="sfg_option"/></group></td>
<td><group><field name="fg_option"/></group></td></tr>
</table>
<br></br>

                        <!-- Topmost Group -->
                        <group>
                            <!-- First Column -->
  
                            <group>
                            <field name="status" invisible="1"/>
                            <field name="mon_no"/>
                                <field name="min_no"/>
                                <field name="indent_ref_no"/>
                                <field name="mon_created_by"/>
                              
                            </group>
                            <!-- Second Column -->
                            <group>
                            <field name="mon_date"/>
                      <field name="min_date"/>
                      <field name="ref_no"/>
                       <field name="order_type" string="Order Type" invisible="1"/>
<field name="auto_load"  invisible="order_type == 'FG' or order_type == 'SFG' or order_type == 'SFG,FG' or order_type == 'FG,SFG'" />
<field name="auto_load_sfg_items" invisible="auto_load == 'fg' or auto_load == False" />
<field name="auto_load_fg_items" invisible="auto_load == 'sfg' or auto_load == False" />
<field name="set_qty" invisible="auto_load == 'fg' or auto_load == False" />
<field name="deliverables_boq_id" groups="sos_inventory.sos_management_user,sos_inventory.sos_scg_group_user" />                  
                      

                            </group>
                        </group>
                        
                
                             <notebook>
                            <page string="Materials" invisible="material_option == False">
                             <div style="display: flex;
    align-items: center;
    float: right;
    margin-bottom: 20px;
    border: solid 1px #ccc;
    padding: 5px;
    font-size: 13px;">
    <div style="width: 10px; height: 10px; background-color: #008818; margin-right: 10px;"></div>
    <span>Issued</span>
    
    <div style="width: 10px; height: 10px; background-color: #9d6801; margin-right: 10px; margin-left: 20px;"></div>
    <span>Partially Issued</span>
    
    <div style="width: 10px; height: 10px; background-color: #212529; margin-right: 10px; margin-left: 20px;"></div>
    <span>Not Issued</span>
</div>

                                <field name="line_ids_material">
<tree editable="bottom" decoration-success="quantity &lt;= issued_quantity and quantity != 0" decoration-warning="quantity &gt; issued_quantity and issued_quantity != 0">

                                         <field name="s_no"/>
                                         <field name="com_type" decoration-info="com_type == 'new'"/>
                                        <field name="component_id" decoration-info="com_type == 'new'" required="com_type == 'exits'" readonly="com_type == 'new'"/>
                                        <field name="material_code"  groups="sos_inventory.sos_scg_group_user"/>
                                        <field name="new_component_id" decoration-info="com_type == 'new'" required="com_type == 'new'" readonly="com_type == 'exits'"/>
                                        <field name="inhand_stock_qty" groups="sos_inventory.sos_scg_group_user"/>
                                        <field name="quantity" readonly = "id != False"/>
                                        <field name="issued_quantity" readonly = "1"/>
                                        <field name="current_issued_quantity"/>
                                        <field name="issued_date"/>
     <field name="comments"/>

                                       
                   </tree>
                                 
                                </field>
   
                            </page>
                            <page string="Semi-Finished Goods" invisible="sfg_option == False">
                                <field name="line_ids_sfg">
                                    <tree editable="bottom">
                                        <field name="component_id"/>
                                        <field name="inhand_stock_qty" groups="sos_inventory.sos_scg_group_user"/>

                                        <field name="quantity"/>
                                        <field name="issued_quantity"/>
                                        <field name="current_issued_quantity"/>
                                        <field name="issued_date"/>
                                         <field name="comments"/>
                 

                                   
                                    </tree>
                                 
                                </field>
   
                            </page>
                            <page string="Finished Goods" invisible="fg_option == False">
                                <field name="line_ids_fg">
                                    <tree editable="bottom">
                                    <field name="component_id"/>
                                        <field name="quantity"/>
                                        <field name="issued_quantity"/>
                                        <field name="current_issued_quantity"/>
                                        <field name="issued_date"/>
                                        <field name="comments"/>
                                        
                          

                                   
                                    </tree>
                                 
                                </field>
   
                            </page>
                            <page string="Miscellaneous" invisible="deliverables_boq_id == False" groups="sos_inventory.sos_management_user,sos_inventory.sos_scg_group_user">
                                <field name="line_ids_miscellaneous">
                                    <tree editable="bottom">
                                    <field name="name"/>
                                        <field name="quantity"/>
                                        <field name="remarks"/>
                                    
                                    </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 style="border-bottom: solid 1px #ccc;" invisible="mon_no">
            <td style="padding: 8px;" class="column"><b>Receiver</b></td>
     
            <td><field name="manual_received_by"/></td>
        </tr>
        <tr style="border-bottom: solid 1px #ccc;">
            <td style="padding: 8px;" class="column"><b>Stores Incharge</b>
                <button string="Approve" invisible="stores_approval_image" class="btn-primary custom_btn" type="object" name="action_stores_esign_btn"></button>
            </td>
            <td><field name="stores_approval_image" widget="image"/></td>
        </tr>
        <tr invisible="stores_approval_image == False">
            <td style="padding: 8px;" class="column"><b>Approved On</b></td>
            <td><field name="stores_approved_on" readonly="1"/></td>
        </tr>
        <tr invisible="stores_approval_image == False">
            <td style="padding: 8px;" class="column"><b>Approved By</b></td>
            <td><field name="stores_approval_name" readonly="1"/></td>
        </tr>
    </table>
</div>

 <div class="col-4">
    <!-- Second Table -->
           <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="receiver_remarks"/></td>
        </tr>
        <tr style="border-bottom: solid 1px #ccc;">
            <td style="padding: 8px;" class="column"><b>Receiver Sign</b>
                <button string="Approve" invisible="receiver_approval_image" class="btn-primary custom_btn" type="object" name="action_receiver_esign_btn"></button>
            </td>
            <td><field name="receiver_approval_image" widget="image"/></td>
        </tr>
        <tr invisible="receiver_approval_image == False">
            <td style="padding: 8px;" class="column"><b>Acknowledged On</b></td>
            <td><field name="receiver_approved_on" readonly="1"/></td>
        </tr>
        <tr invisible="receiver_approval_image == False">
            <td style="padding: 8px;" class="column"><b>Acknowledged By</b></td>
            <td><field name="receiver_approval_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>SCG Manager</b><br></br>
                <button string="Approve" invisible="scg_manager_approval_image" class="btn-primary custom_btn" type="object" name="action_scg_manager_esign_btn"></button>
            </td>
            <td><field name="scg_manager_approval_image" widget="image"/></td>
        </tr>
        <tr invisible="scg_manager_approval_image == False">
            <td style="padding: 8px;" class="column"><b>Approved On</b></td>
            <td><field name="scg_manager_approved_on" readonly="1"/></td>
        </tr>
        <tr invisible="scg_manager_approval_image == False">
            <td style="padding: 8px;" class="column"><b>Approved By</b></td>
            <td><field name="scg_manager_approval_name" readonly="1"/></td>
        </tr>
    </table></div>
</div>
               
                </templates>

                    </sheet>
                </form>
        </field>
    </record>
<menuitem id="min_menu"
              name="Issue Note (IN)"
              parent="scg_forms_menu_root" action="action_min_form_list" groups="sos_inventory.sos_healthcare_user,sos_inventory.sos_finance_user,sos_inventory.sos_scg_group_manager,sos_inventory.sos_scg_group_user,sos_inventory.sos_ce_user,sos_inventory.sos_rd_user,sos_inventory.sos_production_user,sos_inventory.sos_management_user,sos_inventory.sos_logistics_user,sos_inventory.sos_qc_user,sos_inventory.sos_sales_user" />
              

</odoo>
