際際滷

際際滷Share a Scribd company logo
How to make a component
and add it to systray in Odoo
Enterprise
Introduction
Enterprise
The system tray icon in Odoo serves as a quick-access feature, allowing
users to easily interact with certain functionalities of the Odoo system
without navigating through the main interface.
It is located in the notification bar. The icons in the menu may vary
according to the modules installed. The marked area indicates the systray
icons
Enterprise
Lets check how can we make a new icon to show on the systray
menu and add action to it. We can create a module directory for it.
The structure will be as follows
Enterprise
Inside the manifest, register the js and xml files as
'assets': {
'web.assets_backend': [
'systray_icon/static/src/js/systray_icon.js',
'systray_icon/static/src/xml/systray_icon.xml',
]
}
Enterprise
The file systray_icon.xml contains the xml code for showing our
custom icon in the view.
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="systray_icon" owl="1">
<Dropdown>
<t t-set-slot="toggler">
<div class="new_icon">
<div class="icon_div">
<div class="toggle-icon" role="button">
<i id='create_order' class="fa fa-shopping-cart fa-1.5x"
role="img" aria-label="Sale/Purchase Order"/>
</div></div></div></t>
<t t-set-slot="default">
<DropdownItem><div t-on-click="_openSaleModel"> Sale Order </div></DropdownItem>
<DropdownItem><div t-on-click="_openPurchaseModel">Purchase Order</div></DropdownItem>
</t>
</Dropdown>
</t>
</templates>
Enterprise
This will make a new shopping cart icon to be visible on the systray
which will then give a dropdown menu containing two buttons as
Sale Order and Purchase Order when clicked.
Enterprise
Now we need to define the Actions for the two buttons we added.
Lets add a simple logic to open a form view to create new Sale
order or Purchase Order for the respective buttons. For that, we
type the code in js under static/src/js directory of the module.
The very step is to add the line /** @odoo-module **/ and to
import the registry, useService, Owl component, Dropdown and
Dropdown Item.
/** @odoo-module **/
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import { Component } from "@odoo/owl";
import {Dropdown} from '@web/core/dropdown/dropdown';
import {DropdownItem} from '@web/core/dropdown/dropdown_item';
Enterprise
From the javascript code in Odoo, the classes are extended using
extend keyword. This is used to create a new class or component
from an existing class by inheriting all its properties and methods of
the parent class. New methods can be defined or existing ones can
be overridden or added with new functionalities.
Here we create the new class SystrayIcon from the existing class
Component as
class SystrayIcon extends Component
Enterprise
Along with the setup(), we need to define the two onclick methods
_openSaleModel and _openPurchaseModel we mentioned in the
xml file. Both of them will open the form views of sale.order and
purchase.order respectively.
And for these click events, we use this.action.doAction() method to
open a window action and pass the details such as type, name,
res_model, view_mode, etc about the view we need to open.
Enterprise
class SystrayIcon extends Component {
setup() {
super.setup(...arguments);
this.action = useService("action");
}
_openSaleModel() {
this.action.doAction({
type: "ir.actions.act_window",
name: "Sale Order",
res_model: "sale.order",
view_mode: "form",
views: [[false, "form"]],
target: "new",
});
}
_openPurchaseModel(){
this.action.doAction({
type: "ir.actions.act_window",
name: "Purchase Order",
res_model: "purchase.order",
view_mode: "form",
views: [[false, "form"]],
target: "new",
});
}
}
Enterprise
Now, give the template for the new class with the same template
name we created in xml. And register the component and
systrayItem as
SystrayIcon.template = "systray_icon";
SystrayIcon.components = {Dropdown, DropdownItem };
export const systrayItem = { Component: SystrayIcon,};
registry.category("systray").add("SystrayIcon", systrayItem, { sequence: 1 });
Enterprise
Now on clicking the first button Sale Order from the shopping cart
systray icon, we get
Enterprise
Likewise, for the Purchase Order button click, we get
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

