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
    • Approvals
    • 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
    • Estate 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

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
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 add a custom field to the PartnerListScreen at POS in Odoo 16?

Subscribe

Get notified when there's activity on this post

This question has been flagged
point_of_saleJavascriptOWL
1 Reply
6037 Views
Avatar
Thein

I have added a new character field to the "res.partner" model in my Odoo application named "customer_level". My intention is to make this field visible in the Point of Sale module. This way, when a cashier searches for a customer, they will be able to view the corresponding customer level information.

I was able to add the "customer_level" field to the Point of Sale module in Odoo 15, but I am encountering issues when trying to reuse the same code in Odoo 16.

I will provide codes how did I add to Odoo 15.

my pos.js is located at my custom module, /src/user/my_module/static/src/js/pos.js

`odoo.define('pos.Pos', function (require) {
"use strict";
 
var models = require('point_of_sale.models');
var fields = models.load_fields('res.partner', 'customer_level'); 
});`

Here is my pos.xml at /src/user/my_module/static/src/xml/pos.xml

``
 
 



Type











 





Customer Type




 

 
 
 

`



`


It works perfectly at Odoo 15, I wonder why this code does not work at Odoo 16. I have changed "ClientListScreen" to "PartnerLineScreen" and "ClientLine" to "PartnerLine" accordingly at my codes to work with Odoo 16 but field is not appeared at "PartnerLineScreen". Kindly help me I am stucked.

0
Avatar
Discard
Thein
Author

Here is my pos.xml at /src/user/my_module/static/src/xml/pos.xml
`<?xml version="1.0" encoding="UTF-8"?>
<templates id="pos_subscriber_template" inherit_id="point_of_sale.template" xml:space="preserve">

<!-- ClientListScreenWidget for Customer Type column-->
<t t-extend="ClientListScreenWidget" t-inherit="point_of_sale.ClientListScreen" t-inherit-mode="extension" owl="1">
<xpath expr="//table//thead//tr" position="inside">
<th>Type</th>
</xpath>
</t>

<!-- Getting value for Customer Type colun -->
<t t-extend="ClientLine" t-inherit="point_of_sale.ClientLine" t-inherit-mode="extension" owl="1">
<xpath expr="//tr" position="inside">
<td class="text-center">
<center><t t-esc='props.partner.customer_level or ""' /></center>
</td>
</xpath>
</t>

<!-- Customer Type column at Client Detials Edit -->
<t t-extend="ClientDetailsEdit" t-inherit="point_of_sale.ClientDetailsEdit" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('client-details-left')]" position="inside">
<div class="client-detail">
<span class='label'>Customer Type</span>
<span> <t t-esc='props.partner.customer_level or ""'/></span>
</div>
</xpath>
</t>

<!-- Customer Type column at Client Detials Edit -->

</templates>
`

سلمى سنتر

good code many thanks

Avatar
Mehjabin Farsana
Best Answer

Hi, 
In odoo16 there are some technical changes for loading new fields in to pos

For adding the new field, we can use the _loader_params method, it is written as _loader_params_ followed by your model name.


try this in your python file



from odoo import models


class PosSession(models.Model):
_inherit = 'pos.session'

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


Hope this will help you
Thanks

1
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
How to use JSON RPC in odoo 17 point_of_sale
point_of_sale jsonrpc OWL
Avatar
0
Dec 24
3335
Reuse Layout Component in Custom Odoo 16 Component
Javascript OWL odoo16features
Avatar
0
Nov 23
2435
How to listen event scan in owl component
v14 Javascript OWL
Avatar
0
May 21
19
How to override export function getColor(key) in Odoo 17 OWL JS?? Solved
override Javascript OWL Odoo17
Avatar
Avatar
1
Nov 24
2587
Skills needed for Odoo OWL Development ?
OWL
Avatar
Avatar
Avatar
2
Sep 25
2623
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 ภาษาไทย 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