Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
3783 Visualizações

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
Cancelar

Did you include the xml file in the manifest?

Melhor resposta

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
Cancelar

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.

Melhor resposta

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
mai. 25
2963
1
mai. 24
2486
1
abr. 24
2109
3
abr. 23
7310
3
mai. 22
2254