Similar to How to make a component and add it to systray in Odoo (20)

ASP.NET MVC3 RAD
ASP.NET MVC3 RADASP.NET MVC3 RAD
ASP.NET MVC3 RAD
Mdlin tef樽rc
Yii in action
Yii in actionYii in action
Yii in action
KeaNy Chu
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
vchircu
Advance RCP
Advance RCPAdvance RCP
Advance RCP
Rahul Shukla
Actionview
ActionviewActionview
Actionview
Amal Subhash
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry university
lhkslkdh89009
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity Framework
Akhil Mittal
How to add Many2Many fields in odoo website form.pptx
How to add Many2Many fields in odoo website form.pptxHow to add Many2Many fields in odoo website form.pptx
How to add Many2Many fields in odoo website form.pptx
Celine George
Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7
helpido9
How Owl.js Masterfully Blends React and Vue Awesomeness in odoo
How Owl.js Masterfully Blends React and Vue Awesomeness in odooHow Owl.js Masterfully Blends React and Vue Awesomeness in odoo
How Owl.js Masterfully Blends React and Vue Awesomeness in odoo
Celine George
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
Celine George
Sencha ExtJs Learning Part 2 - MVC And MVVM Architecture in ExtJs [ENGLISH]
Sencha ExtJs Learning Part 2 - MVC And MVVM Architecture in ExtJs [ENGLISH]Sencha ExtJs Learning Part 2 - MVC And MVVM Architecture in ExtJs [ENGLISH]
Sencha ExtJs Learning Part 2 - MVC And MVVM Architecture in ExtJs [ENGLISH]
Irfan Maulana
Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...
Katy Slemon
Tips On Trick Odoo Add-On.pptx
Tips On Trick Odoo Add-On.pptxTips On Trick Odoo Add-On.pptx
Tips On Trick Odoo Add-On.pptx
Agusto Sipahutar
need help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docxneed help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docx
niraj57
How to Create a Dynamic Snippet in Odoo 17
How to Create a Dynamic Snippet in Odoo 17How to Create a Dynamic Snippet in Odoo 17
How to Create a Dynamic Snippet in Odoo 17
Celine George
Whmcs addon module docs
Whmcs addon module docsWhmcs addon module docs
Whmcs addon module docs
quyvn
Uninstall Hook in Odoo 17 - Odoo 17 際際滷s
Uninstall Hook in Odoo 17 - Odoo 17 際際滷sUninstall Hook in Odoo 17 - Odoo 17 際際滷s
Uninstall Hook in Odoo 17 - Odoo 17 際際滷s
Celine George
DJango
DJangoDJango
DJango
Sunil OS
Struts 1
Struts 1Struts 1
Struts 1
Lalit Garg
Yii in action
Yii in actionYii in action
Yii in action
KeaNy Chu
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
vchircu
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry university
lhkslkdh89009
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity Framework
Akhil Mittal
How to add Many2Many fields in odoo website form.pptx
How to add Many2Many fields in odoo website form.pptxHow to add Many2Many fields in odoo website form.pptx
How to add Many2Many fields in odoo website form.pptx
Celine George
Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7
helpido9
How Owl.js Masterfully Blends React and Vue Awesomeness in odoo
How Owl.js Masterfully Blends React and Vue Awesomeness in odooHow Owl.js Masterfully Blends React and Vue Awesomeness in odoo
How Owl.js Masterfully Blends React and Vue Awesomeness in odoo
Celine George
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
Celine George
Sencha ExtJs Learning Part 2 - MVC And MVVM Architecture in ExtJs [ENGLISH]
Sencha ExtJs Learning Part 2 - MVC And MVVM Architecture in ExtJs [ENGLISH]Sencha ExtJs Learning Part 2 - MVC And MVVM Architecture in ExtJs [ENGLISH]
Sencha ExtJs Learning Part 2 - MVC And MVVM Architecture in ExtJs [ENGLISH]
Irfan Maulana
Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...
Katy Slemon
Tips On Trick Odoo Add-On.pptx
Tips On Trick Odoo Add-On.pptxTips On Trick Odoo Add-On.pptx
Tips On Trick Odoo Add-On.pptx
Agusto Sipahutar
need help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docxneed help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docx
niraj57
How to Create a Dynamic Snippet in Odoo 17
How to Create a Dynamic Snippet in Odoo 17How to Create a Dynamic Snippet in Odoo 17
How to Create a Dynamic Snippet in Odoo 17
Celine George
Whmcs addon module docs
Whmcs addon module docsWhmcs addon module docs
Whmcs addon module docs
quyvn
Uninstall Hook in Odoo 17 - Odoo 17 際際滷s
Uninstall Hook in Odoo 17 - Odoo 17 際際滷sUninstall Hook in Odoo 17 - Odoo 17 際際滷s
Uninstall Hook in Odoo 17 - Odoo 17 際際滷s
Celine George

