Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

How to add a new field to Odoo POS receipt?

Odebírat

Get notified when there's activity on this post

This question has been flagged
6 Odpovědi
8396 Zobrazení
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
Zrušit
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
Nejlepší odpověď

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
Zrušit
Avatar
D Enterprise
Nejlepší odpověď

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
Zrušit
Avatar
Ruchita
Nejlepší odpověď

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
Zrušit
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Nejlepší odpověď

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
Zrušit
Avatar
Hussein Kadweka
Nejlepší odpověď

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

0
Avatar
Zrušit
Avatar
Mauricio Pastrana Macías
Autor Nejlepší odpověď

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
Zrušit
Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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