Odoo Help


QWeb Report Can't Access Company Fields

on 11/16/16, 11:30 AM 1,679 views

I'm trying to change the default header but every field throws a NoneType error. For example, in the code below it says QWebException: "'NoneType' object has no attribute 'logo'" while evaluating"'data:image/png;base64,%s' % company.logo"


<template id="dropoff_confirmation_document">

<t t-call="report.html_container"> <t t-foreach="docs" t-as="o">

<t t-call="report.external_layout">

<div class="header">

<div class="row" style="border-bottom: 1px solid black;">

<div class="col-xs-3 pull-right">

<img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/>

<div t-field="company.partner_id" t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' /> </div>



On 12/15/16, 6:23 AM

In the end, I ended up creating a module to inherit and edit the default header for all documents instead of just one.


Axel Mendoza

--Axel Mendoza--
| 7 8 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
On 11/16/16, 2:36 PM

In Odoo QWeb templates variables resides in the qweb context, that context have all the values that you are pass to the template render and also the values generated during the rendering of the template. If you are not passing the variable company to the render of your template that error is expected. If the company variable that you are expecting is one of the objects used to render the report then you need to refer to it as "o" because that is one of the variables generated in the render of the template in the line:

<t t-foreach="docs" t-as="o">

if that is the case then you need to use it like:

<img t-if="o.logo" t-att-src="'data:image/png;base64,%s' % o.logo" style="max-height: 45px;"/>

Your solution is assuming I have those fields on my object, but I don't. Do I need to declare the res.company model to override it? I am able to inherit it and override it, but then it changes for every report. I need to somehow modify the default header and footer without overriding it for all reports. Also, how did you format your post's code in the grey boxes?

on 11/17/16, 7:46 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 11/16/16, 11:30 AM
Seen: 1679 times
Last updated: 12/15/16, 6:23 AM