Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
3772 Prikazi

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
Opusti

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
Opusti

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
Opusti
Related Posts Odgovori Prikazi Aktivnost
1
maj 25
2959
1
maj 24
2474
1
apr. 24
2106
3
apr. 23
7307
3
maj 22
2250