Odoo Point of Sale + Posbox: how to change a receipt

I need to change the receipt of the point of sale

There are two receipt templates for an Odoo point of sale: XmlReceipt and PosTicket

How I use Posbox, I think I need to change the XmlReceipt. I wonder if there is a way to inherit the original template? I found examples of how to do this using the PosTicket template, but Xmlreceipt does not work the same way.

Any ideas?

Thank.

+1
source share
3 answers

I expand the "PosTicket" template, find the element by t-jquery, replace my data (add "Free" to the product name)

<templates id="template" >
<t t-extend="PosTicket">
    <t t-jquery=".receipt-orderlines .product_line" t-operation="inner">
        <t t-if="orderline.get_reward() and orderline.get_reward().type == 'gift'">Free </t>
        <t t-esc="orderline.get_product().display_name"/>
    </t>
</t>

+2
source

, XmlReceipt PosTicket pos.xml, . XmlReceipt:

<?xml version="1.0" encoding="UTF-8"?>
<templates id="myReceiptTemplate" xml:space="preserve">
    <t t-extend="XmlReceipt">
        "your code here"
    </t>
</templates>
0

Ok, I found a solution. An example of printing the price of a unit with tax included, I wrote my xml as follows:

<?xml version="1.0" encoding="UTF-8"?>
<templates id="myReceiptTemplate" xml:space="preserve">
    <t t-extend="XmlReceipt">
         <t t-jquery="t[t-esc='line.price']" t-operation="replace">
            <t t-esc='line.price_with_tax / line.quantity ' />
        </t>      
    </t>
</templates>
0
source

Source: https://habr.com/ru/post/1681713/


All Articles