Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

How to get value from other database table in Qweb Report?

By
HappyOdoo
on 10/28/15, 12:34 AM 1,391 views

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?

2

Akhil P Sivan

--Akhil P Sivan--
3423
| 5 3 6
Kochi, India
--Akhil P Sivan--

Interested in exploring Odoo both technically & functionality wise.

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
On 10/28/15, 2:39 AM

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?

HappyOdoo
on 10/28/15, 3:28 AM

updated the answer!

Akhil P Sivan
on 10/28/15, 4:16 AM

thank you dear. it's working.

HappyOdoo
on 10/28/15, 5:53 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/28/15, 12:34 AM
Seen: 1391 times
Last updated: 10/28/15, 6:12 AM