This question has been flagged
2 Replies
1693 Views

I want to replace the env.pos.format_currency_no_symbol(line.price_display_one) line inside the OrderReceipt.xml (see image below)


In my custom module, the xpath expr is:


But the intended change did not took effect.

Avatar
Discard

Did you include the xml file in the manifest?

Best Answer

Hello, JTY

The way you inherit the template is correct.

Please find code in comment.

I hope This will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Discard

So, make sure you define it in the manifest as follows (for odoo 15):

'assets': {
'web.assets_qweb': [
'module/static/src/xml/OrderReceipt.xml',
],
},

And also make sure your xml file should be in “/static/src/xml” path. If everything is ok then upgrade the module.

Best Answer

In pos receipt there is no OrderLineReceipt to inherit.

you can use the div[@class('orderlines') and replace what you want to replace as following

"1.0" encoding="UTF-8"?>    "receipt_template" inherit_id="point_of_sale.template" xml:space="preserve">
"OrderReceipt" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension" owl="1">    "//div[@class('pos-receipt-contact')]" position="inside">        'receipt.client'>       

Clinet:            "receipt.client.name"/>       
           

    "//div[@class('orderlines')]" position="replace">   
"orderlines">        "receipt.orderlines" t-as="line" t-key="line.id">            "isSimple(line)">               
                    "line.product_name_wrapped[0]" />                    "env.pos.format_currency_no_symbol(line.price_display)" class="price_display pos-receipt-right-align"/>               
                "line" />           
            "">               
"line.product_name_wrapped[0]" />                "line" />                "line.display_discount_policy == 'without_discount' and line.price != line.price_lst">                   
"pos-receipt-left-padding">                        "env.pos.format_currency_no_symbol(line.price_lst)" />                        ->                        "env.pos.format_currency_no_symbol(line.price)" />                   
               
                "line.discount !== 0">                   
"pos-receipt-left-padding">                        "env.pos.config.iface_tax_included === 'total'">                            "env.pos.format_currency_no_symbol(line.price_with_tax_before_discount)"/>                                                "">                            "env.pos.format_currency_no_symbol(line.price)"/>                                           
               
                "line.discount !== 0">                   
"pos-receipt-left-padding">                        Discount: "line.discount" />%                   
               
               
"pos-receipt-left-padding">                    "Math.round(line.quantity * Math.pow(10, env.pos.dp['Product Unit of Measure'])) / Math.pow(10, env.pos.dp['Product Unit of Measure'])"/>                    "line.unit_name !== 'Units'" t-esc="line.unit_name" />                    x                    "env.pos.format_currency_no_symbol(line.price_display_one)" />                    "price_display pos-receipt-right-align">                        "env.pos.format_currency_no_symbol(line.price_display)" />



Avatar
Discard