Динамическая строка, основанная на условии - PullRequest
0 голосов
/ 02 января 2019

В qweb сообщении у меня есть этот код:

<span t-if="o.currency_id.name == 'USD'">
                            <th style="width: 12%;" class="text-right"><t>Unit Price ( USD )</t><br/>Unit Price (USD)</th>
                            <th style="width: 12%;" class="text-right"><t>Amount ( USD ) </t><br/>Amount (USD) <span t-esc="get_currency_codes()"/></th>
                        </span>
                        <span t-if="o.currency_id.name == 'EUR'">
                            <th style="width: 12%;" class="text-right"><t>Unit Price ( EUR )</t><br/>Unit Price (EUR)</th>
                            <th style="width: 12%;" class="text-right"><t>Amount ( EUR ) </t><br/>Amount (EUR) <span t-esc="get_currency_codes()"/></th>
                        </span>

Но как я могу сделать строку динамической в ​​зависимости от валюты?

1 Ответ

0 голосов
/ 03 января 2019

Это позволит вам установить динамическое имя валюты. <span t-field="o.currency_id.name"/>

Вы можете попробовать это:

<th style="width: 12%;" class="text-right">
    <t>Unit Price (<span t-field="o.currency_id.name"/>)</t><br/>
    Unit Price (<span t-field="o.currency_id.name"/>)
</th>
<th style="width: 12%;" class="text-right">
    <t>Amount (<span t-field="o.currency_id.name"/>)</t><br/>
    Amount (<span t-field="o.currency_id.name"/>) <span t-esc="get_currency_codes()"/>
</th>
...