Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How to add a new field to Odoo POS receipt?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
6 Respostes
8382 Vistes
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
Descartar
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
Descartar
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
Descartar
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
Descartar
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
Descartar
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
Descartar
Avatar
Mauricio Pastrana Macías
Autor 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
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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