Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
4634 Lượt xem

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>



Ảnh đại diện
Huỷ bỏ

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

In which version ?

Tác giả

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...

Tác giả Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 21
6559
1
thg 7 24
2778
1
thg 2 24
2993
1
thg 7 23
5156
0
thg 3 24
3940