odoopoint-of-saleodoo-14pos

how to change OrderReceipt in odoo 14


I'm trying to edit the client order receipt at the cashier, so I tried to inherit it and change its content like this: I created a new module, added an xml file in qweb list in manifest, and wrote this in it:

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="custom_order_receipt" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension" owl="1">
    <xpath expr="//div[@class='pos-receipt']" position="replace">
        <div> Hello</div>
    </xpath>
</t>

But this changed nothing on the receipt, I still have the default content. Any help? Thanks.


Solution

  • The problem with my code is that I have pointed on the class in the wrong way, when I changed like this it worked fine : div[hasclass('pos-receipt')], I found the solution searching on odoo source code.

    <?xml version="1.0" encoding="UTF-8"?>
    <templates id="template" xml:space="preserve">
        <t t-name="custom_order_receipt" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension" owl="1">
            <xpath expr="//div[hasclass('pos-receipt')]" position="replace">
                <div> Hello</div>
            </xpath>
        </t>