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
    • Artificial Intelligence
    • 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ó
    • Property Management
    • 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
    • Referral Program
    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
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 include a custom pos.order field in OrderReceipt frontend template (Odoo 18)

Subscriure's

Get notified when there's activity on this post

This question has been flagged
posfrontend
3 Respostes
2300 Vistes
Avatar
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
Avatar
Descartar
Avatar
CandidRoot Solutions
Best Answer

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
Avatar
Descartar
Avatar
Kunjan Patel
Best Answer
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
Avatar
Descartar
Avatar
Bay Forward LLC
Best Answer
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
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
Related Posts Respostes Vistes Activitat
Test timeout has no effect Solved
test pos frontend
Avatar
1
de març 23
4076
POS Integration: External system not syncing orders — API connection succeeds but no data
pos
Avatar
0
de maig 26
5
Product Page Customization in Odoo Online (eCommerce)
frontend
Avatar
Avatar
Avatar
2
d’abr. 26
1185
Propos and Marvel printers not connecting to Odoo POS
pos
Avatar
Avatar
Avatar
2
d’abr. 26
2693
18v online Self order: Variants under one product, now they are all separate.
pos
Avatar
0
de març 26
3634
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 Svenska ภาษาไทย 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