Enable Dark Mode!
how-to-customize-pos-receipts-in-the-odoo-18.jpg
By: Ayana KP

How to Customize POS Receipts in the Odoo 18

Technical Odoo 18

Odoo 18 comes with a powerful and flexible Point of Sale (PoS) system that enables businesses to streamline their retail operations. One of the key features in the PoS system is the ability to generate receipts for customers. By default, Odoo 18 provides a standard receipt template, but it’s often necessary to customize the receipts to meet your specific business needs. Whether you want to add your company logo, adjust the layout, or include custom information, Odoo 18 Pos module makes it easy to modify the PoS receipt templates.

In this blog, we’ll guide you through the process of customizing PoS receipts in Odoo 18, step by step.

To begin customizing receipts, the first step is to create an XML file within the Static > Src > Xml directory.

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
   <t t-name="custom_pos_receipt.OrderReceipt"
      t-inherit="point_of_sale.ReceiptHeader" t-inherit-mode="extension">
        <xpath expr="//div[hasclass('pos-receipt-contact')]" position="inside">
           <t t-if="props.data.partner.name">
               <div>Client:
                    <t t-esc='props.data.partner.name'/>
               </div>
           </t>
       </xpath>
   </t>
</templates>

This XML snippet adjusts the Point of Sale (PoS) receipt template by adding the client's name below the "Client:" label. It uses XPath to insert the custom content at a designated spot in the parent template. However, before applying this customization, the partner's name needs to be loaded into the header data. To do this, we need to create a JavaScript file and include the following code:

/** @odoo-module */
import { PosOrder } from "@point_of_sale/app/models/pos_order";
import { patch } from "@web/core/utils/patch";
patch(PosOrder.prototype, {
   export_for_printing() {
       const result = super.export_for_printing(...arguments);
       if (this.get_partner()) {
           result.headerData.partner = this.get_partner();
       }
       return result;
   },
});

The "PosOrder" model and the "patch" function are imported from their respective modules. The code modifies the "export_for_printing" method of the Order model to enrich the receipt’s header with extra data. It specifically checks if a partner is linked to the order, and if present, it appends the partner's details to the header information. This improvement enables more detailed PoS receipts, including customer information when available. The updated method is then returned for use within the application. Finally, all files are added to the "__manifest__.py" file for proper integration.

'assets': {
   'point_of_sale._assets_pos': [
       Module_name/static/src/**/*',
   ],
},

Once you are satisfied with your customized receipt template, it should look like this.

How to Customize POS Receipts in the Odoo 18-cybrosys

Customizing PoS receipts in Odoo 18 is a straightforward process with the use of QWeb templates. Whether it’s adding a company logo, modifying the layout, or including custom information, Odoo offers flexibility to tailor receipts to your business needs.

By following the steps outlined above, you can create a PoS receipt that aligns perfectly with your brand identity and customer experience. With a few simple customizations, your receipts will look professional and provide all the necessary information for both your business and your customers.

To read more about How to Customize POS Receipts in the Odoo 17, refer to our blog How to Customize POS Receipts in the Odoo 17.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



whatsapp_icon
location

Calicut

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

location

Kochi

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

location

Bangalore

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

Send Us A Message