Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Artificial Intelligence
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How to include a custom pos.order field in OrderReceipt frontend template (Odoo 18)

Subscribe

Get notified when there's activity on this post

This question has been flagged
posfrontend
3 Replies
2193 Views
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
Discard
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
Discard
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
Discard
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
Discard
Enjoying the discussion? Don't just read, join in!

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

Sign up
Related Posts Replies Views Activity
Test timeout has no effect Solved
test pos frontend
Avatar
1
Mar 23
3997
POS Integration: External system not syncing orders — API connection succeeds but no data
pos
Avatar
0
May 26
5
Product Page Customization in Odoo Online (eCommerce)
frontend
Avatar
Avatar
Avatar
2
Apr 26
1109
Propos and Marvel printers not connecting to Odoo POS
pos
Avatar
Avatar
Avatar
2
Apr 26
2249
18v online Self order: Variants under one product, now they are all separate.
pos
Avatar
0
Mar 26
3220
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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