what's causing this issue in my custom Odoo 12 report

by JNewbie   Last Updated June 30, 2020 04:26 AM

I created a custom qweb report in Odoo 12 but I have been having this single issue.

Basically, I created a custom module that shows some data in tree view after the user selects a year to filter the data. It stores the filtered data in a table and then display it on a tree view. It works just fine. But when I print it through the custom report, I have this error show up.

Error to render compiling AST
AttributeError: 'NoneType' object has no attribute '_fields'
Template: web.external_layout_standard
Path: /templates/t/div[3]/div/div/span[3]
Node: <span t-field="o.user_id"/>

I don't have the <span t-field="o.user_id"/> in my report template so perhaps I am looking at the wrong place? Can anybody help me please?

Report Template

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <template id="report_consumption">
        <t t-call="web.html_container">
            <t t-call="web.external_layout">
                <div class="page">
                    <style>
                        .table thead tr th,
                        .table tbody tr td {
                            font-size: 0.8em;
                            text-align: right;
                            border-right: 1px solid #efefef;
                        }
                        .table thead tr th {
                            font-weight: bold;
                        }
                    </style>
                    <h2 style="text-align: center;">Stock Consumption Report</h2>
                    <h5 style="text-align: center;">Report Date: <strong><span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d %H:%M')"/></strong></h5>
                    <table class="table table-sm">
                        <thead>
                            <tr>
                                <th style="text-align: left;">Product Name</th>
                                <th style="text-align: left;">Category</th>
                                <th>Min Qty</th>
                                <th>Max Qty</th>
                                <th>Jan</th>
                                <th>Feb</th>
                                <th>Mar</th>
                                <th>Apr</th>
                                <th>May</th>
                                <th>Jun</th>
                                <th>Jul</th>
                                <th>Aug</th>
                                <th>Sep</th>
                                <th>Oct</th>
                                <th>Nov</th>
                                <th>Dec</th>
                                <th>Month Avg</th>
                                <th>On-Hand Qty</th>
                                <th>Forecast Qty</th>
                                <th>Months Available</th>
                            </tr>
                        </thead>
                        <tbody>
                        <t t-foreach="docs" t-as="o">
                            <tr>
                                <td style="text-align: left;"><span t-field="o.name"/></td>
                                <td style="text-align: left;"><span t-field="o.categ_id"/></td>
                                <td><span t-field="o.min_qty" t-options='{"widget": "float", "precision": 0}'/></td>
                                <td><span t-field="o.max_qty" t-options='{"widget": "float", "precision": 0}'/></td>
                                <td><span t-field="o.jan"/></td>
                                <td><span t-field="o.feb"/></td>
                                <td><span t-field="o.mar"/></td>
                                <td><span t-field="o.apr"/></td>
                                <td><span t-field="o.may"/></td>
                                <td><span t-field="o.jun"/></td>
                                <td><span t-field="o.jul"/></td>
                                <td><span t-field="o.aug"/></td>
                                <td><span t-field="o.sep"/></td>
                                <td><span t-field="o.oct"/></td>
                                <td><span t-field="o.nov"/></td>
                                <td><span t-field="o.dec"/></td>
                                <td><span t-field="o.month_avg" t-options='{"widget": "float", "precision": 0}'/></td>
                                <td><span t-field="o.on_hand" t-options='{"widget": "integer"}'/></td>
                                <td><span t-field="o.on_hand_virtual" t-options='{"widget": "integer"}'/></td>
                                <td><span t-field="o.avail_stock" t-options='{"widget": "float", "precision": 2}'/></td>
                            </tr>
                        </t>
                        </tbody>
                    </table>
                </div>
            </t>
        </t>
    </template>
</odoo>

Report Declaration

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <report
            id="action_report_stock_consumption"
            model="stock.consumption"
            string="Stock Consumption"
            report_type="qweb-pdf"
            name="stock_consumption.report_consumption"
            file="stock_consumption.report_consumption"
            print_report_name="Stock Consumption Report"
        />
    </data>
</odoo>
Tags : odoo-12 qweb


Related Questions


Get user location from Odoo Website

Updated August 22, 2015 20:11 PM


ODOO my header doesn't appears in my custom report

Updated October 25, 2017 08:26 AM

Bootstrap don't work in my pdf report in Odoo 10?

Updated October 15, 2019 11:26 AM

create group by button in tree view

Updated March 02, 2018 17:26 PM