2016-06-28 36 views
0

我有一个简单的控制器时,显示人们在网站上评论与他们的图片。一切工作正常,除非图像不出现时,用户注销。Odoo t字段图像显示为空公共

这里是我的控制器

@http.route('/page/homepage', type='http', auth='public', website=True) 
def comment_list(self): 
    comments = request.env['erp.comment'].sudo().search([], limit=10) 
    values = { 
     'user': comments, 
    } 
    return request.website.render('website.homepage', values) 

,这里是XML内容

 <div class="ocomment-avatar"> 
      <span t-field="p.image" t-field-options="{&quot;widget&quot;: &quot;image&quot;, &quot;class&quot;: &quot;img-rounded&quot;}"/> 
     </div> 

回答

0

使用img标签。 像

<span> 
    <img t-att-src="'p.image'" t-att-class="'img-rounded'" t-att-widget="'image'" /> 
</span> 

希望它会帮助你。

+0

不工作只是img图标出现我试图用span替换img并删除另外两个span。那也没有奏效 –

0

我发现问题,这是由于安全原因,我添加了模块的开放访问规则。它的工作!