2016-06-28 47 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

我發現問題,這是由於安全原因,我添加了模塊的開放訪問規則。它的工作!