SlideShare a Scribd company logo
3
Most read
6
Most read
9
Most read
How to modify/create
components control
buttons in Pos Odoo
Enterprise
Introduction
Enterprise
The Odoo Javascript framework uses a custom component
framework called Owl. Odoo 17 uses relies on the Odoo Web
Library (OWL) for web development. It employs OWL concepts and
principles in its POS system, with JavaScript code.
While talking about creating or modifying control buttons using
the components defined in Odoo PoS, the very first method that
comes for the rescue is ‘patching’. It’s used to modify or extend the
behavior of existing components without totally replacing it.
Enterprise
Let’s create our custom module patch_in_odoo. We will discuss
about creating a button in the Payment Screen of POS. The basic
structure of the module is as
Enterprise
To implement the task to create custom Popup button and to show a
dialog box, we use the OWL concept of patching inside JS file. In the
manifest file of the module, we need to add these files as the POS
assets of point_of_sale directory.
ie, in the manifest add the code for assets key as:
'assets': {
'point_of_sale._assets_pos': [
'patch_in_odoo/static/src/js/*',
'patch_in_odoo/static/src/js/PopUp/*',
'patch_in_odoo/static/src/xml/*',
]
},
Enterprise
Navigate to the static/src/xml directory and create a new xml file. We
need two xml files.
● Here, pos_pop_up.xml for designing the simple structure of
the pop up window which is to be shown on clicking the button.
● pos_payment_screen_button.xml which inherits the addon
templates to show the custom button on the payment screen.
Creating XML files
Enterprise
Using the <templates> tag, design the pop up by in xml. patch_in_odoo is the
module name and CustomAlertPopup is the pop up name
<t t-name="patch_in_odoo.CustomAlertPopup" owl="1">
<div class="popup custom_popup">
<div class="modal-header justify-content-center">
<h2 class="modal-title">
<t t-esc="props.title"/></h2></div>
<div class="modal-body custom-form-view">
<form><div class="col d-flex justify-content-between align-items-center p-
3">
Pop up button clicked from POS
</div>
</form>
</div>
<div class="footer footer-flex modal-footer justify-content-end">
<div class="button cancel btn btn-lg btn-primary"
t-on-click="cancel">Close
<t t-esc="props.closePopup"/>
</div>
</div></div>
</t>
Enterprise
It's important to specify the module and necessary screens in the JS file by
utilizing /**@odoo-module **/ to define the module. This ensures that the
JavaScript functionalities are properly associated with the Odoo module and its
relevant screens.
The js code which calls this pop up window template can be set as
/** @odoo-module */
import { AbstractAwaitablePopup } from
"@point_of_sale/app/popup/abstract_awaitable_popup";
/**
* CustomAlertPopup component for displaying messages as an alert popup.
* Inherits from AbstractAwaitablePopup.
*/
export class CustomAlertPopup extends AbstractAwaitablePopup {
static template = "patch_in_odoo.CustomAlertPopup";
}
Enterprise
After that, let’s create the custom button. The code for adding the
template named PaymentScreenButtons for the button in the
Payment screen is as:
<t t-name="pos_button.PaymentScreenButtons"
t-inherit="point_of_sale.PaymentScreenButtons"
t-inherit-mode="extension">
<xpath expr="//div[hasclass('payment-buttons')]" position="inside">
<button class="button button-partial-payment btn btn-light py-3 text-
start rounded-0 border-bottom"
t-on-click="onClick">
<i class="fa fa-money me-2"/>Custom Button
</button>
</xpath>
</t>
Enterprise
This will create the button as
Enterprise
The JS file must be added after the button. For the button created on
the Payment screen, add the following modules for extending the
product screen js codes.
/** @odoo-module */
import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";
import { CustomAlertPopup } from "@patch_in_odoo/js/PopUp/popup_button";
import { patch } from "@web/core/utils/patch";
First, the PaymentScreen component is imported.
Then, from the same module, CustomAlertPopup is imported. We
have just discussed about the popup’s creation and template.
And last one is to import the patch.
Enterprise
Then, for the button created on the Payment screen, add the patching
js code for opening the mentioned popup window as
patch(PaymentScreen.prototype, {
async onClick() {
this.popup.add(CustomAlertPopup)
}})
For the patch() method, we passed the imported PaymentScreen
component’s prototype as first argument. Then, the concerned
onClick() method is defined which opens the custom Popup window.
Enterprise
Then, just click on the Custom Button on the Payment screen. It’ll
show the popup like
In this way, the POS component control buttons can be created or
modified using the method of patching in Odoo 17.
For More Info.
Check our company website for related blogs
and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.
Enterprise
www.cybrosys.com

