跳至內容
選單
此問題已被標幟
2 回覆
3774 瀏覽次數

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.

頭像
捨棄

Did you include the xml file in the manifest?

最佳答案

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

頭像
捨棄

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.

最佳答案

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)" />



頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
5月 25
2959
1
5月 24
2477
1
4月 24
2107
3
4月 23
7309
3
5月 22
2251