diff --git a/master_search_systray/README.rst b/master_search_systray/README.rst new file mode 100755 index 000000000..d9cf958bd --- /dev/null +++ b/master_search_systray/README.rst @@ -0,0 +1,45 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Advanced Search In Systray +========================== +* Master Search Systray enables Users to search the records based on name in any Module. + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + + +Credits +------- +* Developers: (V17) Anfas Faisal K, + (V18) Adarsh K, +* Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: `` \ No newline at end of file diff --git a/master_search_systray/__init__.py b/master_search_systray/__init__.py new file mode 100755 index 000000000..771926edd --- /dev/null +++ b/master_search_systray/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Adarsh K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import controllers +from . import models diff --git a/master_search_systray/__manifest__.py b/master_search_systray/__manifest__.py new file mode 100755 index 000000000..a1c23dbcc --- /dev/null +++ b/master_search_systray/__manifest__.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Adarsh K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': 'Advanced Search In Systray', + 'version': '18.0.1.0.0', + 'category': 'Extra Tools', + 'summary': "Advanced Search in Systray enables Users to search the records" + "based on name in any Module.", + 'description': "The Advanced Search Systray is a feature-rich Odoo module " + "designed to elevate the search experience for users. With " + "a focus on simplicity and effectiveness, this tool allows " + "users to conduct searches seamlessly across all modules " + "within the Odoo platform.", + 'author': "Cybrosys Techno Solutions", + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'depends': ['base'], + 'website': "https://www.cybrosys.com", + 'data': [ + 'views/res_config_settings_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'master_search_systray/static/src/css/style.css', + 'master_search_systray/static/src/scss/master_search_bar.scss', + 'master_search_systray/static/src/xml/master_search_icon.xml', + 'master_search_systray/static/src/js/master_search_icon.js', + 'master_search_systray/static/src/js/MasterSearchDialog.js', + 'master_search_systray/static/src/xml/MasterSearchDialog.xml' + ], + }, + 'images': ['static/description/banner.png'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/master_search_systray/controllers/__init__.py b/master_search_systray/controllers/__init__.py new file mode 100755 index 000000000..b95de347a --- /dev/null +++ b/master_search_systray/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Adarsh K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import master_search_systray diff --git a/master_search_systray/controllers/master_search_systray.py b/master_search_systray/controllers/master_search_systray.py new file mode 100755 index 000000000..babcc0c91 --- /dev/null +++ b/master_search_systray/controllers/master_search_systray.py @@ -0,0 +1,136 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Adarsh K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +import psycopg2 +from ast import literal_eval +from odoo import http +from odoo.http import request + + +class MasterSearch(http.Controller): + """Controller for the master search functionality.""" + + @http.route("/master/search", methods=["POST"], type="json", + auth="user") + def master_search(self, query): + """ + Perform a master search across all models in the system based on the + given query. + + This method performs a search across multiple models in the Odoo + system using the provided query string. The search is conducted on + all stored fields within the models associated with the installed + modules configured in the system. + """ + data = [] + # Check if the query is not empty + if query != '': + # Get all models in the system in the res.config.settings + config_settings = request.env['ir.config_parameter'].sudo().get_param( + 'master_search_systray.master_search_installed_ids') + if config_settings: + config_settings_str = literal_eval(config_settings) + # Convert to list of integers + config_settings_ids = [int(id_str) for id_str in config_settings_str] + # Fetch ir.module.module records for the selected module IDs + config_modules = request.env['ir.module.module'].sudo().search([ + ('id', 'in', config_settings_ids)]) + # Collect module names from master_search_values + module_names = [module.name for module in config_modules] + # Fetch ir.module.module records for the selected module names + modules = request.env['ir.module.module'].sudo().search([ + ('name', 'in', module_names)]) + for module in modules: + models = request.env['ir.model'].sudo().search([]) + filtered_models = models.filtered( + lambda m: module.name in m.modules) + # Loop through each model to perform the search + for rec in filtered_models: + # Filter out fields that are not stored in the database + fields = rec.field_id.filtered(lambda f: f.store).mapped('name') + # Check if the model's main name field is in the stored fields + if rec._rec_name in fields: + # Temporary list to store results for the current model + temp_data = [] + try: + # Execute a raw SQL query to search records in the current model + request.env.cr.execute( + "SELECT * FROM %s WHERE name ILIKE '%s'" % ( + rec.model.replace('.', '_'), '%' + query + '%')) + # request.env.cr.execute( + # "SELECT * FROM %s WHERE name::text ILIKE '%s'" % ( + # rec.model.replace('.', '_'), '%' + query + '%')) + # Fetch the results as a list of dictionaries + records = request.env.cr.dictfetchall() + # If there are matching records, process and append them to temp_data + if len(records) >= 1: + temp_data.append({ + 'title': rec.name, + 'name': None, + 'id': None, + 'isChild': False, + 'isParent': True, + 'model': rec.model + }) + for val in records: + temp_data.append({ + 'title': None, + 'name': val['name'], + 'id': val['id'], + 'isChild': True, + 'isParent': False, + 'model': rec.model + }) + # Append temp_data to the main result data + if records: + data.append(temp_data) + request.env.cr.commit() + except psycopg2.Error: + request.env.cr.rollback() + try: + # If an exception occurs, attempt to perform a search using Odoo API + records = request.env[rec.model].search( + [('name', 'ilike', query)]) + temp_data = [] + # If there are matching records, process and append them to temp_data + if records: + temp_data.append({ + 'title': rec.name, + 'name': None, + 'id': None, + 'isChild': False, + 'isParent': True, + 'model': rec.model + }) + for val in records: + temp_data.append({ + 'title': None, + 'name': val['name'], + 'id': val['id'], + 'isChild': True, + 'isParent': False, + 'model': rec.model + }) + data.append(temp_data) + request.env.cr.commit() + except Exception as e: + request.env.cr.rollback() + return data diff --git a/master_search_systray/doc/RELEASE_NOTES.md b/master_search_systray/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..fdb9b6aff --- /dev/null +++ b/master_search_systray/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 20.11.2024 +#### Version 18.0.1.0.0 +#### ADD + +- Initial commit for Advanced Search In Systray diff --git a/master_search_systray/models/__init__.py b/master_search_systray/models/__init__.py new file mode 100755 index 000000000..55ec69a30 --- /dev/null +++ b/master_search_systray/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Adarsh K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import res_config_settings diff --git a/master_search_systray/models/res_config_settings.py b/master_search_systray/models/res_config_settings.py new file mode 100755 index 000000000..ea4c61c5b --- /dev/null +++ b/master_search_systray/models/res_config_settings.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Adarsh K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, fields, models +from ast import literal_eval + + +class ResConfigSettings(models.TransientModel): + """ + This class extends the 'res.config.settings' model in Odoo to add a new + Many2many field for selecting installed modules that will be included in + the master search functionality. + """ + _inherit = "res.config.settings" + + master_search_installed_ids = fields.Many2many( + 'ir.module.module', + string='Installed Modules', + help="Select the installed modules you want to include in the master " + "search.", + domain="[('state', '=', 'installed')]" + ) + + @api.model + def get_values(self): + """ + Retrieve the current values for the configuration settings, including + the selected installed modules for the master search. + """ + res = super(ResConfigSettings, self).get_values() + master_search_installed_ids = self.env[ + 'ir.config_parameter'].sudo().get_param( + 'master_search_systray.master_search_installed_ids') + if master_search_installed_ids: + res.update({ + 'master_search_installed_ids': [ + (6, 0, literal_eval(master_search_installed_ids))] + }) + return res + + def set_values(self): + """ + Save the current values for the configuration settings, including the + selected installed modules for the master search. + """ + res = super(ResConfigSettings, self).set_values() + self.env['ir.config_parameter'].sudo().set_param( + 'master_search_systray.master_search_installed_ids', + self.master_search_installed_ids.ids) + return res diff --git a/master_search_systray/static/description/assets/cybro-icon.png b/master_search_systray/static/description/assets/cybro-icon.png new file mode 100644 index 000000000..06e73e11d Binary files /dev/null and b/master_search_systray/static/description/assets/cybro-icon.png differ diff --git a/master_search_systray/static/description/assets/cybro-odoo.png b/master_search_systray/static/description/assets/cybro-odoo.png new file mode 100644 index 000000000..ed02e07a4 Binary files /dev/null and b/master_search_systray/static/description/assets/cybro-odoo.png differ diff --git a/master_search_systray/static/description/assets/h2.png b/master_search_systray/static/description/assets/h2.png new file mode 100644 index 000000000..0bfc4707d Binary files /dev/null and b/master_search_systray/static/description/assets/h2.png differ diff --git a/master_search_systray/static/description/assets/icons/arrows-repeat.svg b/master_search_systray/static/description/assets/icons/arrows-repeat.svg new file mode 100644 index 000000000..1d7efabc5 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/arrows-repeat.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/banner-1.png b/master_search_systray/static/description/assets/icons/banner-1.png new file mode 100644 index 000000000..c180db172 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/banner-1.png differ diff --git a/master_search_systray/static/description/assets/icons/banner-2.svg b/master_search_systray/static/description/assets/icons/banner-2.svg new file mode 100644 index 000000000..e606d97d9 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/banner-2.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/banner-bg.png b/master_search_systray/static/description/assets/icons/banner-bg.png new file mode 100644 index 000000000..a8238d3c0 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/banner-bg.png differ diff --git a/master_search_systray/static/description/assets/icons/banner-bg.svg b/master_search_systray/static/description/assets/icons/banner-bg.svg new file mode 100644 index 000000000..b1378103e --- /dev/null +++ b/master_search_systray/static/description/assets/icons/banner-bg.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/banner-call.svg b/master_search_systray/static/description/assets/icons/banner-call.svg new file mode 100644 index 000000000..96c687e81 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/banner-call.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/master_search_systray/static/description/assets/icons/banner-mail.svg b/master_search_systray/static/description/assets/icons/banner-mail.svg new file mode 100644 index 000000000..cbf0d158d --- /dev/null +++ b/master_search_systray/static/description/assets/icons/banner-mail.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/master_search_systray/static/description/assets/icons/banner-pattern.svg b/master_search_systray/static/description/assets/icons/banner-pattern.svg new file mode 100644 index 000000000..9c1c7e101 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/banner-pattern.svg @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/banner-promo.svg b/master_search_systray/static/description/assets/icons/banner-promo.svg new file mode 100644 index 000000000..d52791b11 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/banner-promo.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/brand-pair.svg b/master_search_systray/static/description/assets/icons/brand-pair.svg new file mode 100644 index 000000000..d8db7fc1e --- /dev/null +++ b/master_search_systray/static/description/assets/icons/brand-pair.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/check.png b/master_search_systray/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/master_search_systray/static/description/assets/icons/check.png differ diff --git a/master_search_systray/static/description/assets/icons/chevron.png b/master_search_systray/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/chevron.png differ diff --git a/master_search_systray/static/description/assets/icons/close-icon.svg b/master_search_systray/static/description/assets/icons/close-icon.svg new file mode 100644 index 000000000..df8cce37a --- /dev/null +++ b/master_search_systray/static/description/assets/icons/close-icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/master_search_systray/static/description/assets/icons/cogs.png b/master_search_systray/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/cogs.png differ diff --git a/master_search_systray/static/description/assets/icons/collabarate-icon.svg b/master_search_systray/static/description/assets/icons/collabarate-icon.svg new file mode 100644 index 000000000..dd4e10518 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/collabarate-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/master_search_systray/static/description/assets/icons/consultation.png b/master_search_systray/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/master_search_systray/static/description/assets/icons/consultation.png differ diff --git a/master_search_systray/static/description/assets/icons/cybro-logo.png b/master_search_systray/static/description/assets/icons/cybro-logo.png new file mode 100644 index 000000000..ff4b78220 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/cybro-logo.png differ diff --git a/master_search_systray/static/description/assets/icons/down.svg b/master_search_systray/static/description/assets/icons/down.svg new file mode 100644 index 000000000..f21c36271 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/master_search_systray/static/description/assets/icons/ecom-black.png b/master_search_systray/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/ecom-black.png differ diff --git a/master_search_systray/static/description/assets/icons/education-black.png b/master_search_systray/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/master_search_systray/static/description/assets/icons/education-black.png differ diff --git a/master_search_systray/static/description/assets/icons/faq.png b/master_search_systray/static/description/assets/icons/faq.png new file mode 100644 index 000000000..4250b5b81 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/faq.png differ diff --git a/master_search_systray/static/description/assets/icons/feature-icon.svg b/master_search_systray/static/description/assets/icons/feature-icon.svg new file mode 100644 index 000000000..fa0ea6850 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/feature-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/feature.png b/master_search_systray/static/description/assets/icons/feature.png new file mode 100644 index 000000000..ac7a785c0 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/feature.png differ diff --git a/master_search_systray/static/description/assets/icons/gear.svg b/master_search_systray/static/description/assets/icons/gear.svg new file mode 100644 index 000000000..0cc66b6ea --- /dev/null +++ b/master_search_systray/static/description/assets/icons/gear.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/hero.gif b/master_search_systray/static/description/assets/icons/hero.gif new file mode 100644 index 000000000..b66493de2 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/hero.gif differ diff --git a/master_search_systray/static/description/assets/icons/hire-odoo.svg b/master_search_systray/static/description/assets/icons/hire-odoo.svg new file mode 100644 index 000000000..e1ac089b0 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/hire-odoo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/hotel-black.png b/master_search_systray/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/master_search_systray/static/description/assets/icons/hotel-black.png differ diff --git a/master_search_systray/static/description/assets/icons/license.png b/master_search_systray/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/master_search_systray/static/description/assets/icons/license.png differ diff --git a/master_search_systray/static/description/assets/icons/life-ring-icon.svg b/master_search_systray/static/description/assets/icons/life-ring-icon.svg new file mode 100644 index 000000000..3ae6e1d89 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/life-ring-icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/lifebuoy.png b/master_search_systray/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/master_search_systray/static/description/assets/icons/lifebuoy.png differ diff --git a/master_search_systray/static/description/assets/icons/mail.svg b/master_search_systray/static/description/assets/icons/mail.svg new file mode 100644 index 000000000..1eedde695 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/mail.svg @@ -0,0 +1,3 @@ + + + diff --git a/master_search_systray/static/description/assets/icons/manufacturing-black.png b/master_search_systray/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/master_search_systray/static/description/assets/icons/manufacturing-black.png differ diff --git a/master_search_systray/static/description/assets/icons/notes.png b/master_search_systray/static/description/assets/icons/notes.png new file mode 100644 index 000000000..ee5e95404 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/notes.png differ diff --git a/master_search_systray/static/description/assets/icons/notification icon.svg b/master_search_systray/static/description/assets/icons/notification icon.svg new file mode 100644 index 000000000..053189973 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/notification icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/odoo-consultancy.svg b/master_search_systray/static/description/assets/icons/odoo-consultancy.svg new file mode 100644 index 000000000..e05f65bde --- /dev/null +++ b/master_search_systray/static/description/assets/icons/odoo-consultancy.svg @@ -0,0 +1,4 @@ + + + + diff --git a/master_search_systray/static/description/assets/icons/odoo-licencing.svg b/master_search_systray/static/description/assets/icons/odoo-licencing.svg new file mode 100644 index 000000000..2606c88b0 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/odoo-licencing.svg @@ -0,0 +1,3 @@ + + + diff --git a/master_search_systray/static/description/assets/icons/odoo-logo.png b/master_search_systray/static/description/assets/icons/odoo-logo.png new file mode 100644 index 000000000..0e4d0eb5a Binary files /dev/null and b/master_search_systray/static/description/assets/icons/odoo-logo.png differ diff --git a/master_search_systray/static/description/assets/icons/patter.svg b/master_search_systray/static/description/assets/icons/patter.svg new file mode 100644 index 000000000..25c9c0a8f --- /dev/null +++ b/master_search_systray/static/description/assets/icons/patter.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/pattern1.png b/master_search_systray/static/description/assets/icons/pattern1.png new file mode 100644 index 000000000..09ab0fb2d Binary files /dev/null and b/master_search_systray/static/description/assets/icons/pattern1.png differ diff --git a/master_search_systray/static/description/assets/icons/pos-black.png b/master_search_systray/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/pos-black.png differ diff --git a/master_search_systray/static/description/assets/icons/puzzle-piece-icon.svg b/master_search_systray/static/description/assets/icons/puzzle-piece-icon.svg new file mode 100644 index 000000000..3e9ad9373 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/puzzle-piece-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/puzzle.png b/master_search_systray/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/puzzle.png differ diff --git a/master_search_systray/static/description/assets/icons/replace-icon.svg b/master_search_systray/static/description/assets/icons/replace-icon.svg new file mode 100644 index 000000000..d0e3a7af1 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/replace-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/restaurant-black.png b/master_search_systray/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/restaurant-black.png differ diff --git a/master_search_systray/static/description/assets/icons/screenshot-main.png b/master_search_systray/static/description/assets/icons/screenshot-main.png new file mode 100644 index 000000000..575f8e676 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/screenshot-main.png differ diff --git a/master_search_systray/static/description/assets/icons/screenshot.png b/master_search_systray/static/description/assets/icons/screenshot.png new file mode 100644 index 000000000..cef272529 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/screenshot.png differ diff --git a/master_search_systray/static/description/assets/icons/service-black.png b/master_search_systray/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/master_search_systray/static/description/assets/icons/service-black.png differ diff --git a/master_search_systray/static/description/assets/icons/skype-fill.svg b/master_search_systray/static/description/assets/icons/skype-fill.svg new file mode 100644 index 000000000..c17423639 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/skype-fill.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/skype.png b/master_search_systray/static/description/assets/icons/skype.png new file mode 100644 index 000000000..51b409fb3 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/skype.png differ diff --git a/master_search_systray/static/description/assets/icons/skype.svg b/master_search_systray/static/description/assets/icons/skype.svg new file mode 100644 index 000000000..df3dad39b --- /dev/null +++ b/master_search_systray/static/description/assets/icons/skype.svg @@ -0,0 +1,3 @@ + + + diff --git a/master_search_systray/static/description/assets/icons/star-1.svg b/master_search_systray/static/description/assets/icons/star-1.svg new file mode 100644 index 000000000..7e55ab162 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/star-1.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/star-2.svg b/master_search_systray/static/description/assets/icons/star-2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/master_search_systray/static/description/assets/icons/star-2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/support.png b/master_search_systray/static/description/assets/icons/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/support.png differ diff --git a/master_search_systray/static/description/assets/icons/test-1 - Copy.png b/master_search_systray/static/description/assets/icons/test-1 - Copy.png new file mode 100644 index 000000000..f6a902663 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/test-1 - Copy.png differ diff --git a/master_search_systray/static/description/assets/icons/test-1.png b/master_search_systray/static/description/assets/icons/test-1.png new file mode 100644 index 000000000..0908add2b Binary files /dev/null and b/master_search_systray/static/description/assets/icons/test-1.png differ diff --git a/master_search_systray/static/description/assets/icons/test-2.png b/master_search_systray/static/description/assets/icons/test-2.png new file mode 100644 index 000000000..4671fe91e Binary files /dev/null and b/master_search_systray/static/description/assets/icons/test-2.png differ diff --git a/master_search_systray/static/description/assets/icons/trading-black.png b/master_search_systray/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/trading-black.png differ diff --git a/master_search_systray/static/description/assets/icons/training.png b/master_search_systray/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/master_search_systray/static/description/assets/icons/training.png differ diff --git a/master_search_systray/static/description/assets/icons/translate.svg b/master_search_systray/static/description/assets/icons/translate.svg new file mode 100644 index 000000000..af9c8a1aa --- /dev/null +++ b/master_search_systray/static/description/assets/icons/translate.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/update.png b/master_search_systray/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/master_search_systray/static/description/assets/icons/update.png differ diff --git a/master_search_systray/static/description/assets/icons/user.png b/master_search_systray/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/master_search_systray/static/description/assets/icons/user.png differ diff --git a/master_search_systray/static/description/assets/icons/video.png b/master_search_systray/static/description/assets/icons/video.png new file mode 100644 index 000000000..576705b17 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/video.png differ diff --git a/master_search_systray/static/description/assets/icons/whatsapp.png b/master_search_systray/static/description/assets/icons/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/master_search_systray/static/description/assets/icons/whatsapp.png differ diff --git a/master_search_systray/static/description/assets/icons/wrench-icon.svg b/master_search_systray/static/description/assets/icons/wrench-icon.svg new file mode 100644 index 000000000..174b5a465 --- /dev/null +++ b/master_search_systray/static/description/assets/icons/wrench-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/master_search_systray/static/description/assets/icons/wrench.png b/master_search_systray/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/master_search_systray/static/description/assets/icons/wrench.png differ diff --git a/master_search_systray/static/description/assets/modules/1.gif b/master_search_systray/static/description/assets/modules/1.gif new file mode 100644 index 000000000..ae3a880a2 Binary files /dev/null and b/master_search_systray/static/description/assets/modules/1.gif differ diff --git a/master_search_systray/static/description/assets/modules/2.gif b/master_search_systray/static/description/assets/modules/2.gif new file mode 100644 index 000000000..d19e2b352 Binary files /dev/null and b/master_search_systray/static/description/assets/modules/2.gif differ diff --git a/master_search_systray/static/description/assets/modules/3.png b/master_search_systray/static/description/assets/modules/3.png new file mode 100644 index 000000000..8513873ea Binary files /dev/null and b/master_search_systray/static/description/assets/modules/3.png differ diff --git a/master_search_systray/static/description/assets/modules/4.png b/master_search_systray/static/description/assets/modules/4.png new file mode 100644 index 000000000..3bedf7981 Binary files /dev/null and b/master_search_systray/static/description/assets/modules/4.png differ diff --git a/master_search_systray/static/description/assets/modules/5.png b/master_search_systray/static/description/assets/modules/5.png new file mode 100644 index 000000000..0e311ca87 Binary files /dev/null and b/master_search_systray/static/description/assets/modules/5.png differ diff --git a/master_search_systray/static/description/assets/modules/6.jpg b/master_search_systray/static/description/assets/modules/6.jpg new file mode 100644 index 000000000..67c7f7062 Binary files /dev/null and b/master_search_systray/static/description/assets/modules/6.jpg differ diff --git a/master_search_systray/static/description/assets/screenshots/ss1.png b/master_search_systray/static/description/assets/screenshots/ss1.png new file mode 100644 index 000000000..bb96a8d7e Binary files /dev/null and b/master_search_systray/static/description/assets/screenshots/ss1.png differ diff --git a/master_search_systray/static/description/assets/screenshots/ss2.png b/master_search_systray/static/description/assets/screenshots/ss2.png new file mode 100644 index 000000000..61c3527f7 Binary files /dev/null and b/master_search_systray/static/description/assets/screenshots/ss2.png differ diff --git a/master_search_systray/static/description/assets/screenshots/ss3.png b/master_search_systray/static/description/assets/screenshots/ss3.png new file mode 100644 index 000000000..21155c383 Binary files /dev/null and b/master_search_systray/static/description/assets/screenshots/ss3.png differ diff --git a/master_search_systray/static/description/assets/screenshots/ss4.png b/master_search_systray/static/description/assets/screenshots/ss4.png new file mode 100644 index 000000000..f6e0b25ed Binary files /dev/null and b/master_search_systray/static/description/assets/screenshots/ss4.png differ diff --git a/master_search_systray/static/description/assets/screenshots/ss5.png b/master_search_systray/static/description/assets/screenshots/ss5.png new file mode 100644 index 000000000..c11561a5a Binary files /dev/null and b/master_search_systray/static/description/assets/screenshots/ss5.png differ diff --git a/master_search_systray/static/description/assets/screenshots/ss6.png b/master_search_systray/static/description/assets/screenshots/ss6.png new file mode 100644 index 000000000..0b48c8142 Binary files /dev/null and b/master_search_systray/static/description/assets/screenshots/ss6.png differ diff --git a/master_search_systray/static/description/assets/screenshots/ss7.png b/master_search_systray/static/description/assets/screenshots/ss7.png new file mode 100644 index 000000000..9da8d1683 Binary files /dev/null and b/master_search_systray/static/description/assets/screenshots/ss7.png differ diff --git a/master_search_systray/static/description/assets/screenshots/ss8.png b/master_search_systray/static/description/assets/screenshots/ss8.png new file mode 100644 index 000000000..4a2484423 Binary files /dev/null and b/master_search_systray/static/description/assets/screenshots/ss8.png differ diff --git a/master_search_systray/static/description/assets/y18.jpg b/master_search_systray/static/description/assets/y18.jpg new file mode 100644 index 000000000..eea1714f2 Binary files /dev/null and b/master_search_systray/static/description/assets/y18.jpg differ diff --git a/master_search_systray/static/description/banner.png b/master_search_systray/static/description/banner.png new file mode 100644 index 000000000..e082e640c Binary files /dev/null and b/master_search_systray/static/description/banner.png differ diff --git a/master_search_systray/static/description/icon.png b/master_search_systray/static/description/icon.png new file mode 100644 index 000000000..db2f76e50 Binary files /dev/null and b/master_search_systray/static/description/icon.png differ diff --git a/master_search_systray/static/description/index.html b/master_search_systray/static/description/index.html new file mode 100644 index 000000000..a75508ce3 --- /dev/null +++ b/master_search_systray/static/description/index.html @@ -0,0 +1,998 @@ + + + + + + Advanced Search In Systray + + + + + + + + + + +
+
+ + + +
+
+ Community +
+
+ Enterprise +
+ + + + +
+
+ +
+
+
+
+

+ The module enables Users to search the records based on name in any Module. +

+

Advanced Search In Systray +

+
+
+ +
+ +
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+

Key + Highlights

+
+
+
+
+ +
+
+ Advance Search user +
+

+ Enable users to perform advanced searches seamlessly across all modules and menus, + allowing them to efficiently retrieve records from any part of the application. +

+
+
+
+
+
+ +
+
+ Intuitive Navigation +
+

+ Upon clicking on a specific record in the search results, users will be seamlessly + redirected to the corresponding module or menu, providing a streamlined and + intuitive navigation experience. +

+
+
+
+
+ +
+
+
+ Advanced Search In Systray +

+ Are you ready to make your business more + organized? +
Improve now! +

+ +
+
+ +
+
+
+ + + + +
+
+ +
+
+
+
+ acc_bg +
+ +
+
+
+
+

+ Master Search Management +

+
+
+

+ Go to Settings then Select Master Search Management. +

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ Select The Modules To Include In Your Master Search +

+
+
+

+ Note: Adding too many modules may significantly increase processing time. +

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ Search Icon +

+
+
+

+ Click on the Search Icon located in the top-right corner of the Systray. +

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ Input your desired search query and click the Search Icon to retrieve relevant results. +

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ You will get the results from here and by clicking the record from related menus. +

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ Clicking on the record will take you directly to the corresponding menu. +

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ Clicking on records outside of related menus. +

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ Clicking on the record will take you directly to the corresponding record. +

+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+ +
+

+ Advance Search user

+
+
+

+ Enable users to perform advanced searches seamlessly across all modules + and menus, allowing them to efficiently retrieve records from any part + of the application. +

+
+
+
+
+
+
+
+ +
+

+ Intuitive Navigation

+
+
+

+ Upon clicking on a specific record in the search results, users will be + seamlessly redirected to the corresponding module or menu, providing a + streamlined and intuitive navigation experience. +

+
+
+
+
+
+
+
+
+
+
+ +
+ +
+ +
+

+ When you click on a specific record in the search results, + the tool will automatically redirect you to the + corresponding module or menu. This provides a smooth and + intuitive navigation experience without the need to manually + browse through modules. +

+
+
+ +
+ +
+

+ Yes, this tool allows users to search across all modules and + menus within Odoo. You can retrieve records from any part of + the Odoo with a single search query. +

+
+
+
+ +
+
+
+
+
+
+ +
+
+

+ Latest Release 18.0.1.0.0 +

+ + 9th October, 2024 + +
+
+
+
+
+ Add +
+
+
+
    +
  • + Initial Commit +
  • + +
+
+
+
+
+
+
+
+
+
+ + + +
+

+ Related Products +

+ +
+ + +
+

+ Our Services

+ +
+ +
+
+ .... +
+
+ +
+ + +
+
+ + + + + + diff --git a/master_search_systray/static/src/css/style.css b/master_search_systray/static/src/css/style.css new file mode 100755 index 000000000..f84f187b5 --- /dev/null +++ b/master_search_systray/static/src/css/style.css @@ -0,0 +1,143 @@ +.search-button{ + background-color: white; + color: black; + border-radius: 4px; + border: none; + padding: 0.4rem 0.6rem; + font-size: 25px; +} + +.small-heading{ + padding-bottom: 0.5rem; + font-weight: bold; + margin-bottom: 0.5rem; + border-bottom: 1px solid; + display: flex; + justify-content: space-between; +} +.master-onboard_modal-container { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100vh; + background: rgba(9, 13, 17, 0.78); + -webkit-backdrop-filter: blur(9px); + backdrop-filter: blur(9px); + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + z-index: 999; +} + +.master_modal-container input { + height: 50px; + outline: none; + border: none; + font-size: 13px !important; + display: block; + width: 100%; + padding: 0.3125rem 0.625rem; + font-weight: 600; + line-height: 1.5; + color: #495057; + background-color: transparent; + background-clip: padding-box; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; +} + +.master_modal-container .o_input_dropdown { + width: 100%; +} + +.master_modal-container .o_field_tags { + border: none; + width: 100%; + padding: 0 !important; +} + +.master_modal-container .o-autocomplete--input { + display: block; + width: 100%; + padding: 0.375rem 2.25rem 0.375rem 0.75rem; + -moz-padding-start: calc(0.75rem - 3px); + font-size: 1rem; + font-weight: 400; + line-height: 1.5; + color: #212529; + background-color: #fff; + background-image: url(data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e); + background-repeat: no-repeat; + background-position: right 0.75rem center; + background-size: 16px 12px; + border-radius: 0.25rem; + transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; +} + +.master_modal-container .modal_content { + border-radius: unset; + background: #FFF; + -webkit-box-shadow: 0px 10px 100px 0px rgba(0, 0, 0, 0.15); + box-shadow: 0px 10px 100px 0px rgba(0, 0, 0, 0.15); +} + +.modal_content-header { + display: block; + border-bottom: none; + padding: 2rem; +} + +.modal_content-header h5 { + color: #222; + font-family: "Inter", sans-serif; + font-size: 25px; + font-weight: 700; +} + +.modal_content-header p { + color: #717684; + font-family: "Inter", sans-serif; + font-size: 16px; + font-weight: 500; + margin-bottom: 0px; +} + +.master-onboard_modal-container .custom-search:focus{ + background-color:#FAF9F6; + +} + +.master_searchview_autocomplete .o_menu_item.dropdown-item.focus{ + padding-bottom: 0.5rem; + font-weight: bold; + margin-bottom: 0.5rem; + border-bottom: 1px solid; + display: flex; + justify-content: space-between; +} + +.master_searchview_autocomplete .menu{ + padding-left: 1rem; +} + +.cy_master-create-icon{ + padding: 0.3rem; + border: 1px solid #151E4E; + border-radius: 50%; +} + +.master_modal-container .dashboard_modal-box{ + bottom : 20%; +} \ No newline at end of file diff --git a/master_search_systray/static/src/js/MasterSearchDialog.js b/master_search_systray/static/src/js/MasterSearchDialog.js new file mode 100755 index 000000000..96c843065 --- /dev/null +++ b/master_search_systray/static/src/js/MasterSearchDialog.js @@ -0,0 +1,219 @@ +/** @odoo-module **/ +import { Component, useRef, useExternalListener, useState} from "@odoo/owl"; +import { _t } from "@web/core/l10n/translation"; +import { Dialog } from "@web/core/dialog/dialog"; +import { rpc } from "@web/core/network/rpc"; +import { useService } from "@web/core/utils/hooks"; +let nextItemId = 1; + +export class MasterSearchDialog extends Component { + setup() { + // Set up the initial state and services. + this.state = useState({ + focusedIndex: 0, + menu_list: [], + result: null, + query: "", + isSearchVisible: false, // Add a state variable to control visibility + }); + this.orm = useService("orm"); + this.inputRef = !this.props.autofocus ? useRef("autofocus") : useAutofocus(); + this.items = useState([]); + this.menuService = useService("menu"); + this.actionService = useService("action"); + this.dialogService = useService("dialog") + useExternalListener(window, "click", this.onWindowClick); + useExternalListener(window, "keydown", this.onWindowKeydown); + } + + toggleSearchVisibility() { + // Toggle the visibility of the search bar. + this.state.isSearchVisible = !this.state.isSearchVisible; + } + + selectItem(item) { + this.props.close() + // Handle the selection of an item in the search results. + if (item.isChild) { + this.state.isSearchVisible = false; + this.actionService.doAction( + { + res_model: item.model, + res_id: item.rec_id, + target: "current", + type: "ir.actions.act_window", + views: [[false, "form"]], + }, + ); + } else { + this.resetState(); + } + } + + async computeState(options = {}) { + // Compute the state based on the provided options. + const query = "query" in options ? options.query : this.state.query; + const focusedIndex = "focusedIndex" in options ? options.focusedIndex : this.state.focusedIndex; + this.state.query = query; + this.state.focusedIndex = focusedIndex; + this.inputRef.el.value = query; + const result = await rpc("/master/search", { + query: query, + }); + const trimmedQuery = this.state.query.trim(); + this.items.length = 0; + if (!trimmedQuery) { + this.render(); + return; + } + if (result.length != 0) { + for (const record of result) { + var temp_items = []; + for (const rec of record) { + temp_items.push({ + id: nextItemId++, + name: rec.name, + title: rec.title, + rec_id: rec.id, + isChild: rec.isChild, + isParent: rec.isParent, + model: rec.model, + }); + } + this.items.push(temp_items); + } + this.render(); + } else { + this.items = []; + this.render(); + } + } + + resetState() { + // Reset the state of the search bar. + this.computeState({ + focusedIndex: 0, + query: "", + }); + this.inputRef.el.focus(); + } + + // * Handles the search input event. + //This method is triggered when the user types in the search input field. It fetches + //* the menu items and records results based on the query and updates the state with the + //* combined results. If the query is empty, it resets the state and clears the items. + async onSearchInput(ev) { + const query = this.inputRef.el.value; + if (query.trim()) { + const [menuItems, serverResults] = await Promise.all([ + this.fetchMenuItems(query), + this.fetchServerResults(query), + + ]); + this.state.items = [...menuItems, ...serverResults]; + this.computeState({ + query, + focusedIndex: 0, + }); + } else if (this.items.length) { + this.resetState(); + this.state.items = []; + } + } + + + async fetchMenuItems(query) { + //Fetches menu items based on the query. + //This method searches through the available menu items and filters them + //based on the query string. It returns a list of matching menu items. + const app_list = this.menuService.getAll(); + const menu_list = []; + const apps = this.menuService.getApps(); + let app_name = ""; + for (const app_list_item of app_list) { + if ( + app_list_item.id !== "root" && + app_list_item.actionModel !== false && + app_list_item.name.toLowerCase().match(new RegExp(query.trim().toLowerCase().replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'))) + ) { + const app = apps.find((app) => app.appID === app_list_item.appID); + if (app) { + app_name = app.name; + } + menu_list.push({ + id: app_list_item.id, + actionPath: app_list_item.actionPath, + actionID: app_list_item.actionID, + name: `${app_name}/${app_list_item.name}`, + actionModel: app_list_item.actionModel, + class: "", + }); + } + } + return menu_list; + } + async fetchServerResults(query) { + // * Fetches search results from the records based on the query. + const result = await rpc("/master/search", { + query: query, + }); + + const trimmedQuery = query.trim(); + const serverResults = []; + + if (!trimmedQuery) { + return serverResults; + } + + if (result.length !== 0) { + for (const record of result) { + const temp_items = []; + for (const rec of record) { + temp_items.push({ + id: nextItemId++, + name: rec.name, + title: rec.title, + rec_id: rec.id, + isChild: rec.isChild, + isParent: rec.isParent, + model: rec.model, + }); + } + serverResults.push(temp_items); + } + } + return serverResults; + } + + onWindowClick(ev) { + this.props.close() + // Handle clicks on the window. + if (this.items.length) { + this.resetState(); + } + } + onWindowKeydown(ev) { + // Check if the pressed key is the "Esc" key + if (ev.key === "Escape") { + this.onClickMenu(); + } + } + onClickMenu() { + this.props.close() + } + onSearchIconClick() { + // Handle clicks on the search icon. + this.dialogService.add(MasterSearchDialog) + this.toggleSearchVisibility(); + } + onCLickMasterModal(ev){ + ev.stopPropagation() + } + closeSearch() { + // Close the search bar. + this.state.isSearchVisible = false; + } +} + +MasterSearchDialog.template = "master_search_systray.MasterSearchDialog" +MasterSearchDialog.components = { Dialog } \ No newline at end of file diff --git a/master_search_systray/static/src/js/master_search_icon.js b/master_search_systray/static/src/js/master_search_icon.js new file mode 100755 index 000000000..72f5de623 --- /dev/null +++ b/master_search_systray/static/src/js/master_search_icon.js @@ -0,0 +1,20 @@ +/** @odoo-module **/ +import { registry } from "@web/core/registry"; +import { Component } from "@odoo/owl"; +import { useService } from "@web/core/utils/hooks"; +import { MasterSearchDialog } from "./MasterSearchDialog" + +export class SearchBarSystray extends Component { + + // Component for the search bar in the systray. + setup() { + this.dialogService = useService("dialog") + } + onSearchIconClick() { + // Handle clicks on the search icon. + this.dialogService.add(MasterSearchDialog) + } +} +SearchBarSystray.template = "master_search_systray.SearchBarSystray"; +export const systrayItem = { Component: SearchBarSystray, }; +registry.category("systray").add("SearchBar", systrayItem, { sequence: 1,}); diff --git a/master_search_systray/static/src/scss/master_search_bar.scss b/master_search_systray/static/src/scss/master_search_bar.scss new file mode 100755 index 000000000..d32312940 --- /dev/null +++ b/master_search_systray/static/src/scss/master_search_bar.scss @@ -0,0 +1,76 @@ +.master_searchview_autocomplete { + top: 100%; + + > li { + margin: 5px 0px; + } +} +.master_searchview_input_container { + padding:5px; + display: flex; + position: relative; +} +.master_searchview_input { + border-bottom: 1px solid $o-brand-secondary; + margin-bottom: 15px; + width: 100%; + background-color: #fdfcfc; +} +.o_search_bar_systray{ + align-self: center; + } +.search_bar_style { + border: 1px solid gainsboro !important; + min-width: 100%; + min-height: 40vh; + height:40vh; +display: flex !important;} + +.custom-search{ + background: white; + padding: 0.3125rem 0.625rem; + font-size: 0.875rem; + font-weight: 400; + line-height: 1.5; + color: #495057; + background-color: white; + background-clip: padding-box; + border: 1px solid #ced4da; + appearance: none; + border-radius: 0.5rem; + transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; +} +.search_div{ +display: flex; +margin: 3%; +} +.search_icon{ +margin-left: 5%; + margin-top: 3%; +} +.create_icon{ +margin-left: 10%; +} +.master_searchview_autocomplete { + @include o-position-absolute(calc(100% + #{$border-width * 3}), 0); + width: 100%; + + .o_menu_item { + align-items: center; + display: flex; + + &.o_indent { + padding-left: 0.5rem; + } + + a { + color: inherit; + &.o_expand { + display: flex; + justify-content: center; + width: 25px; + @include o-position-absolute($left: 0); + } + } + } +} diff --git a/master_search_systray/static/src/xml/MasterSearchDialog.xml b/master_search_systray/static/src/xml/MasterSearchDialog.xml new file mode 100755 index 000000000..6a09b233a --- /dev/null +++ b/master_search_systray/static/src/xml/MasterSearchDialog.xml @@ -0,0 +1,92 @@ + + + + +
+ +
+
+
diff --git a/master_search_systray/static/src/xml/master_search_icon.xml b/master_search_systray/static/src/xml/master_search_icon.xml new file mode 100755 index 000000000..915993611 --- /dev/null +++ b/master_search_systray/static/src/xml/master_search_icon.xml @@ -0,0 +1,15 @@ + + + + +
+
+
+ +
+
+
+
+
+ diff --git a/master_search_systray/views/ir_model_views.xml b/master_search_systray/views/ir_model_views.xml new file mode 100755 index 000000000..7ca12a6d3 --- /dev/null +++ b/master_search_systray/views/ir_model_views.xml @@ -0,0 +1,15 @@ + + + + + ir.model.view.form.inherit.master.search.systray + + ir.model + + + + + + + + diff --git a/master_search_systray/views/res_config_settings_views.xml b/master_search_systray/views/res_config_settings_views.xml new file mode 100644 index 000000000..7a328c139 --- /dev/null +++ b/master_search_systray/views/res_config_settings_views.xml @@ -0,0 +1,31 @@ + + + + + + res.config.settings.view.form.inherit.master.search.systray + + res.config.settings + + + + + + + + + + + + + + +