<?xml version="1.0" encoding="utf-8" ?>
<odoo>

    <template id="report_stock_scrap_value_document">
        <t t-call="web.html_container">
            <t t-call="web.external_layout">
                <div class="page">
                    <h1 class="mt0 float-left">Scrap <t t-esc="scrap.name" /></h1>
                    <div class="clearfix" />
                    <table class="table table-sm">
                        <thead>
                            <tr>
                                <th class="text-center"><strong>Location</strong></th>
                                <th t-if="scrap.origin" class="text-center"><strong
                                    >Source Document</strong></th>
                                <th class="text-center"><strong>State</strong></th>
                                <th class="text-center"><strong>Date</strong></th>
                            </tr>
                        </thead>
                        <tbody>
                            <t t-foreach="scrap.move_ids" t-as="move">
                                <tr>
                                    <td class="text-start">
                                        <span
                                            t-field="move.scrap_id.location_id.name"
                                        />
                                    </td>
                                    <td t-if="move.scrap_id.origin" class="text-center">
                                        <span t-field="scrap.origin" />
                                    </td>
                                    <td class="text-center">
                                        <span t-field="move.scrap_id.state" />
                                    </td>
                                    <td name="td_sched_date" class="text-center">
                                        <span t-esc="move.date" />
                                    </td>
                                </tr>
                            </t>
                        </tbody>
                    </table>
                    <br />
                    <br />
                    <t t-call="stock_move_value_report.stock_move_lines_value">
                        <t
                            t-set="move_lines"
                            t-value="scrap.mapped('move_ids').mapped('move_line_ids')"
                        />
                        <t t-set="currency_id" t-value="res_company.currency_id" />
                    </t>
                    <br />
                    <t t-call="stock_move_value_report.stock_move_lines_value_total">
                        <t
                            t-set="move_lines"
                            t-value="scrap.mapped('move_ids').mapped('move_line_ids')"
                        />
                        <t t-set="currency_id" t-value="res_company.currency_id" />
                    </t>
                </div>
            </t>
         </t>
    </template>

    <template id="report_stock_scrap_value">
        <t t-foreach="docs" t-as="scrap">
            <t t-call="stock_move_value_report.report_stock_scrap_value_document" />
        </t>
    </template>

</odoo>
