How To Customize POS Receipt in Odoo
How To Customize POS Receipt In Odoo
The POS in a shop is a place where a product is passed from the seller to the customer. POS refers to 'point of sale' which as the name suggests means a stock and sales control system. Go through the below mentioned details to know about "How to Customize POS Receipt in Odoo".
In simple words, every time customers visit your shop & buy something or make a transaction, they are basically making a point of sale transaction.
Odoo provides a POS system that is based on a smart interface that any retail company can use easily. It is easy to use and a user can easily set up shops/stores anywhere & anytime.
Odoo POS screen looks something like this:
And the POS receipt or the bill receipt generated by this POS looks something like this:
Now Odoo POS provides us with a provision to customize this POS screen & the POS receipt according to our preferences.
In this blog, we are going to see how we can customize an Odoo POS receipt.
So, before we begin let us run-through some steps we are going to do for the POS receipt customization.
1) Inherit the ‘point_of_sale’ module in Odoo by creating a custom module.
2) Inherit the template of POS receipt in ‘point_of_sale’ module in Odoo.
3) Make the changes in the POS receipt template.
So, let us start.
First of all, we need to inherit the template of POS Receipt from the ‘point_of_sale’ module.
We are using a custom module to customize this POS receipt in Odoo. If you don’t know the process to create a custom module, you can read our below mentioned post.
Read Here : How To Create Custom Module in Odoo
The template for the POS Receipt which comes by default is present in the ‘pos.xml’ file.
This file is present in ‘point_of_sale > static > src > xml’ folder in the point of sale module. Before, version 13, there were separate templates for the receipt that shows up on the screen & the receipt that comes out of the printer.
But in version 13, there is a single template for both: ‘OrderReceipt’. We’ll inherit this template & make our custom changes in this template.
The inheritance of the template is slightly different from what we do in the inheritance of the qweb where we use ‘<xpath>’ to give path for inheritance.
Here, we’ll use ‘<t-extend>’ to give the path of the template we are inheriting.
And we’ll use ‘<t-jquery>’ and ‘<t-operation>’ to apply the changes.
In this case, we’ll try to change the POS receipt and add the customer name to the POS receipt if a customer is selected at the screen for that order.
< ---- Code Starts ---- >
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-jquery=".pos-receipt .pos-receipt-contact" t-operation='append'>
<div>Client:<t t-esc='receipt.client' /></div>
< ---- Code Ends ---- >
In the Above Code:
1) templates id= “template” ; because we are inheriting the template record.
2)<t t-extend="OrderReceipt"> ; Extending the template ‘OrderReceipt’.
3) <t t-jquery=".pos-receipt .pos-receipt-contact" t-operation='append'> ; Mentioning the name of the class that we are applying operation on, in this case we have to inherit the ‘pos-receipt-contact’ class of the ‘pos-receipt’ class. And mention the operation that we need to perform. In this case, we are adding the ‘client name’ to the ‘pos-receipt-contact’ class so we’ll use ‘append’.
4) <div>Client:<t t-esc='receipt.client' /></div> ; Adding the Client name to the receipt.
"Important Note: In case, you want to change the whole layout of the receipt, you can use operation ‘replace’ on the class ‘pos-receipt’."
Now the xml file is done. Next step is to make sure that the ‘__manifest__.py’ file is configured properly.
< ----- Code Starts ----->
'name': 'POS Custom Receipt',
'category': 'Point Of Sale',
'summary': 'Customized Receipt of Point Of Sales',
'author': 'Kanak Infosystems LLP.',
'depends': ['base', 'point_of_sale'],
< ---- Code Ends ---->
After the ‘__manifest__.py’ file is done, the module is ready to be installed. Just install the module & you can see that the POS receipt is inherited & the client/customer name would be showing where we added the field.
Thus, we can easily customize the POS receipt in Odoo following these simple steps.
Check out the Custom POS Receipt Module that provides the customization, we have discussed above. This module inherits the POS receipt & add the client details to the receipt.
You can Hire Professional Odoo Developers from Kanak Infosystems to get assistance regarding uploading this module in your Odoo system.