<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <template id="report_mrpbom_current_stock_pdf">
        <t t-call="web.html_container">
            <t t-call="web.internal_layout">
                <div class="page">
                    <h2>BOM Current Stock Report</h2>
                    <t t-foreach="docs" t-as="o">
                        <table class="table table-condensed">
                            <thead>
                                <tr>
                                    <th>Location:</th>
                                    <td>
                                        <span t-field="o.location_id.display_name" />
                                    </td>
                                </tr>
                                <tr>
                                    <th>Level</th>
                                    <th>Product</th>
                                    <th>Quantity</th>
                                    <th>Location</th>
                                    <th>Qty Available (Location)</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr style="font-weight: bold;">
                                    <td>0</td>
                                    <td>
                                        <span t-field="o.product_id.display_name" />
                                    </td>
                                    <td>
                                        <span t-field="o.product_qty" />
                                        <span
                                            groups="uom.group_uom"
                                            t-field="o.product_uom_id.name"
                                        />
                                    </td>
                                    <td>
                                        <span />
                                    </td>
                                </tr>
                                <tr t-foreach="o.line_ids" t-as="l">
                                    <td>
                                        <span t-field="l.bom_level" />
                                    </td>
                                    <td>
                                        <span
                                            style="color: white;"
                                            t-esc="'... '*(l.bom_level)"
                                        />
                                        <span t-esc="l.product_id.display_name" />
                                    </td>
                                    <td>
                                        <span t-esc="l.product_qty" />
                                        <span
                                            t-esc="l.product_uom_id.name"
                                            groups="uom.group_uom"
                                        />
                                    </td>
                                    <td>
                                        <span t-field="l.location_id.display_name" />
                                    </td>
                                    <td>
                                        <span t-field="l.qty_available_in_source_loc" />
                                        <span
                                            t-esc="l.product_uom_id.name"
                                            groups="uom.group_uom"
                                        />
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </t>
                </div>
            </t>
        </t>
    </template>
    <record id="action_report_bom_current_stock_pdf" model="ir.actions.report">
        <field name="name">BoM: Current Stock Report PDF</field>
        <field name="model">mrp.bom.current.stock</field>
        <field name="report_type">qweb-pdf</field>
        <field
            name="report_name"
        >mrp_bom_current_stock.report_mrpbom_current_stock_pdf</field>
        <field
            name="report_file"
        >mrp_bom_current_stock.report_mrpbom_current_stock_pdf</field>
        <field name="binding_type">report</field>
    </record>
     <record id="action_report_bom_current_stock_xlsx" model="ir.actions.report">
        <field name="name">BoM: Current Stock Report XLSX</field>
        <field name="model">mrp.bom.current.stock</field>
        <field name="report_type">xlsx</field>
        <field
            name="report_name"
        >mrp_bom_current_stock.report_mrpbom_current_stock_xlsx</field>
        <field name="report_file">mrp_bom</field>
        <field name="binding_type">report</field>
        <field name="attachment_use">False</field>
    </record>
</odoo>
