<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <template id="report_shelflife_expiry">
        <t t-call="web.html_container">
            <t t-call="web.external_layout">
                <div class="page">
                    <h2>Materials Expiring Within 7 Days</h2>
                    <p>Report generated on: <span t-field="docs[0].write_date" t-options='{"format": "MM/dd/YYYY"}'/></p>
                    <table class="table table-condensed">
                        <thead>
                            <tr>
                                <th>Material Name</th>
                                <th>Quantity</th>
                                <th>Expiry Date</th>
                                <th>Remaining Days</th>
                            </tr>
                        </thead>
                        <tbody>
                            <t t-foreach="docs" t-as="record">
                                <tr>
                                    <td><span t-field="record.name"/></td>
                                    <td><span t-field="record.quantity"/></td>
                                    <td><span t-field="record.expiry_date"/></td>
                                    <td><span t-field="record.remaining_days"/></td>
                                </tr>
                            </t>
                        </tbody>
                    </table>
                </div>
            </t>
        </t>
    </template>

    <record id="action_shelflife_expiry_report" model="ir.actions.report">
        <field name="name">Shelf Life Expiry Report</field>
        <field name="model">sos_shelflife_register</field>
        <field name="report_type">qweb-pdf</field>
        <field name="report_name">sos_inventory.report_shelflife_expiry</field>
        <field name="report_file">sos_shelflife_expiry_report</field>
    </record>
</odoo>