<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2023 Moduon Team S.L.
     License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0) -->
<data>
    <template id="report_picking" inherit_id="stock.report_picking">
        <xpath expr="//span[@t-field='ml.product_uom_id']" position="after">
            <div
                t-if="ml.move_id.product_packaging_id"
                class="text-secondary"
                groups="product.group_stock_packaging"
            >
                <t
                    t-set="ml_packaging_qty"
                    t-value="(ml.qty_done if o.state == 'done' else ml.reserved_uom_qty) / ml.move_id.product_packaging_id.qty"
                />
                <span t-field="ml.move_id.product_packaging_id" />:
                <span
                    t-out="ml_packaging_qty"
                    t-options="{'widget': 'float', 'decimal_precision': 'Product Unit of Measure'}"
                />
            </div>
        </xpath>
    </template>

    <template id="report_delivery_document" inherit_id="stock.report_delivery_document">
        <!-- DOCS https://github.com/orgs/OCA/discussions/111 -->
        <xpath
            expr="//table[@name='stock_move_table']/tbody//td[
                1 + count(
                    //table[@name='stock_move_table']
                    //th[@name='th_sm_ordered']
                    /preceding-sibling::*
                )
            ]"
            position="inside"
        >
            <div
                t-if="move.product_packaging_id"
                class="text-secondary"
                groups="product.group_stock_packaging"
            >
                <span t-field="move.product_packaging_id" />:
                <span
                    t-field="move.product_packaging_qty"
                    t-options="{'widget': 'float', 'decimal_precision': 'Product Unit of Measure'}"
                />
            </div>
        </xpath>

        <xpath
            expr="//table[@name='stock_move_table']/tbody//td[
                1 + count(
                    //table[@name='stock_move_table']
                    //th[@name='th_sm_quantity']
                    /preceding-sibling::*
                )
            ]"
            position="inside"
        >
            <div
                t-if="move.product_packaging_id"
                class="text-secondary"
                groups="product.group_stock_packaging"
            >
                <span t-field="move.product_packaging_id" />:
                <span
                    t-field="move.product_packaging_qty_done"
                    t-options="{'widget': 'float', 'decimal_precision': 'Product Unit of Measure'}"
                />
            </div>
        </xpath>
    </template>

    <template
        id="stock_report_delivery_aggregated_move_lines"
        inherit_id="stock.stock_report_delivery_aggregated_move_lines"
    >
        <xpath expr="//td[@name='move_line_aggregated_qty_ordered']">
            <div
                t-if="aggregated_lines[line]['product_packaging']"
                class="text-secondary"
                groups="product.group_stock_packaging"
            >
                <span
                    t-esc="aggregated_lines[line]['product_packaging'].display_name"
                />:
                <span
                    t-esc="aggregated_lines[line]['product_packaging_qty']"
                    t-options="{'widget': 'float', 'decimal_precision': 'Product Unit of Measure'}"
                />
            </div>
        </xpath>

        <xpath expr="//td[@name='move_line_aggregated_qty_done']">
            <div
                t-if="aggregated_lines[line]['product_packaging']"
                class="text-secondary"
                groups="product.group_stock_packaging"
            >
                <span
                    t-esc="aggregated_lines[line]['product_packaging'].display_name"
                />:
                <span
                    t-esc="aggregated_lines[line]['product_packaging_qty_done']"
                    t-options="{'widget': 'float', 'decimal_precision': 'Product Unit of Measure'}"
                />
            </div>
        </xpath>
    </template>

    <template
        id="stock_report_delivery_has_serial_move_line"
        inherit_id="stock.stock_report_delivery_has_serial_move_line"
    >
        <xpath expr="//td[@name='move_line_lot_qty_done']">
            <div
                t-if="move_line.product_packaging_id"
                class="text-secondary"
                groups="product.group_stock_packaging"
            >
                <span t-field="move_line.product_packaging_id" />: <span
                    t-field="move_line.product_packaging_qty_done"
                    t-options="{'widget': 'float', 'decimal_precision': 'Product Unit of Measure'}"
                />
            </div>
        </xpath>
    </template>
</data>
