Skip to Content
Menu
This question has been flagged
4 Replies
3794 Views

I want to add a bank address to a customer invoice. Other fields are ok, but the address is empty.

Any help is appreciate.

<template id="report_invoice_document_inherit" inherit_id="account.report_invoice_document">
    <xpath expr="//p[@t-if='o.fiscal_position_id.note']" position="after">
        <t t-foreach="o.company_id.bank_journal_ids" t-as="journal">
            <t t-set="bank_acc" t-value="journal.bank_account_id"/>
            <t t-if="journal.display_on_footer">
                <div style="witdth: 35%; border-bottom: 1px solid black;" name="bank_address">
                    <br/>Bank: <span t-esc="bank_acc.bank_name"/>
                    <br/>Currency: <span t-esc="bank_acc.currency_id.name"/>
                    <br/>Account number: <span t-esc="bank_acc.acc_number"/>
                    <br/><span t-esc="bank_acc.bank_name"/>
                    <address t-field="bank_acc.bank_id"
                        t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}'/>
                    <br/><t t-if="bank_acc.bank_bic"><span t-esc="bank_acc.bank_bic"/></t>
                </div>
            </t>
        </t>
    </xpath>
</template>



Avatar
Discard

what is the model of bank_id field ? if you do <t t-esc=''bank_acc.bank_id"/> ...

In which version ?

Author

bank_acc - res.partner.bank and bank_acc.bank_id - res.bank

I can see it it invoice if do <span t-esc="bank_acc.bank_id">

Odoo 9.0

What's the output of : <t-esc="bank_acc.bank_id.sudo().with_context(show_address=True).name_get()[0][1]"/>

note sure that widget contact work for other object than res_partner out of the box...

Author Best Answer

Widget contact does not work because of res.bank model has not got fields: mobile, website, country_id (has got 'country') and I do not understand what is the first address that is checked in /base/ir/ir_qweb.xml templette:  <div t-if="address and 'address' in fields">.

I think it's good idea to make all models where address is used compatible with the contact widget.

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 21
5200
1
Jul 24
408
1
Feb 24
418
1
Jul 23
3223
0
Mar 24
1987