More Related Content

PPTX
How to Add a Custom Button in Pos Odoo 17
PPTX
How to Add a Custom Button in Odoo 18 POS Screen
PPTX
How to Create a Popup in Odoo POS 17 - Odoo 17 Slides
PPTX
How to hide the buttons on the POS screen in Odoo 17
PPTX
Revamped POS User Interface in Odoo 18 - Odoo Slides
PPTX
How to Create a Custom Screen in Odoo 17 POS
PPTX
How to Implement OWL Notification Service in Odoo 18
PPTX
Tracking Profit Margins in Sales Orders with Odoo 18
How to Add a Custom Button in Pos Odoo 17
How to Add a Custom Button in Odoo 18 POS Screen
How to Create a Popup in Odoo POS 17 - Odoo 17 Slides
How to hide the buttons on the POS screen in Odoo 17
Revamped POS User Interface in Odoo 18 - Odoo Slides
How to Create a Custom Screen in Odoo 17 POS
How to Implement OWL Notification Service in Odoo 18
Tracking Profit Margins in Sales Orders with Odoo 18

More from Celine George (20)

PPTX
How to Configure Outgoing Shipment in 3 Steps Using Odoo 18
PPTX
How to Configure Outgoing Shipment in 1 Step Using Odoo 18.pptx
PPTX
How to Configure Outgoing Shipment in 2 Steps Using Odoo 18
PPTX
How to Add New Applicants in Odoo 18 Recruitment
PPTX
How to Analyze the Recruitment Process in Odoo 18 Recruitment
PPTX
How to Manage Referral Reporting in Odoo 18 Referrals
PPTX
How to Set, Track, & Review Employee Goals in Odoo 18 Appraisals
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PPTX
How to Manage Bill Control Policy in Odoo 18
PPTX
How to Manage Loyalty Points in Odoo 18 Sales
PPTX
Odoo 18 Sales_ Managing Quotation Validity
PPTX
How to Manage Global Discount in Odoo 18 POS
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
PPTX
How to Apply for a Job From Odoo 18 Website
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
How to Configure Outgoing Shipment in 3 Steps Using Odoo 18
How to Configure Outgoing Shipment in 1 Step Using Odoo 18.pptx
How to Configure Outgoing Shipment in 2 Steps Using Odoo 18
How to Add New Applicants in Odoo 18 Recruitment
How to Analyze the Recruitment Process in Odoo 18 Recruitment
How to Manage Referral Reporting in Odoo 18 Referrals
How to Set, Track, & Review Employee Goals in Odoo 18 Appraisals
Revamp in MTO Odoo 18 Inventory - Odoo Slides
How to Manage Starshipit in Odoo 18 - Odoo Slides
How to Manage Bill Control Policy in Odoo 18
How to Manage Loyalty Points in Odoo 18 Sales
Odoo 18 Sales_ Managing Quotation Validity
How to Manage Global Discount in Odoo 18 POS
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Tips Management in Odoo 18 POS - Odoo Slides
How to Close Subscription in Odoo 18 - Odoo Slides
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
How to Track Skills & Contracts Using Odoo 18 Employee
How to Apply for a Job From Odoo 18 Website
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Ad

Recently uploaded (20)

PDF
RMMM.pdf make it easy to upload and study
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Cell Structure & Organelles in detailed.
PPTX
Institutional Correction lecture only . . .
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Classroom Observation Tools for Teachers
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
01-Introduction-to-Information-Management.pdf
PPTX
master seminar digital applications in india
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Lesson notes of climatology university.
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Complications of Minimal Access Surgery at WLH
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
RMMM.pdf make it easy to upload and study
Module 4: Burden of Disease Tutorial Slides S2 2025
Cell Structure & Organelles in detailed.
Institutional Correction lecture only . . .
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Classroom Observation Tools for Teachers
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
01-Introduction-to-Information-Management.pdf
master seminar digital applications in india
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Lesson notes of climatology university.
Basic Mud Logging Guide for educational purpose
Final Presentation General Medicine 03-08-2024.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Insiders guide to clinical Medicine.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Microbial disease of the cardiovascular and lymphatic systems
Anesthesia in Laparoscopic Surgery in India
Complications of Minimal Access Surgery at WLH
102 student loan defaulters named and shamed – Is someone you know on the list?
Ad