More from Celine George (20)

Analysis of Conf File Parameters in the Odoo 18
Analysis of Conf File Parameters in the Odoo 18Analysis of Conf File Parameters in the Odoo 18
Analysis of Conf File Parameters in the Odoo 18
Celine George
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷sPurchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Celine George
Analysis of Conf File Parameters in Odoo 17
Analysis of Conf File Parameters in Odoo 17Analysis of Conf File Parameters in Odoo 17
Analysis of Conf File Parameters in Odoo 17
Celine George
How to Manage Check Out Process in Odoo 17 Website
How to Manage Check Out Process in Odoo 17 WebsiteHow to Manage Check Out Process in Odoo 17 Website
How to Manage Check Out Process in Odoo 17 Website
Celine George
Managing Online Signature and Payment with Odoo 17
Managing Online Signature and Payment with Odoo 17Managing Online Signature and Payment with Odoo 17
Managing Online Signature and Payment with Odoo 17
Celine George
Recruitment in the Odoo 17 - Odoo 17 際際滷s
Recruitment in the Odoo 17 - Odoo 17 際際滷sRecruitment in the Odoo 17 - Odoo 17 際際滷s
Recruitment in the Odoo 17 - Odoo 17 際際滷s
Celine George
How to Setup Company Data in Odoo 17 Accounting App
How to Setup Company Data in Odoo 17 Accounting AppHow to Setup Company Data in Odoo 17 Accounting App
How to Setup Company Data in Odoo 17 Accounting App
Celine George
How to Install Odoo 18 with Pycharm - Odoo 18 際際滷s
How to Install Odoo 18 with Pycharm - Odoo 18 際際滷sHow to Install Odoo 18 with Pycharm - Odoo 18 際際滷s
How to Install Odoo 18 with Pycharm - Odoo 18 際際滷s
Celine George
How to Manage Purchase Order Approval in Odoo 18
How to Manage Purchase Order Approval in Odoo 18How to Manage Purchase Order Approval in Odoo 18
How to Manage Purchase Order Approval in Odoo 18
Celine George
How to Configure Outgoing and Incoming mail servers in Odoo 18
How to Configure Outgoing and Incoming mail servers in Odoo 18How to Configure Outgoing and Incoming mail servers in Odoo 18
How to Configure Outgoing and Incoming mail servers in Odoo 18
Celine George
How to Grant Discounts in Sale Order Lines in Odoo 18 Sales
How to Grant Discounts in Sale Order Lines in Odoo 18 SalesHow to Grant Discounts in Sale Order Lines in Odoo 18 Sales
How to Grant Discounts in Sale Order Lines in Odoo 18 Sales
Celine George
URLS and routing in odoo 18 - Odoo 際際滷s
URLS and routing in odoo 18 - Odoo 際際滷sURLS and routing in odoo 18 - Odoo 際際滷s
URLS and routing in odoo 18 - Odoo 際際滷s
Celine George
Comparing RFQ Lines for the best price in Odoo 17
Comparing RFQ Lines for the best price in Odoo 17Comparing RFQ Lines for the best price in Odoo 17
Comparing RFQ Lines for the best price in Odoo 17
Celine George
List View Attributes in Odoo 18 - Odoo 際際滷s
List View Attributes in Odoo 18 - Odoo 際際滷sList View Attributes in Odoo 18 - Odoo 際際滷s
List View Attributes in Odoo 18 - Odoo 際際滷s
Celine George
How to Set Default Terms and Conditions in Odoo 17 Accounting
How to Set Default Terms and Conditions in Odoo 17 AccountingHow to Set Default Terms and Conditions in Odoo 17 Accounting
How to Set Default Terms and Conditions in Odoo 17 Accounting
Celine George
Enhance Your Quotations by Sections, Notes, and Subtotals in Odoo Sales
Enhance Your Quotations by Sections, Notes, and Subtotals in Odoo SalesEnhance Your Quotations by Sections, Notes, and Subtotals in Odoo Sales
Enhance Your Quotations by Sections, Notes, and Subtotals in Odoo Sales
Celine George
What are the Views in Odoo 18 Purchase - Odoo 際際滷s
What are the Views in Odoo 18 Purchase - Odoo 際際滷sWhat are the Views in Odoo 18 Purchase - Odoo 際際滷s
What are the Views in Odoo 18 Purchase - Odoo 際際滷s
Celine George
Configuration of Python and SQL Constraints in Odoo 18
Configuration of Python and SQL Constraints in Odoo 18Configuration of Python and SQL Constraints in Odoo 18
Configuration of Python and SQL Constraints in Odoo 18
Celine George
How to Add Custom Fields to Configuration Settings in Odoo 18
How to Add Custom Fields to  Configuration Settings in Odoo 18How to Add Custom Fields to  Configuration Settings in Odoo 18
How to Add Custom Fields to Configuration Settings in Odoo 18
Celine George
How to Manage Abandoned Cart in Odoo 17 Website
How to Manage Abandoned Cart in Odoo 17 WebsiteHow to Manage Abandoned Cart in Odoo 17 Website
How to Manage Abandoned Cart in Odoo 17 Website
Celine George
Analysis of Conf File Parameters in the Odoo 18
Analysis of Conf File Parameters in the Odoo 18Analysis of Conf File Parameters in the Odoo 18
Analysis of Conf File Parameters in the Odoo 18
Celine George
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷sPurchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Celine George
Analysis of Conf File Parameters in Odoo 17
Analysis of Conf File Parameters in Odoo 17Analysis of Conf File Parameters in Odoo 17
Analysis of Conf File Parameters in Odoo 17
Celine George
How to Manage Check Out Process in Odoo 17 Website
How to Manage Check Out Process in Odoo 17 WebsiteHow to Manage Check Out Process in Odoo 17 Website
How to Manage Check Out Process in Odoo 17 Website
Celine George
Managing Online Signature and Payment with Odoo 17
Managing Online Signature and Payment with Odoo 17Managing Online Signature and Payment with Odoo 17
Managing Online Signature and Payment with Odoo 17
Celine George
Recruitment in the Odoo 17 - Odoo 17 際際滷s
Recruitment in the Odoo 17 - Odoo 17 際際滷sRecruitment in the Odoo 17 - Odoo 17 際際滷s
Recruitment in the Odoo 17 - Odoo 17 際際滷s
Celine George
How to Setup Company Data in Odoo 17 Accounting App
How to Setup Company Data in Odoo 17 Accounting AppHow to Setup Company Data in Odoo 17 Accounting App
How to Setup Company Data in Odoo 17 Accounting App
Celine George
How to Install Odoo 18 with Pycharm - Odoo 18 際際滷s
How to Install Odoo 18 with Pycharm - Odoo 18 際際滷sHow to Install Odoo 18 with Pycharm - Odoo 18 際際滷s
How to Install Odoo 18 with Pycharm - Odoo 18 際際滷s
Celine George
How to Manage Purchase Order Approval in Odoo 18
How to Manage Purchase Order Approval in Odoo 18How to Manage Purchase Order Approval in Odoo 18
How to Manage Purchase Order Approval in Odoo 18
Celine George
How to Configure Outgoing and Incoming mail servers in Odoo 18
How to Configure Outgoing and Incoming mail servers in Odoo 18How to Configure Outgoing and Incoming mail servers in Odoo 18
How to Configure Outgoing and Incoming mail servers in Odoo 18
Celine George
How to Grant Discounts in Sale Order Lines in Odoo 18 Sales
How to Grant Discounts in Sale Order Lines in Odoo 18 SalesHow to Grant Discounts in Sale Order Lines in Odoo 18 Sales
How to Grant Discounts in Sale Order Lines in Odoo 18 Sales
Celine George
URLS and routing in odoo 18 - Odoo 際際滷s
URLS and routing in odoo 18 - Odoo 際際滷sURLS and routing in odoo 18 - Odoo 際際滷s
URLS and routing in odoo 18 - Odoo 際際滷s
Celine George
Comparing RFQ Lines for the best price in Odoo 17
Comparing RFQ Lines for the best price in Odoo 17Comparing RFQ Lines for the best price in Odoo 17
Comparing RFQ Lines for the best price in Odoo 17
Celine George
List View Attributes in Odoo 18 - Odoo 際際滷s
List View Attributes in Odoo 18 - Odoo 際際滷sList View Attributes in Odoo 18 - Odoo 際際滷s
List View Attributes in Odoo 18 - Odoo 際際滷s
Celine George
How to Set Default Terms and Conditions in Odoo 17 Accounting
How to Set Default Terms and Conditions in Odoo 17 AccountingHow to Set Default Terms and Conditions in Odoo 17 Accounting
How to Set Default Terms and Conditions in Odoo 17 Accounting
Celine George
Enhance Your Quotations by Sections, Notes, and Subtotals in Odoo Sales
Enhance Your Quotations by Sections, Notes, and Subtotals in Odoo SalesEnhance Your Quotations by Sections, Notes, and Subtotals in Odoo Sales
Enhance Your Quotations by Sections, Notes, and Subtotals in Odoo Sales
Celine George
What are the Views in Odoo 18 Purchase - Odoo 際際滷s
What are the Views in Odoo 18 Purchase - Odoo 際際滷sWhat are the Views in Odoo 18 Purchase - Odoo 際際滷s
What are the Views in Odoo 18 Purchase - Odoo 際際滷s
Celine George
Configuration of Python and SQL Constraints in Odoo 18
Configuration of Python and SQL Constraints in Odoo 18Configuration of Python and SQL Constraints in Odoo 18
Configuration of Python and SQL Constraints in Odoo 18
Celine George
How to Add Custom Fields to Configuration Settings in Odoo 18
How to Add Custom Fields to  Configuration Settings in Odoo 18How to Add Custom Fields to  Configuration Settings in Odoo 18
How to Add Custom Fields to Configuration Settings in Odoo 18
Celine George
How to Manage Abandoned Cart in Odoo 17 Website
How to Manage Abandoned Cart in Odoo 17 WebsiteHow to Manage Abandoned Cart in Odoo 17 Website
How to Manage Abandoned Cart in Odoo 17 Website
Celine George

