Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
8896 มุมมอง


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")

อวตาร
ละทิ้ง

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.

ผู้เขียน

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?

ผู้เขียน คำตอบที่ดีที่สุด

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


class product_application(http.Controller):

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มี.ค. 15
3739
0
เม.ย. 25
1388
0
ม.ค. 24
1544
1
พ.ค. 23
10004
2
ก.พ. 24
15128