This question has been flagged
4 Replies
7246 Views


When I add website.layout to my templates I get the following error

QWebException: "'NoneType' object has no attribute 'name'" while evaluating
'res_company.name'

the template code:

<template id="index" >
<t t-call="website.layout">
<t t-set="title">Academy</t>
<div class="oe_structure">
<div class="container">
<ul><t t-foreach="brands" t-as="b">
<li><a t-attf-href="/pa/{{b.id}}">
<t t-esc="b.name"/>
</a></li>
</t></ul>
</div>
</div>
</t>
</template>
from openerp import fields, models

class Brand(models.Model):
_name = 'product_application.brand'

name = fields.Char()
models_ids = fields.One2many('product_application.model', 'brand_id', string="Models")


class Model(models.Model):
_name = 'product_application.model'

name = fields.Char()
brand_id = fields.Many2one('product_application.brand', string="Brand")
versions_ids = fields.One2many('product_application.version', 'model_id', string="Versions")


class Version(models.Model):
_name='product_application.version'

name = fields.Char()
model_id = fields.Many2one('product_application.model',string="Model")

Avatar
Discard

Here res_company is object of the res.company model. But, any how it is not set inside your template. There are so many reasons that res_company having "none" i.e. access rights issue, dependancy issue etc... Can you explain more on your error ? Thanks.

Author

I can't explain more the error becouse I'm new in odoo, what do you need to debug? I don't put any reference to company object, why is asking for it?

Author Best Answer

fter lot of reading I discover that controler need website = True


class product_application(http.Controller):

@http.route('/pa/', auth='public', website=True)

Avatar
Discard