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

</record>
<record id="sos_grn_view_panel" model="ir.ui.view">
    <field name="name">sos_grn.search</field>
    <field name="model">sos_grn</field>
    <field name="arch" type="xml">
        <search>
        <searchpanel>

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

</searchpanel>
            <field name="grn_no" string="GRN No"/>
            <field name="ir_no" string="IR No"/>
            <field name="iqi_no" string="IQI No"/>
         
        </search>
    </field>
</record>
    <record id="sos_grn_view_tree" model="ir.ui.view">
        <field name="name">sos_grn.view.tree</field>
        <field name="model">sos_grn</field>
        <field name="arch" type="xml">
            <tree>
                
                
                <field name="grn_no"/>
                <field name="grn_date"/>
                <field name="ir_no"/>
               <field name="stores_approval_name" string="Stores Received 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_grn_form_view" model="ir.ui.view">
      <field name="name">Form</field>
        <field name="model">sos_grn</field>
        <field name="arch" type="xml">
        <form>
             <header>
                    <button class="btn btn-primary" type="object"
                            name="action_report_grn_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;">Goods Receipt Note</h2><hr></hr><br></br>  
<group>

<group>
<field name="grn_no"/>
<field name="grn_date"/>
<field name="iqi_no"/>
<field name="ir_no"/>
<field name="received_goods_type"/>
<field name="supplier_name" invisible="received_goods_type != 'Materials'"/>
<field name="service_provider_name" invisible="received_goods_type != 'SFG'"/>
<field name="supplier_invoice_no"/>
<field name="po_no" invisible="received_goods_type != 'Materials'"/>
<field name="wo_no" invisible="received_goods_type != 'SFG'"/>

</group>
<group>


<field name="no_of_parcel"/>
<field name="identification_label"/>
 <field name="no_of_parcel_per_invoice"/>                               
<field name="test_report_no"/>
<field name="approved_selector"/>
</group>
</group>
    <templates>


<br></br>


<table class="table table-bordered">
<thead>
<tr>

<th>Approved Material Stored in</th>
<th>Rejected Material Stored in</th>
<th>Inspection Remarks</th>
<th>Reworked Process (If any)</th>



</tr>
</thead>
<tbody>
<tr><td><field name="approved_storage_location"/></td><td><field name="rejected_storage_location"/></td><td><field name="inspection_remarks"/></td><td><field name="reworked_process"/></td>
</tr>
</tbody>
</table>
<br></br>

<table class="table table-bordered" invisible="received_goods_type != 'Materials'">
<thead>
<tr>

<th>Responsiveness</th>
<th>Reports</th>
<th>Delivery</th>
</tr>
</thead>
<tbody>
<tr>
    <td><field name="responsiveness"/></td>
    <td><field name="reports"/></td>
    <td><field name="delivery"/></td>
</tr>

</tbody>
</table>
<br></br>
</templates>
<notebook>
<page string="Materials" invisible="received_goods_type != 'Materials'">
<field name="line_ids" widget="one2many">
<tree editable="bottom">
<field name="component_id"/>
<field name="unit_price"/>
<field name="invoice_qty"/>
<field name="received_qty"/>
<field name="approved_qty"/>
<field name="rejected_qty"/>
<field name="reworked_qty"/>
<field name="quality_marks"/>
<!-- <field name="delivery"/>
<field name="responsiveness"/>
<field name="reports"/> -->
</tree>
</field>
</page>
<page string="Semi-Finished Goods" invisible="received_goods_type != 'SFG'">
<field name="line_ids_sfg" widget="one2many">
<tree editable="bottom">
<field name="component_id"/>
<field name="received_qty"/>
<field name="invoice_qty"/>
<field name="approved_qty"/>
<field name="rejected_qty"/>
<field name="reworked_qty"/>

<field name="quality_marks"/>
<field name="delivery"/>
<field name="responsiveness"/>
<field name="reports"/>

</tree>
</field>
</page>
<page string="Finished Goods" invisible="received_goods_type != 'FG'">
<field name="line_ids_fg" widget="one2many">
<tree editable="bottom">
<field name="component_id"/>
<field name="received_qty"/>
<field name="invoice_qty"/>
<field name="approved_qty"/>
<field name="rejected_qty"/>
<field name="reworked_qty"/>
</tree>
</field>
</page>
</notebook>
<templates>
<div class="row">
<div class="col-4"></div>
<div class="col-4"></div>

<div class="col-4">
    <!-- First 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>Stores In-Charge</b> <button  string="Approve"  invisible="stores_approval_image" class="btn-primary custom_btn" type="object" name="action_report_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_approval_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>

    </templates>
    </sheet> 
        </form>
        </field>
    </record>
<menuitem id="grn_menu"
              name="Goods Receipt Note (GRN)"
              parent="scg_forms_menu_root" action="action_grn_form_list" groups="sos_inventory.sos_scg_group_manager,sos_inventory.sos_scg_group_user,sos_inventory.sos_management_user"/>
              

</odoo>
