2017-06-22 46 views
1

我有這樣的一個模板:Odoo檢驗T-原料= 「0」

<template id="id1"> 
<h1>Title</h1> 
<t t-raw="0"/> 
</template> 

,它被稱爲象下面這樣:

<t t-call="id1"> 
<div>Hello<div> 
</t> 

或者這樣:

<t t-call="id1"/> 

問題是,對於第二種類型,HTML中有[]。有沒有辦法檢查「0」是否有任何內容?

編輯:我已經試過

<t t-if="0" t-raw="0"/> 

而且這是行不通的。

+0

您是否嘗試過'' –

+0

我覺得你的santax是錯的 –

+0

請參考https://www.odoo.com/documentation/8.0/reference/qwe b.html –

回答

0

,如果你寫在你的模板不是每當任何模板調用您的模板,然後調用模板的身體是可作爲變量的原始值「0」

例如 模板

<template id="id1"> 
    <h1>Title</h1> 
    <t t-raw="0"/> 
    <h2> content after calling template</h2> 
</template> 

如果你這樣調用

<t t-call="id1"> 
    <div>Hello<div> 
    </t> 

然後輸出會是這樣

<h1>Title</h1> 
<div>Hello<div> 
<h2> content after calling template</h2> 

,如果你這樣調用

 <t t-call="id1"/> 
    <div>Hello<div> 

然後輸出會是這樣

<h1>Title</h1> 
<h2> content after calling template</h2> 
<div>Hello<div> 

我希望這有助於理解這個概念