Basically, I have this error show up when I produce a custom qweb report.
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>