2016-05-04 7 views
0

私はOdooでモジュールを開発しています。私はいくつかの詳細を追加するために請求書のレポートを変更する必要があります。qweb t-位置属性の場合

xpathにposition属性を使用し、不具合がリンクされてデフォルトテーブルを非表示にするかどうかを確認します。

<template id="my_invoice" inherit_id="account.report_invoice_document"> 
    <xpath expr="//div[@class='page']/table[@class='table table-condensed']" position="attributes"> 
     <attribute t-if="o.affair_id" name="class">hidden</attribute> 
    </xpath> 
</template> 

これは機能しません。請求書が事件にリンクされていない場合でも、デフォルトのテーブルはすべての請求書に隠されます。

私の2番目のテンプレートで条件が機能するのでわかりません。

<template id="my_invoice2" inherit_id="account.report_invoice_document"> 
    <xpath expr="//div[@class='page']/div[@class='row mt32 mb32']" position="after"> 
     <t t-if="o.affair_id"> 
      <!-- table with my additional detail --> 
     </t> 
    </xpath> 
</template> 

私の英語のために申し訳ありません。私はそれを学んでいます。

答えて

2

は、このいずれかを試してみてください。

<attribute name="t-att-style">'display: none;' if o.affair_id else ''</attribute> 

あるいはこれも:

<attribute name="t-att-class">'hidden' if o.affair_id else ''</attribute> 

それはあなたのケースで役立つことがあります。

+0

t-aff-style作品の最初の解決策、ありがとう; – olive007

+0

魅力的なように働く! –

関連する問題