Recently uploaded (20)

Knownsense 2025 Finals-U-25 General Quiz.pdf
Knownsense 2025 Finals-U-25 General Quiz.pdfKnownsense 2025 Finals-U-25 General Quiz.pdf
Knownsense 2025 Finals-U-25 General Quiz.pdf
Pragya - UEM Kolkata Quiz Club
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptx
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptxANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptx
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptx
PRADEEP ABOTHU
Unit No 4- Chemotherapy of Malignancy.pptx
Unit No  4- Chemotherapy of Malignancy.pptxUnit No  4- Chemotherapy of Malignancy.pptx
Unit No 4- Chemotherapy of Malignancy.pptx
Ashish Umale
Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...
 Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ... Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...
Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...
coreylewis960
The basics of sentences session 9pptx.pptx
The basics of sentences session 9pptx.pptxThe basics of sentences session 9pptx.pptx
The basics of sentences session 9pptx.pptx
heathfieldcps1
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Sue Beckingham
Design approaches and ethical challenges in Artificial Intelligence tools for...
Design approaches and ethical challenges in Artificial Intelligence tools for...Design approaches and ethical challenges in Artificial Intelligence tools for...
Design approaches and ethical challenges in Artificial Intelligence tools for...
Yannis
Gold Spot Dairy Store Jordan Minnesota 55352
Gold Spot Dairy Store Jordan Minnesota 55352Gold Spot Dairy Store Jordan Minnesota 55352
Gold Spot Dairy Store Jordan Minnesota 55352
Forklift Trucks in Minnesota
MIPLM subject matter expert Nicos Raftis
MIPLM subject matter expert Nicos RaftisMIPLM subject matter expert Nicos Raftis
MIPLM subject matter expert Nicos Raftis
MIPLM
Early 20th Century Modern Art: Movements and Artists
Early 20th Century Modern Art: Movements and ArtistsEarly 20th Century Modern Art: Movements and Artists
Early 20th Century Modern Art: Movements and Artists
Damian T. Gordon
Chapter 6. Business and Corporate Strategy Formulation.pdf
Chapter 6. Business and Corporate Strategy Formulation.pdfChapter 6. Business and Corporate Strategy Formulation.pdf
Chapter 6. Business and Corporate Strategy Formulation.pdf
Rommel Regala
EDL 290F Week 5 - Facing Headwinds and Hairpin Turns (2025).pdf
EDL 290F Week 5  - Facing Headwinds and Hairpin Turns (2025).pdfEDL 290F Week 5  - Facing Headwinds and Hairpin Turns (2025).pdf
EDL 290F Week 5 - Facing Headwinds and Hairpin Turns (2025).pdf
Liz Walsh-Trevino
Knownsense 2025 prelims- U-25 General Quiz.pdf
Knownsense 2025 prelims- U-25 General Quiz.pdfKnownsense 2025 prelims- U-25 General Quiz.pdf
Knownsense 2025 prelims- U-25 General Quiz.pdf
Pragya - UEM Kolkata Quiz Club
MIPLM subject matter expert Sascha Kamhuber
MIPLM subject matter expert Sascha KamhuberMIPLM subject matter expert Sascha Kamhuber
MIPLM subject matter expert Sascha Kamhuber
MIPLM
MIPLM subject matter expert Dr Robert Klinski
MIPLM subject matter expert Dr Robert KlinskiMIPLM subject matter expert Dr Robert Klinski
MIPLM subject matter expert Dr Robert Klinski
MIPLM
MIPLM subject matter expert Dr Alihan Kaya
MIPLM subject matter expert Dr Alihan KayaMIPLM subject matter expert Dr Alihan Kaya
MIPLM subject matter expert Dr Alihan Kaya
MIPLM
UTI Quinolones by Mrs. Manjushri Dabhade
UTI Quinolones by Mrs. Manjushri DabhadeUTI Quinolones by Mrs. Manjushri Dabhade
UTI Quinolones by Mrs. Manjushri Dabhade
Dabhade madam Dabhade
compiler design BCS613C question bank 2022 scheme
compiler design BCS613C question bank 2022 schemecompiler design BCS613C question bank 2022 scheme
compiler design BCS613C question bank 2022 scheme
Suvarna Hiremath
20250402 ACCA TeamScienceAIEra 20250402 v10.pptx
20250402 ACCA TeamScienceAIEra 20250402 v10.pptx20250402 ACCA TeamScienceAIEra 20250402 v10.pptx
20250402 ACCA TeamScienceAIEra 20250402 v10.pptx
home
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptx
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptxANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptx
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptx
PRADEEP ABOTHU
Unit No 4- Chemotherapy of Malignancy.pptx
Unit No  4- Chemotherapy of Malignancy.pptxUnit No  4- Chemotherapy of Malignancy.pptx
Unit No 4- Chemotherapy of Malignancy.pptx
Ashish Umale
Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...
 Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ... Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...
Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...
coreylewis960
The basics of sentences session 9pptx.pptx
The basics of sentences session 9pptx.pptxThe basics of sentences session 9pptx.pptx
The basics of sentences session 9pptx.pptx
heathfieldcps1
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Sue Beckingham
Design approaches and ethical challenges in Artificial Intelligence tools for...
Design approaches and ethical challenges in Artificial Intelligence tools for...Design approaches and ethical challenges in Artificial Intelligence tools for...
Design approaches and ethical challenges in Artificial Intelligence tools for...
Yannis
MIPLM subject matter expert Nicos Raftis
MIPLM subject matter expert Nicos RaftisMIPLM subject matter expert Nicos Raftis
MIPLM subject matter expert Nicos Raftis
MIPLM
Early 20th Century Modern Art: Movements and Artists
Early 20th Century Modern Art: Movements and ArtistsEarly 20th Century Modern Art: Movements and Artists
Early 20th Century Modern Art: Movements and Artists
Damian T. Gordon
Chapter 6. Business and Corporate Strategy Formulation.pdf
Chapter 6. Business and Corporate Strategy Formulation.pdfChapter 6. Business and Corporate Strategy Formulation.pdf
Chapter 6. Business and Corporate Strategy Formulation.pdf
Rommel Regala
EDL 290F Week 5 - Facing Headwinds and Hairpin Turns (2025).pdf
EDL 290F Week 5  - Facing Headwinds and Hairpin Turns (2025).pdfEDL 290F Week 5  - Facing Headwinds and Hairpin Turns (2025).pdf
EDL 290F Week 5 - Facing Headwinds and Hairpin Turns (2025).pdf
Liz Walsh-Trevino
MIPLM subject matter expert Sascha Kamhuber
MIPLM subject matter expert Sascha KamhuberMIPLM subject matter expert Sascha Kamhuber
MIPLM subject matter expert Sascha Kamhuber
MIPLM
MIPLM subject matter expert Dr Robert Klinski
MIPLM subject matter expert Dr Robert KlinskiMIPLM subject matter expert Dr Robert Klinski
MIPLM subject matter expert Dr Robert Klinski
MIPLM
MIPLM subject matter expert Dr Alihan Kaya
MIPLM subject matter expert Dr Alihan KayaMIPLM subject matter expert Dr Alihan Kaya
MIPLM subject matter expert Dr Alihan Kaya
MIPLM
UTI Quinolones by Mrs. Manjushri Dabhade
UTI Quinolones by Mrs. Manjushri DabhadeUTI Quinolones by Mrs. Manjushri Dabhade
UTI Quinolones by Mrs. Manjushri Dabhade
Dabhade madam Dabhade
compiler design BCS613C question bank 2022 scheme
compiler design BCS613C question bank 2022 schemecompiler design BCS613C question bank 2022 scheme
compiler design BCS613C question bank 2022 scheme
Suvarna Hiremath
20250402 ACCA TeamScienceAIEra 20250402 v10.pptx
20250402 ACCA TeamScienceAIEra 20250402 v10.pptx20250402 ACCA TeamScienceAIEra 20250402 v10.pptx
20250402 ACCA TeamScienceAIEra 20250402 v10.pptx
home

