Chapter 17 - Odoo 15 Development Book

Customize Customer Receipts

In this section, we will see how to modify the POS customer receipts.


This is the default receipt in POS.

Here we are going to display the customer name below the cashier name in the receipt.

For that, we need to inherit the OrderReceipt template and make our custom changes.

<templates id="template" xml:space="preserve">
   <t t-name="OrderReceipt" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension" owl="1">
       <xpath expr="//t[@t-if='receipt.cashier']" position="after">
           <t t-if="receipt.client">
               <div style="font-weight: bold;">
                   Customer: <t t-esc=""/>

We extended the default OrderReceipt template in odoo, and by using xpath, we added the customer name below the cashier name in the template. The customer name will display a customer is set on the order.

Add the XML file to the assets in the manifest file.


Now, the customer name will be displayed in the receipt if a customer is set on the order.

The customer details are already available in the receipt environment. If we need to display other information that is not already available, then we can override the export_for_printing() function to send more data to the receipt environment. All the information sent from this function will be available in the Qweb template of the receipt.

For demonstration, we are giving loyalty points to the customer on each amount spent, and we need to display the points earned from this order in the receipt. Let 2 points be given for each amount spent.

In the js file,

odoo.define('custom_pos.user_inteface', function(require) {
	"User strict";
	Var models = require('point_of_sale.models');
	models.load_fields("product.product", ['qty_available']);

Here we override the export_for_printing() function, calculate earned points from subtotal, and pass it to the receipt environment as earned_points.

In the XML file,

<t t-name="ProductItem" t-inherit="point_of_sale.ProductItem" t-inherit-mode="extension" owl="1">
   <xpath expr="////t[@t-esc='props.product.display_name']" position="after">
       <span>Available Qty: <t t-esc="props.product.qty_available"/></span>

Now, the receipt environment has the key earned_points, which holds the value we passed from the export_for_printing() function. We extend the OrderReceipt template and display it in the appropriate position using xpath.

Now the receipt will look like this.


Odoo POS module helps to run your business operations efficiently. You can manage multiple shops or restaurants using odoo POS. It will be working even if you are offline.

From a development view, it also uses a different architecture since it also needs to be worked offline.

Odoo gives us the option to customize POS applications to our needs. We can customize the POS UI and customer receipts and modify the existing business logic.



Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635



Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.



Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message