Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
5 Відповіді
14924 Переглядів

hello,

My problem is i have one Qweb report sales.order. now i want to get bank detail using company_id.

how it's possible?

i inherit the module ['sale.order']. when i try get bank detail i use following code in Qweb Report.

<t-field="o.partner_id.acc_number">

this generates error.


is this possible to get data from other table?

Аватар
Відмінити
Найкраща відповідь

Hi,

You may try the following code in your sale order report, to get the account details of customer:

Account number:
<t t-if="o.partner_id.parent_id.bank_ids">
<span t-field="o.partner_id.parent_id.bank_ids.acc_number"/>
</t>
<t t-if="o.partner_id.bank_ids">
<span t-field="o.partner_id.bank_ids.acc_number"/>
</t>

But this works only if it contains only one bank account linked. If multiple bank accounts, you need to iterate in bank_ids using t-foreach like in the case  o.order_line.

If having multiple accounts, you may try the following code:

       <h3> Account Details </h3>
<table>
<thead>
<tr>
<th style="width:20%;"> Bank </th>
<th style="width:20%;"> Account No. </th>

</tr>
</thead>
<tbody>
<t t-if="o.partner_id.parent_id.bank_ids">
                <tr t-foreach="o.partner_id.parent_id.bank_ids" t-as="b">
<td><span t-field="b.bank_name"/></td>
<td><span t-field="b.acc_number"/></td>
</tr>
</t>
<t t-if="o.partner_id.bank_ids">
<tr t-foreach="o.partner_id.bank_ids" t-as="b">
<td><span t-field="b.bank_name"/></td>
<td><span t-field="b.acc_number"/></td>
</tr>
</t>
</tbody>
</table>

Hope this helps.

Аватар
Відмінити
Автор

yes,it's working. if multiple bank account then what should to write in code is it true?

updated the answer!

Автор

thank you dear. it's working.

Найкраща відповідь

What if I want to access wage field from hr.contract from the hr.employee model? What will be the qweb code for it?

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
трав. 24
8419
2
бер. 20
5748
1
квіт. 25
1240
2
бер. 25
1422
4
лист. 24
7107