How to modify_create components control buttons in Pos odoo.pptx

  • 1. How to modify/create components control buttons in Pos Odoo Enterprise
  • 2. Introduction Enterprise The Odoo Javascript framework uses a custom component framework called Owl. Odoo 17 uses relies on the Odoo Web Library (OWL) for web development. It employs OWL concepts and principles in its POS system, with JavaScript code. While talking about creating or modifying control buttons using the components defined in Odoo PoS, the very first method that comes for the rescue is ‘patching’. It’s used to modify or extend the behavior of existing components without totally replacing it.
  • 3. Enterprise Let’s create our custom module patch_in_odoo. We will discuss about creating a button in the Payment Screen of POS. The basic structure of the module is as
  • 4. Enterprise To implement the task to create custom Popup button and to show a dialog box, we use the OWL concept of patching inside JS file. In the manifest file of the module, we need to add these files as the POS assets of point_of_sale directory. ie, in the manifest add the code for assets key as: 'assets': { 'point_of_sale._assets_pos': [ 'patch_in_odoo/static/src/js/*', 'patch_in_odoo/static/src/js/PopUp/*', 'patch_in_odoo/static/src/xml/*', ] },
  • 5. Enterprise Navigate to the static/src/xml directory and create a new xml file. We need two xml files. ● Here, pos_pop_up.xml for designing the simple structure of the pop up window which is to be shown on clicking the button. ● pos_payment_screen_button.xml which inherits the addon templates to show the custom button on the payment screen. Creating XML files
  • 6. Enterprise Using the <templates> tag, design the pop up by in xml. patch_in_odoo is the module name and CustomAlertPopup is the pop up name <t t-name="patch_in_odoo.CustomAlertPopup" owl="1"> <div class="popup custom_popup"> <div class="modal-header justify-content-center"> <h2 class="modal-title"> <t t-esc="props.title"/></h2></div> <div class="modal-body custom-form-view"> <form><div class="col d-flex justify-content-between align-items-center p- 3"> Pop up button clicked from POS </div> </form> </div> <div class="footer footer-flex modal-footer justify-content-end"> <div class="button cancel btn btn-lg btn-primary" t-on-click="cancel">Close <t t-esc="props.closePopup"/> </div> </div></div> </t>
  • 7. Enterprise It's important to specify the module and necessary screens in the JS file by utilizing /**@odoo-module **/ to define the module. This ensures that the JavaScript functionalities are properly associated with the Odoo module and its relevant screens. The js code which calls this pop up window template can be set as /** @odoo-module */ import { AbstractAwaitablePopup } from "@point_of_sale/app/popup/abstract_awaitable_popup"; /** * CustomAlertPopup component for displaying messages as an alert popup. * Inherits from AbstractAwaitablePopup. */ export class CustomAlertPopup extends AbstractAwaitablePopup { static template = "patch_in_odoo.CustomAlertPopup"; }
  • 8. Enterprise After that, let’s create the custom button. The code for adding the template named PaymentScreenButtons for the button in the Payment screen is as: <t t-name="pos_button.PaymentScreenButtons" t-inherit="point_of_sale.PaymentScreenButtons" t-inherit-mode="extension"> <xpath expr="//div[hasclass('payment-buttons')]" position="inside"> <button class="button button-partial-payment btn btn-light py-3 text- start rounded-0 border-bottom" t-on-click="onClick"> <i class="fa fa-money me-2"/>Custom Button </button> </xpath> </t>
  • 10. Enterprise The JS file must be added after the button. For the button created on the Payment screen, add the following modules for extending the product screen js codes. /** @odoo-module */ import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen"; import { CustomAlertPopup } from "@patch_in_odoo/js/PopUp/popup_button"; import { patch } from "@web/core/utils/patch"; First, the PaymentScreen component is imported. Then, from the same module, CustomAlertPopup is imported. We have just discussed about the popup’s creation and template. And last one is to import the patch.
  • 11. Enterprise Then, for the button created on the Payment screen, add the patching js code for opening the mentioned popup window as patch(PaymentScreen.prototype, { async onClick() { this.popup.add(CustomAlertPopup) }}) For the patch() method, we passed the imported PaymentScreen component’s prototype as first argument. Then, the concerned onClick() method is defined which opens the custom Popup window.
  • 12. Enterprise Then, just click on the Custom Button on the Payment screen. It’ll show the popup like In this way, the POS component control buttons can be created or modified using the method of patching in Odoo 17.
  • 13. For More Info. Check our company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo. Enterprise www.cybrosys.com