Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

How to add a new field to Odoo POS receipt?

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
6 Odpowiedzi
8390 Widoki
Awatar
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
Awatar
Odrzuć
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,

Awatar
Shiv Technolabs
Najlepsza odpowiedź

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
Awatar
Odrzuć
Awatar
D Enterprise
Najlepsza odpowiedź

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
Awatar
Odrzuć
Awatar
Ruchita
Najlepsza odpowiedź

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
Awatar
Odrzuć
Awatar
Cybrosys Techno Solutions Pvt.Ltd
Najlepsza odpowiedź

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
Awatar
Odrzuć
Awatar
Hussein Kadweka
Najlepsza odpowiedź

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

0
Awatar
Odrzuć
Awatar
Mauricio Pastrana Macías
Autor Najlepsza odpowiedź

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
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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