<odoo>
  <record id="action_report_grn" model="ir.actions.report">
        <field name="name">GRN Form</field>
        <field name="model">sos_grn</field>
        <field name="report_type">qweb-pdf</field>
        <field name="report_name">sos_inventory.report_grn</field>
        <field name="report_file">sos_inventory.report_grn</field>
        <field name="binding_model_id" eval="False"/>
        <field name="binding_type">report</field>
    </record>

       <template id="report_grn">
       <t t-call="web.html_container">
       <main>
       
           <t t-foreach="docs" t-as="o">
               <t t-call="web.external_layout">
             <link rel="stylesheet" href="/sos_inventory/static/src/css/style.css" />


                        <div class="page">
                        <h2 style="text-align:center">Goods Receipt Note</h2>
    
            <!-- HTML Table -->
<table class="table table-bordered">
<tbody>
<tr>
<td class="column">Supplier Invoice/DC No</td>
<td class="column">IQI No</td>
<td class="column">GRN No</td>
<td class="column">GRN Date</td>
<td class="column">Supplier Name</td>
</tr>

<t t-foreach="docs" t-as="doc">
<tr>
<td><t t-esc="doc.supplier_invoice_no"/></td>
<td><t t-esc="doc.iqi_no.iqi_no"/></td>
<td><t t-esc="doc.grn_no"/></td>
<td><t t-esc="doc.grn_date"/></td>
<td><t t-esc="doc.supplier_name.supplier_name"/></td>
</tr>
</t>
</tbody>
</table>
<table class="table table-bordered">
<tbody>
<tr>

<td class="column">No. of Bags / Boxes/ Barrels/Rolls Received</td>
<td class="column">No. of Bags/ Boxes/ Barrels/Rolls as per Invoice</td>
<td class="column">Identification Label affixed post inspection</td>
<td class="column">Our PO No.</td>
<td class="column">Material Received from Approved Supplier</td>
<td class="column">Material Final Inspection Test Report No and Date</td>



</tr>

<t t-foreach="docs" t-as="doc">

<tr>

<td><t t-esc="doc.no_of_parcel"/></td>
<td><t t-esc="doc.no_of_parcel_per_invoice"/></td>
<td><t t-esc="doc.identification_label"/></td>
<td><t t-esc="doc.po_no.po_no"/></td>
<td><t t-esc="doc.approved_selector"/></td>
<td><t t-esc="doc.test_report_no"/></td>
</tr>
</t>
</tbody>
</table>


<table class="table table-bordered">
<tbody>
<tr>
<td class="column">Material Name</td>
<td class="column">Actual Received Quantity</td>
<td class="column">Quantity as Per Invoice </td>
<td class="column">Approved Quantity</td>
<td class="column">Rejected Quantity</td>
<td class="column">Reworked Quantity (If any)</td>
</tr>

           <t t-foreach="docs" t-as="o">
<t t-foreach="o.line_ids" t-as="line_items">
<tr>
<td><t t-esc="line_items.component_id.part_no"/></td>
<td><t t-esc="line_items.received_qty"/></td>
<td><t t-esc="line_items.invoice_qty"/></td>
<td><t t-esc="line_items.approved_qty"/></td>
<td><t t-esc="line_items.rejected_qty"/></td>
<td><t t-esc="line_items.reworked_qty"/></td>
</tr>
</t>
</t>
</tbody>
</table>
<table class="table table-bordered">
<tbody>
<t t-foreach="docs" t-as="doc">
<tr><td class="column">Reworked Process (If any)</td><td><t t-esc="doc.reworked_process"/></td></tr>
</t>
</tbody>
</table>
<table class="table table-bordered">
<tbody>
<tr>
<td class="column">Approved Material Stored in</td>
<td class="column">Rejected Material Stored in</td>
</tr>

<t t-foreach="docs" t-as="doc">
<tr>
<td><t t-esc="doc.approved_storage_location"/></td>
<td><t t-esc="doc.rejected_storage_location"/></td>
</tr>
</t>
</tbody>
</table>
<table class="table table-bordered">
<tbody>
<tr><td class="column"><b>Inspection Remarks:  Approved / Re work / Rejected</b></td><td><t t-esc="doc.inspection_remarks"/></td></tr>

<t t-foreach="docs" t-as="doc">
<tr>
<td><t t-esc="doc.approved_storage_location"/></td>
<td><t t-esc="doc.rejected_storage_location"/></td>
</tr>
</t>
</tbody>
</table>
                       <table class="table table-bordered">
                <tbody>    
             <tr class="column">
    <td>Prepared by  Stores-RM/PM In charge Sign with Date</td>



</tr>    
<tr>
<td>
<img t-if="o.stores_approval_image" t-att-src="'data:image/png;base64,%s' % (o.stores_approval_image.decode())" alt="Store Approval Sign"/>
</td>
</tr>
</tbody>
</table>
    <!-- <footer style="margin-top:500px">


    <table class="table table-bordered"><tr><td>F #: PUR F (7h)</td><td>P # : QSP-PUR</td><td>Rev #: A</td><td>Page 1 of 1</td><td>Copy – Master /  Copy  /  Superseded</td></tr></table>
     
                    </footer> -->
        </div>
               </t>
           </t>
           </main>
       </t>
   </template>
</odoo>
