Skip to Content
Menu
This question has been flagged
1 Reply
3349 Views

Hi,
I need to display the customer name and the customer_id(which is a custom field I have created in res.partner) in the odoo Pos receipt. For that I have loaded the fied customer_id in my js file as follows:

models.load_fields('res.partner',['customer_id']);

And in the receipt I have extended the Orderreceipt as follows:

<templates id="template" xml:space="preserve">
        <t t-extend="OrderReceipt">
                <t t-jquery=".pos-receipt .pos-receipt-contact" t-operation='append'>
                <t t-if='receipt.client'>
                <div style="font-weight:bold;">Customer:<t t-esc='receipt.client'/></div>
                <div style="font-weight:bold;">ID:<t t-esc='receipt.client.customer_id'/></div>
                </t>
                </t>
        </t>
</templates>

In the receipt it displays the customer name, but doesn't display the customer_id that I have loaded. How can I display that?
Thanks in advance.

Avatar
Discard
Best Answer

Hi,

If we need to display a field from the customer record in pos receipt, we can display by calling the function get_client() after loading that field in js file.

In pos receipt

<div style="font-weight:bold;">field label<t t-esc='widget.pos.get_client().your custom field'/></div>

In your case

<div style="font-weight:bold;">field label<t t-esc='widget.pos.get_client().customer_id'/></div>
Hope it helps
Avatar
Discard