<?xml version="1.0"?>
<t t-name="mrp.report_mrp_production_components">
    <h3>
        <span>
            Components
        </span>
    </h3>
    <table class="table table-sm">
        <div class="oe_structure"/>
        <t t-set="has_product_barcode" t-value="any(m.product_id.barcode for m in o.move_raw_ids)"/>
        <thead>
            <tr>
                <th>Product</th>
                <th t-if="o.state in ('progress', 'to_close','done')" t-attf-class="{{ 'text-end' if not has_product_barcode else '' }}">Consumed</th>
                <th t-attf-class="{{ 'text-end' if not has_product_barcode else '' }}">To Consume</th>
                <th t-if="has_product_barcode" width="15%" class="text-center">Barcode</th>
            </tr>
        </thead>
        <tbody>
            <tr t-foreach="o.move_raw_ids" t-as="raw_line">
                <td>
                    <span t-field="raw_line.product_id">8 GB RAM</span>
                </td>
                <td t-attf-class="{{ 'text-end' if not has_product_barcode else '' }}" t-if="o.state in ('progress', 'to_close','done')">
                    <div>
                        <span t-field="raw_line.quantity">2</span>
                    </div>
                </td>
                <td t-attf-class="{{ 'text-end' if not has_product_barcode else '' }}">
                    <span t-field="raw_line.product_uom_qty">25</span>
                    <span t-field="raw_line.product_uom" groups="uom.group_uom">Pieces</span>
                </td>
                <td t-if="has_product_barcode" width="15%" class="text-center">
                    <t t-if="raw_line.product_id.barcode">
                        <span t-field="raw_line.product_id.barcode" t-options="{'widget': 'barcode', 'width': 600, 'height': 100, 'img_style': 'width:100%;height:35px'}">12345678901</span>
                    </t>
                </td>
            </tr>
        </tbody>
    </table>
</t>

