Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How to add a new field to Odoo POS receipt?

Subscribe

Get notified when there's activity on this post

This question has been flagged
6 Replies
8380 Views
Avatar
Mauricio Pastrana Macías

Hello!

I'm trying to add a new field in my POS Receipt.


I already inherited the template and I added a simple static text.


But I want to add a field, how can I achieve that? Is by JavaScript or Python?


What model does it use? I already tried POS Order, but didn't work


Thanks!


This is my code so far:


from odoo import models

classPosSession(models.Model):
​_inherit = ["pos.session", "evo.payments.session"] # Evo Payments Session is my custom model

def_loader_params_evo_payments_session(self):|
"""        Loads the QR Code to the Order Receipt, calling the Evo Payments Session method        """ 
result = super().CUSTOM_FUNCTION()     
result["search_params"]["fields"].append(CUSTOM_FIELD)
return result


What should I put in CUSTOM_FUNCTION() and CUSTOM_FIELD?

0
Avatar
Discard
Odoo4Life

Hi mauricio,

Do you mean you want to add it to the POS receipt?
can you please send an image of the place you want to add the field?

Regards,

Avatar
Shiv Technolabs
Best Answer

Hi!

You're on the right track. To show a custom field on the POS Receipt, you need to:

✅ 1. Expose the field to the POS frontend (via Python)

If your custom field is on evo.payments.session, you need to load it using the session loader. Your function might look like this:

def _loader_params_evo_payments_session(self):
    result = super()._loader_params_evo_payments_session()
    result["search_params"]["fields"].append("your_custom_field")
    return result

Replace "your_custom_field" with the actual field name from your model.

If you're calling a different function (e.g. _loader_params_pos_session), make sure it returns the needed field too.

✅ 2. Get the field into JavaScript

In your custom JS (extend models.PosModel), load the field like this:

import { PosGlobalState } from 'point_of_sale.models';
import { patch } from 'web.utils';

patch(PosGlobalState.prototype, {
    async _processData(loadedData) {
        await super._processData(...arguments);
        this.evo_field = loadedData['evo.payments.session']?.[0]?.your_custom_field;
    },
});

✅ 3. Add it to the Receipt (QWeb template)

In your inherited receipt template, add:

<t t-if="pos.evo_field">
    <div>Custom Field: <t t-esc="pos.evo_field"/></div>
</t>

0
Avatar
Discard
Avatar
D Enterprise
Best Answer

Hii,

Python – Extend pos.order and Session Loader
models/pos_order.py


from odoo import models, fields class PosOrder(models.Model): _inherit = 'pos.order' qr_code = fields.Char(string="QR Code") # your custom field

models/pos_session.py

from odoo import models class PosSession(models.Model): _inherit = ['pos.session', 'evo.payments.session'] def _loader_params_pos_order(self): result = super()._loader_params_pos_order() result["search_params"]["fields"].append("qr_code") # <-- This is your CUSTOM_FIELD return result

qr_code is the custom field you want in the receipt. Replace it with any field you need.

JavaScript – Pass Custom Field to Receipt
static/src/js/extend_order.js


/** @odoo -module **/ import { Order } from "@point_of_sale/app/store/models"; import { patch } from "@web/core/utils/patch"; patch(Order.prototype, { export_for_printing() { const result = super.export_for_printing(); result.qr_code = this.qr_code; // must match field in Python return result; }, });

XML – Add Field to POS Receipt
views/pos_receipt_template.xml

<odoo> <template id="custom_pos_receipt_qr" inherit_id="point_of_sale.pos_ticket"> <xpath expr="//div[@class='pos-receipt-order-data']" position="inside"> <div> <strong>QR Code:</strong> <t t-esc="receipt.qr_code"/> </div> </xpath> </template> </odoo>

4. Manifest File
__manifest__.py


{ "name": "POS Custom QR Receipt", "depends": ["point_of_sale"], "assets": { "point_of_sale._assets_pos": [ "your_module_name/static/src/js/extend_order.js", ], }, "data": [ "views/pos_receipt_template.xml", ], }

i hope it is usefull

0
Avatar
Discard
Avatar
Ruchita
Best Answer

1. Add the field to the POS order model (JS)

Extend the POS model using JavaScript to include the new field:

odoo.define('your_module_name.models', function (require) {

    var models = require('point_of_sale.models');


    models.load_fields('res.partner', ['customer_gstin']); // load custom field from partner


    const _super_order = models.Order.prototype;

    models.Order = models.Order.extend({

        export_for_printing: function () {

            var result = _super_order.export_for_printing.apply(this, arguments);

            result.customer_gstin = this.get_partner() ? this.get_partner().customer_gstin : '';

            return result;

        },

    });

});


2. Update the receipt template

Edit or extend the POS receipt QWeb template to include the field: 

<t t-name="PointOfSale.Ticket">

  ...

  <t t-if="receipt.customer_gstin">

    <div>GSTIN: <t t-esc="receipt.customer_gstin"/></div>

  </t>

  ...

</t>


That’s it! Now the new field will be printed on the POS receipt.

✅ Make sure your custom field exists on the partner model and is synced to the POS.

✅ Don’t forget to restart Odoo and refresh your POS screen after making changes.

Let me know if you need the same for Odoo 14, 15, 16, or 17!

0
Avatar
Discard
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,


Please refer to this link to know more about customizing POS receipt.


https://www.cybrosys.com/blog/how-to-customize-pos-receipts-in-the-odoo-18


Hope it helps

0
Avatar
Discard
Avatar
Hussein Kadweka
Best Answer

def _loader_values_pos_order(self): 
    result = super()._loader_values_pos_order() result['search_params']['fields'].append('esd_qr_code')          return result

0
Avatar
Discard
Avatar
Mauricio Pastrana Macías
Author Best Answer

Yes, I'd like to add a new field to the POS Receipt. It's from a brand new model, so I can't inherit a pos.session method. Do you have any guide or tutorial?


This is my code so far:


from odoo import models

classPosSession(models.Model):
​
_inherit = ["pos.session", "evo.payments.session"] # Evo Payments Session is my custom model

def_loader_params_evo_payments_session(self):|
"""        Loads the QR Code to the Order Receipt, calling the Evo Payments Session method        """ 
result = super().CUSTOM_FUNCTION()     
result[
"search_params"]["fields"].append(CUSTOM_FIELD)
return
result


What should I put in CUSTOM_FUNCTION() and CUSTOM_FIELD?

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now