How to make a component and add it to systray in Odoo

  • 1. How to make a component and add it to systray in Odoo Enterprise
  • 2. Introduction Enterprise The system tray icon in Odoo serves as a quick-access feature, allowing users to easily interact with certain functionalities of the Odoo system without navigating through the main interface. It is located in the notification bar. The icons in the menu may vary according to the modules installed. The marked area indicates the systray icons
  • 3. Enterprise Lets check how can we make a new icon to show on the systray menu and add action to it. We can create a module directory for it. The structure will be as follows
  • 4. Enterprise Inside the manifest, register the js and xml files as 'assets': { 'web.assets_backend': [ 'systray_icon/static/src/js/systray_icon.js', 'systray_icon/static/src/xml/systray_icon.xml', ] }
  • 5. Enterprise The file systray_icon.xml contains the xml code for showing our custom icon in the view. <?xml version="1.0" encoding="UTF-8" ?> <templates xml:space="preserve"> <t t-name="systray_icon" owl="1"> <Dropdown> <t t-set-slot="toggler"> <div class="new_icon"> <div class="icon_div"> <div class="toggle-icon" role="button"> <i id='create_order' class="fa fa-shopping-cart fa-1.5x" role="img" aria-label="Sale/Purchase Order"/> </div></div></div></t> <t t-set-slot="default"> <DropdownItem><div t-on-click="_openSaleModel"> Sale Order </div></DropdownItem> <DropdownItem><div t-on-click="_openPurchaseModel">Purchase Order</div></DropdownItem> </t> </Dropdown> </t> </templates>
  • 6. Enterprise This will make a new shopping cart icon to be visible on the systray which will then give a dropdown menu containing two buttons as Sale Order and Purchase Order when clicked.
  • 7. Enterprise Now we need to define the Actions for the two buttons we added. Lets add a simple logic to open a form view to create new Sale order or Purchase Order for the respective buttons. For that, we type the code in js under static/src/js directory of the module. The very step is to add the line /** @odoo-module **/ and to import the registry, useService, Owl component, Dropdown and Dropdown Item. /** @odoo-module **/ import { registry } from "@web/core/registry"; import { useService } from "@web/core/utils/hooks"; import { Component } from "@odoo/owl"; import {Dropdown} from '@web/core/dropdown/dropdown'; import {DropdownItem} from '@web/core/dropdown/dropdown_item';
  • 8. Enterprise From the javascript code in Odoo, the classes are extended using extend keyword. This is used to create a new class or component from an existing class by inheriting all its properties and methods of the parent class. New methods can be defined or existing ones can be overridden or added with new functionalities. Here we create the new class SystrayIcon from the existing class Component as class SystrayIcon extends Component
  • 9. Enterprise Along with the setup(), we need to define the two onclick methods _openSaleModel and _openPurchaseModel we mentioned in the xml file. Both of them will open the form views of sale.order and purchase.order respectively. And for these click events, we use this.action.doAction() method to open a window action and pass the details such as type, name, res_model, view_mode, etc about the view we need to open.
  • 10. Enterprise class SystrayIcon extends Component { setup() { super.setup(...arguments); this.action = useService("action"); } _openSaleModel() { this.action.doAction({ type: "ir.actions.act_window", name: "Sale Order", res_model: "sale.order", view_mode: "form", views: [[false, "form"]], target: "new", }); } _openPurchaseModel(){ this.action.doAction({ type: "ir.actions.act_window", name: "Purchase Order", res_model: "purchase.order", view_mode: "form", views: [[false, "form"]], target: "new", }); } }
  • 11. Enterprise Now, give the template for the new class with the same template name we created in xml. And register the component and systrayItem as SystrayIcon.template = "systray_icon"; SystrayIcon.components = {Dropdown, DropdownItem }; export const systrayItem = { Component: SystrayIcon,}; registry.category("systray").add("SystrayIcon", systrayItem, { sequence: 1 });
  • 12. Enterprise Now on clicking the first button Sale Order from the shopping cart systray icon, we get
  • 13. Enterprise Likewise, for the Purchase Order button click, we get
  • 14. 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