Przejdź do zawartości
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
    • Sztuczna inteligencja
    • IoT
    • VoIP
    • Wiedza
    • 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ą
    • Referral Program
    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
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 include a custom pos.order field in OrderReceipt frontend template (Odoo 18)

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
posfrontend
3 Odpowiedzi
2303 Widoki
Awatar
Ariko Stephen Philemon

Hi all,

I’m trying to expose a custom field added on pos.order so that it can be used in the POS frontend OrderReceipt QWeb/OWL template in Odoo 18.

Goal

I want a custom field defined on pos.order to be available in the POS frontend, specifically in the order_receipt template.

What I have done

I extended the pos.order model and tried to load the field using _load_pos_data_fields method , as shown below:

pos_order.py
from odoo import models, fields, api
# pos_order.py
from odoo import models, fields, api

class PosOrder(models.Model):
_inherit = "pos.order"

custom_field = fields.Char()

@api.model
def _load_pos_data_fields(self, config_id):
fields = super()._load_pos_data_fields(config_id)
fields.append("custom_field")
return fields
Frontend error

After this change, the POS UI doesn't load at all, it crashes with the following error:

installHook.js:1 TypeError: Cannot read properties of undefined (reading 'filter') at get taxTotals (point_of_sale.assets_prod.min.js:8929:1016)
What I found so far

I found a couple of older forum posts and answers that suggest extending _loader_params_pos_order method on pos.session model

However, in Odoo 18, _loader_params_pos_order no longer exists, so those solutions are no longer applicable.


What is the correct way in Odoo 18 to load additional pos.order fields into the POS frontend?

0
Awatar
Odrzuć
Awatar
CandidRoot Solutions
Najlepsza odpowiedź

Hello Ariko,

In Odoo 18, your approach using _load_pos_data_fields() is not correct for POS orders, and that is why the POS frontend crashes.

Why _load_pos_data_fields() does NOT work
  • In Odoo 18, POS orders are created and handled in the frontend (JS)

  • pos.order records are NOT loaded from backend when POS starts

  • _load_pos_data_fields() is meant for models fetched during POS loading, not for runtime orders

Because of this:

  • POS expects a specific data structure

  • Adding extra fields via _load_pos_data_fields() breaks the JS model

  • Result: POS crashes (taxTotals → undefined.filter error)

So this error is expected behavior, not a bug.

Correct way in Odoo 18 (Recommended)

To show a custom field on the POS receipt, you must extend the frontend export logic, not backend loading.

Patch export_for_printing() in JS

// static/src/app/models/pos_order.js import { PosOrder } from "@point_of_sale/app/models/pos_order"; import { patch } from "@web/core/utils/patch"; patch(PosOrder.prototype, { export_for_printing(baseUrl, headerData) { const result = super.export_for_printing(baseUrl, headerData); result.custom_field = this.custom_field || ""; return result; }, });

Display it in the receipt template

<t t-name="your_module.OrderReceipt" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension"> <xpath expr="//div[hasclass('pos-receipt-order-data')]" position="after"> <div t-esc="props.data.custom_field"/> </xpath> </t>

Why this works
  • export_for_printing() is the single source of truth for receipt data

  • Receipt templates only consume what this method returns

  • This is the official and stable approach in Odoo 18

    If this clarification helped you, kindly upvote.

    Best Regards

    CandidRoot Solutions Pvt. Ltd.
  • Mobile: (+91) 8849036209
  • Whatapp: (+91) 8849036209
  • Email: info@candidroot.com
  • Web: https://www.candidroot.com

1
Awatar
Odrzuć
Awatar
Kunjan Patel
Najlepsza odpowiedź
Hello Ariko Stephen Philemon,
I hope you are doing well

Odoo 18: Custom Field in POS Receipt
Patch export_for_printing() in JS
  // static/src/app/models/pos_order.js
  import { PosOrder } from "@point_of_sale/app/models/pos_order";
  import { patch } from "@web/core/utils/patch";

  patch(PosOrder.prototype, {
      export_for_printing(baseUrl, headerData) {
          const result = super.export_for_printing(baseUrl, headerData);
          result.custom_field = this.custom_field || "";
          return result;
      },
  });

 Display in template
  <t t-name="module.OrderReceipt" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension">
      <xpath expr="//div[hasclass('pos-receipt-order-data')]" position="after">
          <div t-esc="props.data.custom_field"/>
      </xpath>
  </t>  

Why _load_pos_data_fields doesn't work: Orders are created in frontend JS, not loaded from backend. The receipt uses export_for_printing() to build its data.

I hope this information helps you

Thanks & Regards
Kunjan Patel
1
Awatar
Odrzuć
Awatar
Bay Forward LLC
Najlepsza odpowiedź
Extend the OrderReceipt widget in your custom module and add your field in the render method. Example:\
\
```javascript\
OrderReceipt.include({\
    render: function() {\
        this._super.apply(this, arguments);\
        this.$el.find('.receipt-container').append('<div>' + this.pos.get_order().your_custom_field + '</div>');\
    }\
});\

```

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ę
Powiązane posty Odpowiedzi Widoki Czynność
Test timeout has no effect Rozwiązane
test pos frontend
Awatar
1
mar 23
4077
POS Integration: External system not syncing orders — API connection succeeds but no data
pos
Awatar
0
maj 26
5
Product Page Customization in Odoo Online (eCommerce)
frontend
Awatar
Awatar
Awatar
2
kwi 26
1185
Propos and Marvel printers not connecting to Odoo POS
pos
Awatar
Awatar
Awatar
2
kwi 26
2699
18v online Self order: Variants under one product, now they are all separate.
pos
Awatar
0
mar 26
3638
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 Svenska ภาษาไทย 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