Odoo Point of Sale + Posbox : How to modify receip

2019-02-20 02:45发布

I need to modify the receipt of Point of sale

In Odoo point of sale, the are two templates to print receipt : XmlReceipt and PosTicket

As I use a Posbox I guess I have to modify XmlReceipt. I wonder if there is a way to inherit the original template ? I found examples on how to do it with PosTicket template but Xmlreceipt doesnt seem to work the same way.

Any ideas ?

Thank you.

标签: openerp
3条回答
女痞
2楼-- · 2019-02-20 03:08

Ok, I found a solution. Example to print the unit price with tax included, I wrote my xml like this :

<?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>
查看更多
贪生不怕死
3楼-- · 2019-02-20 03:14

As far as I know XmlReceipt and PosTicket templates are both defined in pos.xml so you can inherit both of them in a same way. Example of inheriting XmlReceipt:

<?xml version="1.0" encoding="UTF-8"?>
<templates id="myReceiptTemplate" xml:space="preserve">
    <t t-extend="XmlReceipt">
        "your code here"
    </t>
</templates>
查看更多
等我变得足够好
4楼-- · 2019-02-20 03:22

I extends template "PosTicket", find element by t-jquery, replace with my data (Add "Free" to product's 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>

查看更多
登录 后发表回答