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

                <t t-set="o" t-value="o.with_context(lang=o._get_report_lang())"/>
                <t t-set="partner" t-value="o.partner_id or (o.move_ids and o.move_ids[0].partner_id) or False"/>

                <div class="scissors"/>
                <div class="page" style="page-break-inside: avoid;">
                    <div class="row mt16">
                        <div class="col-auto" name="div_name" t-if="partner">
                            <t t-if="last_first">
                                <strong><span t-field="partner.lastname"/>, <span t-field="partner.firstname"/></strong>
                            </t>
                            <t t-else="">
                                <strong><span t-field="partner.name"/></strong>
                            </t>
                        </div>
                    </div>
                    <table class="table table-sm" name="stock_move_table" style="font-size: smaller">
                        <thead>
                            <tr>
                                <th class="batch text-start" name="th_sm_product_qty"><strong>Batch Size</strong></th>
                                <th class="text-start" name="th_sm_product"><strong>Product</strong></th>
                                <th class="qty text-end" name="th_sm_ordered"><strong>Available</strong></th>
                            </tr>
                        </thead>
                        <tbody>
                            <t t-set="lines" t-value="o.move_ids.filtered(lambda x: x.product_uom_qty)"/>
                            <tr t-foreach="lines" t-as="move">
                                <td class="batch text-truncate">
                                    <t t-foreach="move.product_id.packaging_ids" t-as="packaging">
                                        <span t-esc="packaging.name"/>
                                    </t>
                                </td>
                                <td>
                                    <span t-field="move.product_id.name"/><br/>
                                    <span
                                t-if="move.description_picking != move.product_id.name and move.description_picking != move.product_id.display_name"
                                t-field="move.description_picking"
                            />
                                </td>
                                <td class="text-end">
                                    <span t-field="move.forecast_availability"/>
                                    <span t-field="move.product_uom"/>
                                </td>

                            </tr>
                        </tbody>
                    </table>

                    <div t-if="o.signature" class="mt32 ml64 mr4" name="signature">
                        <div class="offset-8">
                            <strong>Signature</strong>
                        </div>
                        <div class="offset-8">
                            <img t-att-src="image_data_uri(o.signature)" style="max-height: 4cm; max-width: 8cm;"/>
                        </div>
                        <div class="offset-8 text-center">
                            <p t-field="o.partner_id.name"/>
                        </div>
                    </div>
                </div>
    </template>

    <template id="report_ekg_deliveryslip">
        <t t-call="web.html_container">
            <t t-call="web.basic_layout">
                <t t-foreach="docs" t-as="o">
                    <t t-call="nfu_ekg_stock.report_ekg_delivery_document" t-lang="o._get_report_lang()"/>
                </t>
            </t>
        </t>
    </template>

    <template id="report_ekg_deliveryslip_lf">
        <t t-call="web.html_container">
            <t t-call="web.basic_layout">
                <t t-foreach="docs" t-as="o">
                    <t t-set="last_first" t-value="True"/>
                    <t t-call="nfu_ekg_stock.report_ekg_delivery_document" t-lang="o._get_report_lang()"/>
                </t>
            </t>
        </t>
    </template>

</odoo>
