diff --git a/master_search/README.rst b/master_search/README.rst new file mode 100755 index 000000000..0081f0a95 --- /dev/null +++ b/master_search/README.rst @@ -0,0 +1,41 @@ +Master Search +============= +* Master Search module for Odoo 14 community editions + +Installation +============ + - www.odoo.com/documentation/14.0/setup/install.html + - Install our custom addon + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html) + +Company +------- +* 'Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: +(v14) Shahil @ Cybrosys + +Contacts +-------- +* Mail Contact : odoo@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 +========== +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ + diff --git a/master_search/__init__.py b/master_search/__init__.py new file mode 100644 index 000000000..51e8d312e --- /dev/null +++ b/master_search/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) +# you can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## + +from . import models diff --git a/master_search/__manifest__.py b/master_search/__manifest__.py new file mode 100644 index 000000000..1626a4596 --- /dev/null +++ b/master_search/__manifest__.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) +# you can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## + +{ + 'name': 'Odoo14 Master Search', + 'version': '14.0.1.0.0', + 'summary': """Easy Search in Customers, Products, Sale, Purchase, Inventory and Accounting modules""", + 'description': """Easy Search in Customers, Products, Sale, Purchase, Inventory and Accounting modules, + Search, Advance search, master search, odoo14, """, + 'category': 'Settings', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'license': 'AGPL-3', + 'images': ['static/description/banner.jpg'], + 'depends': ['base', 'stock', 'sale', 'purchase'], + 'data': [ + 'security/ir.model.access.csv', + 'security/security.xml', + 'views/master_search_view.xml', + 'views/template.xml', + ], + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/master_search/doc/RELEASE_NOTES.md b/master_search/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..1917728fb --- /dev/null +++ b/master_search/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 25.05.2021 +#### Version 14.0.1.0.0 +#### ADD +Initial Commit diff --git a/master_search/models/__init__.py b/master_search/models/__init__.py new file mode 100644 index 000000000..60fc983b0 --- /dev/null +++ b/master_search/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) +# you can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## + +from . import master_search \ No newline at end of file diff --git a/master_search/models/master_search.py b/master_search/models/master_search.py new file mode 100644 index 000000000..193695910 --- /dev/null +++ b/master_search/models/master_search.py @@ -0,0 +1,366 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) +# you can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## + +from odoo import fields, models, api, _ +from odoo.exceptions import UserError + + +class MasterSearch(models.Model): + _name = 'master.search' + _description = "Model for master search" + _rec_name = 'name' + _order = "create_date desc" + + name = fields.Char(string="Name", default=lambda self: _('Search')) + res_customers_id = fields.Many2many('res.partner', 'res_customers_search_rel', 'res_customers_id', 'search_id', + string="Locations") + search_string = fields.Char(string="Search") + search_mode = fields.Selection([('all', 'All'), ('active', 'Active'), ('inactive', 'Inactive')], + string="Search Mode", default="active") + search_by = fields.Selection( + [('any', 'Any'), ('customer', 'Customer'), ('product', 'Product'), ('sale details', 'Sale'), + ('purchase details', 'Purchase'), ('transaction details', 'Inventory'), ('account details', 'Accounting')], + string="Search By", default='any') + master_search_ids = fields.Many2many('master.search', 'master_search_self_rel', 'search_id', + 'search_id1', compute="_get_recent_searches", limit=1) + history_count = fields.Integer(string="History Count", compute="_get_history_count") + customer_ids = fields.Many2many('res.partner', 'master_search_company_rel', 'search_id', 'company_id') + product_ids = fields.Many2many('product.template', 'master_search_product_rel', 'search_id', 'company_id') + transaction_details = fields.Many2many('stock.picking', 'master_search_transaction_details_rel', 'search_id', + 'company_id', string="Inventory") + customer_count = fields.Integer(string="Company Count", compute="_get_operator_count") + product_count = fields.Integer(string="Product Count", compute="_get_product_count") + transaction_count = fields.Integer(string="Transaction Count", compute="_get_transaction_count") + sale_count = fields.Integer(string="Sale Count", compute="_get_sale_count") + purchase_count = fields.Integer(string="Sale Count", compute="_get_purchase_count") + account_count = fields.Integer(string="Account Count", compute="_get_account_count") + user_id = fields.Many2one('res.users', string="User", default=lambda self: self.env.user) + match_entire = fields.Boolean(string="Match entire sentence") + sale_details = fields.Many2many('sale.order', 'master_search_sale_details_rel', 'search_id', + 'company_id', string="Sale") + purchase_details = fields.Many2many('purchase.order', 'master_search_purchase_details_rel', 'search_id', + 'company_id', string="Sale") + account_details = fields.Many2many('account.move', 'master_search_account_details_rel', 'search_id', + 'company_id', string="Account") + + @api.depends('search_string') + def _get_recent_searches(self): + """ Get recent searches """ + # unlink search result with empty string + try: + current_id = self.id if isinstance(self.id, int) \ + else self._origin.id + except: + current_id = False + pass + empty_search = self.env['master.search'].search( + [('search_string', 'in', ['', False]), + ('id', 'not in', [current_id, False] + if current_id else [False])]) + if empty_search: + empty_search.unlink() + # get search histories avoid null strings + recent_searches = self.env['master.search'].search([ + ('search_string', 'not in', ['', False])]) + # commended for viewing last search + # self.master_search_ids = recent_searches.filtered( + # lambda x: x.id != self.id) if self.id else recent_searches + self.master_search_ids = recent_searches + + def action_unlink_search(self): + """ Unlink search """ + self.unlink() + action = self.env.ref('master_search.master_search_action').read()[0] + return action + + @api.depends('master_search_ids') + def _get_history_count(self): + """ Get history count """ + self.history_count = len(self.master_search_ids) + + @api.depends('product_ids') + def _get_product_count(self): + """ Get product count """ + self.product_count = len(self.product_ids) + + @api.depends('customer_ids') + def _get_operator_count(self): + """ Get customer count """ + self.customer_count = len(self.customer_ids) + + @api.depends('transaction_count') + def _get_transaction_count(self): + """ Get transaction details count """ + self.transaction_count = len(self.transaction_details) + + @api.depends('sale_count') + def _get_sale_count(self): + """ Get sale details count """ + self.sale_count = len(self.sale_details) + + @api.depends('purchase_count') + def _get_purchase_count(self): + """ Get purchase details count """ + self.purchase_count = len(self.purchase_details) + + @api.depends('account_count') + def _get_account_count(self): + """ Get account details count """ + self.account_count = len(self.account_details) + + def action_clear_search(self): + """ clear search input """ + self.search_string = "" + self.name = "Search" + + @api.model_create_multi + def create(self, vals_list): + """ Function for unlink first result and raise error if no string """ + res = super(MasterSearch, self).create(vals_list) + search_index = self.env['master.search'].search_count([('user_id', '=', self.env.user.id)]) + # unlink old search result if count greater than 10 + if search_index > 10: + last_search = self.env['master.search'].search([('id', '!=', res.id), ('user_id', '=', self.env.user.id)], + order="create_date asc", limit=1) + last_search.unlink() if last_search else False + return res + + def action_search(self): + """ search for the string and store search data """ + if self.search_string and "*" in self.search_string: + return + if not self.search_string: + raise UserError(_("Please provide a search string!")) + search_keys = self.search_string.split(" ") + # delete all the lines + self.customer_ids = self.product_ids = self.transaction_details = False + # search for entire sentence + if self.match_entire: + return self._search_query(self.search_string) + # search for all the words + for key in search_keys: + self._search_query(key) + self.name = self.search_string + + def _search_query(self, key): + """ search for the model with given key and update result """ + company_id = self.env.user.company_id.id + if self.search_mode == 'all': + active_qry = """ + and obj.active in ({},{}) + """.format("'FALSE'", "'TRUE'") + elif self.search_mode == 'active': + active_qry = """ and obj.active in ({})""".format("'TRUE'") + else: + active_qry = """ and obj.active in ({})""".format("'FALSE'") + + # search for customers + self._search_customer(key, active_qry) \ + if self.search_by in ['any', 'customer'] else False + # search for products + self._search_products(key, active_qry, company_id) \ + if self.search_by in ['any', 'product'] else False + # search for inventory transactions + self._search_inventory_transactions(key, active_qry, company_id) \ + if self.search_by in ['any', 'transaction details'] else False + # search for inventory transactions + self._search_sale_transactions(key, active_qry, company_id) \ + if self.search_by in ['any', 'sale details'] else False + # search for purchase transactions + self._search_purchase_transactions(key, active_qry, company_id) \ + if self.search_by in ['any', 'purchase details'] else False + # search for account transactions + self._search_account_transactions(key, active_qry, company_id) \ + if self.search_by in ['any', 'account details'] else False + + def _search_account_transactions(self, key, active_qry, company_id): + """ Search for all account transactions """ + sp_query = """ + SELECT + am.id from account_move am + LEFT JOIN + res_partner p on p.id = am.partner_id + WHERE + am.company_id = {op_id} + AND + (am.name ILIKE '%{key}%' + OR + p.name ILIKE '%{key}%' + OR + am.state ILIKE '%{key}%') + GROUP BY + am.id,p.name + """ + self._cr.execute(sp_query.format(op_id=company_id, key=key, active=active_qry)) + moves = self._cr.dictfetchall() + move_ids = self.env['account.move'].browse([i['id'] for i in moves]) + self.account_details += move_ids + + def _search_purchase_transactions(self, key, active_qry, company_id): + """ Search for all purchase transactions """ + sp_query = """ + SELECT + po.id from purchase_order po + LEFT JOIN + res_partner p on p.id = po.partner_id + WHERE + po.company_id = {op_id} + AND + (po.name ILIKE '%{key}%' + OR + p.name ILIKE '%{key}%' + OR + po.state ILIKE '%{key}%') + GROUP BY + po.id,p.name + """ + self._cr.execute(sp_query.format(op_id=company_id, key=key, active=active_qry)) + purchases = self._cr.dictfetchall() + purchase_ids = self.env['purchase.order'].browse([i['id'] for i in purchases]) + self.purchase_details += purchase_ids + + def _search_sale_transactions(self, key, active_qry, company_id): + """ Search for all sale transactions """ + sp_query = """ + SELECT + sl.id from sale_order sl + LEFT JOIN + res_partner p on p.id = sl.partner_id + LEFT JOIN + product_pricelist pl + ON + pl.id = sl.pricelist_id + LEFT JOIN + account_payment_term pt + ON + pt.id = sl.payment_term_id + WHERE + sl.company_id = {op_id} + AND + (sl.name ILIKE '%{key}%' + OR + p.name ILIKE '%{key}%' + OR + sl.state ILIKE '%{key}%' + OR + pl.name ILIKE '%{key}%') + GROUP BY + sl.id,p.name,pl.name,pt.name + """ + self._cr.execute(sp_query.format(op_id=company_id, key=key, active=active_qry)) + sales = self._cr.dictfetchall() + sale_ids = self.env['sale.order'].browse([i['id'] for i in sales]) + self.sale_details += sale_ids + + def _search_inventory_transactions(self, key, active_qry, company_id): + """ Search for all inventory transactions """ + sp_query = """ + SELECT + sp.id from stock_picking sp + LEFT JOIN + res_partner p on p.id = sp.partner_id + LEFT JOIN + stock_picking_type t + ON + t.id = sp.picking_type_id + WHERE + sp.company_id = {op_id} + AND + (sp.name ILIKE '%{key}%' + OR + p.name ILIKE '%{key}%' + OR + sp.state ILIKE '%{key}%' + OR + t.name ILIKE '%{key}%') + GROUP BY + sp.id,p.name,t.name + """ + self._cr.execute(sp_query.format(op_id=company_id, key=key, active=active_qry)) + transactions = self._cr.dictfetchall() + transaction_ids = self.env['stock.picking'].browse([i['id'] for i in transactions]) + self.transaction_details += transaction_ids + + def _search_products(self, key, active_qry, company_id): + """ search for products """ + pt_query = """ + SELECT + pt.id + FROM + product_template pt + LEFT JOIN + product_category pc + ON + pc.id = pt.categ_id + WHERE + (pt.name ILIKE '%{key}%' + OR + pt.default_code ILIKE '%{key}%' + OR + pt.type ILIKE '%{key}%' + OR + pt.description ILIKE '%{key}%' + OR + pc.name ILIKE '%{key}%') + """ + self._cr.execute(pt_query.format(op_id=company_id, key=key, active=active_qry).replace('obj', 'pt')) + template_ids = self._cr.dictfetchall() + product_template_ids = self.env['product.template'].browse([i['id'] for i in template_ids]) + self.product_ids += product_template_ids + + def _search_customer(self, key, active_qry): + """ search for customer """ + query = """ + SELECT + r.id from res_partner r + LEFT JOIN + res_country_state rs + ON + rs.id = r.state_id + LEFT JOIN + res_country rc + ON + rc.id = r.country_id + WHERE + (r.parent_id is NULL ) + AND + r.type = 'contact' {active} + AND + (r.name ILIKE '%{key}%' + OR + r.street ILIKE '%{key}%' + OR + r.street2 ILIKE '%{key}%' + OR + r.city ILIKE '%{key}%' + OR + r.zip ILIKE '%{key}%' + OR + rs.name ILIKE '%{key}%' + OR + rc.name ILIKE '%{key}%' + OR + r.email ILIKE '%{key}%') + """ + self._cr.execute(query.format(key=key, active=active_qry).replace('obj', 'r')) + customers = self._cr.dictfetchall() + customer_ids = self.env['res.partner'].browse([i['id'] for i in customers]) + self.customer_ids += customer_ids diff --git a/master_search/security/ir.model.access.csv b/master_search/security/ir.model.access.csv new file mode 100755 index 000000000..395f036a4 --- /dev/null +++ b/master_search/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_master_search,master.search,model_master_search,,1,1,1,1 \ No newline at end of file diff --git a/master_search/security/security.xml b/master_search/security/security.xml new file mode 100755 index 000000000..67bcbbd17 --- /dev/null +++ b/master_search/security/security.xml @@ -0,0 +1,20 @@ + + + + + Company Search Rule + + [('user_id', '=', user.id)] + + + + + Search Rights + 11 + + + + Master Search + Master Search Group + + diff --git a/master_search/static/description/assets/._.DS_Store b/master_search/static/description/assets/._.DS_Store new file mode 100644 index 000000000..9ad849cdb Binary files /dev/null and b/master_search/static/description/assets/._.DS_Store differ diff --git a/master_search/static/description/assets/hero.png b/master_search/static/description/assets/hero.png new file mode 100644 index 000000000..a378d785f Binary files /dev/null and b/master_search/static/description/assets/hero.png differ diff --git a/master_search/static/description/assets/icons/._.DS_Store b/master_search/static/description/assets/icons/._.DS_Store new file mode 100644 index 000000000..9ad849cdb Binary files /dev/null and b/master_search/static/description/assets/icons/._.DS_Store differ diff --git a/master_search/static/description/assets/icons/._cogs.png b/master_search/static/description/assets/icons/._cogs.png new file mode 100644 index 000000000..f7148d473 Binary files /dev/null and b/master_search/static/description/assets/icons/._cogs.png differ diff --git a/master_search/static/description/assets/icons/._consultation.png b/master_search/static/description/assets/icons/._consultation.png new file mode 100644 index 000000000..aa8a531ac Binary files /dev/null and b/master_search/static/description/assets/icons/._consultation.png differ diff --git a/master_search/static/description/assets/icons/._ecom-black.png b/master_search/static/description/assets/icons/._ecom-black.png new file mode 100644 index 000000000..ff71cac34 Binary files /dev/null and b/master_search/static/description/assets/icons/._ecom-black.png differ diff --git a/master_search/static/description/assets/icons/._education-black.png b/master_search/static/description/assets/icons/._education-black.png new file mode 100644 index 000000000..038789127 Binary files /dev/null and b/master_search/static/description/assets/icons/._education-black.png differ diff --git a/master_search/static/description/assets/icons/._hotel-black.png b/master_search/static/description/assets/icons/._hotel-black.png new file mode 100644 index 000000000..962af8bbc Binary files /dev/null and b/master_search/static/description/assets/icons/._hotel-black.png differ diff --git a/master_search/static/description/assets/icons/._license.png b/master_search/static/description/assets/icons/._license.png new file mode 100644 index 000000000..26ba90fe5 Binary files /dev/null and b/master_search/static/description/assets/icons/._license.png differ diff --git a/master_search/static/description/assets/icons/._lifebuoy.png b/master_search/static/description/assets/icons/._lifebuoy.png new file mode 100644 index 000000000..51bb6606d Binary files /dev/null and b/master_search/static/description/assets/icons/._lifebuoy.png differ diff --git a/master_search/static/description/assets/icons/._manufacturing-black.png b/master_search/static/description/assets/icons/._manufacturing-black.png new file mode 100644 index 000000000..54bc914ea Binary files /dev/null and b/master_search/static/description/assets/icons/._manufacturing-black.png differ diff --git a/master_search/static/description/assets/icons/._pos-black.png b/master_search/static/description/assets/icons/._pos-black.png new file mode 100644 index 000000000..a11f4cd96 Binary files /dev/null and b/master_search/static/description/assets/icons/._pos-black.png differ diff --git a/master_search/static/description/assets/icons/._puzzle.png b/master_search/static/description/assets/icons/._puzzle.png new file mode 100644 index 000000000..f7e7e7e33 Binary files /dev/null and b/master_search/static/description/assets/icons/._puzzle.png differ diff --git a/master_search/static/description/assets/icons/._restaurant-black.png b/master_search/static/description/assets/icons/._restaurant-black.png new file mode 100644 index 000000000..33ea178a3 Binary files /dev/null and b/master_search/static/description/assets/icons/._restaurant-black.png differ diff --git a/master_search/static/description/assets/icons/._service-black.png b/master_search/static/description/assets/icons/._service-black.png new file mode 100644 index 000000000..0ec2cf2a5 Binary files /dev/null and b/master_search/static/description/assets/icons/._service-black.png differ diff --git a/master_search/static/description/assets/icons/._trading-black.png b/master_search/static/description/assets/icons/._trading-black.png new file mode 100644 index 000000000..d6299d375 Binary files /dev/null and b/master_search/static/description/assets/icons/._trading-black.png differ diff --git a/master_search/static/description/assets/icons/._training.png b/master_search/static/description/assets/icons/._training.png new file mode 100644 index 000000000..9bade5f8e Binary files /dev/null and b/master_search/static/description/assets/icons/._training.png differ diff --git a/master_search/static/description/assets/icons/._update.png b/master_search/static/description/assets/icons/._update.png new file mode 100644 index 000000000..48784837e Binary files /dev/null and b/master_search/static/description/assets/icons/._update.png differ diff --git a/master_search/static/description/assets/icons/._user.png b/master_search/static/description/assets/icons/._user.png new file mode 100644 index 000000000..d5b105ad2 Binary files /dev/null and b/master_search/static/description/assets/icons/._user.png differ diff --git a/master_search/static/description/assets/icons/._wrench.png b/master_search/static/description/assets/icons/._wrench.png new file mode 100644 index 000000000..db48ce407 Binary files /dev/null and b/master_search/static/description/assets/icons/._wrench.png differ diff --git a/master_search/static/description/assets/icons/chevron.png b/master_search/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/master_search/static/description/assets/icons/chevron.png differ diff --git a/master_search/static/description/assets/icons/cogs.png b/master_search/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/master_search/static/description/assets/icons/cogs.png differ diff --git a/master_search/static/description/assets/icons/consultation.png b/master_search/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/master_search/static/description/assets/icons/consultation.png differ diff --git a/master_search/static/description/assets/icons/ecom-black.png b/master_search/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/master_search/static/description/assets/icons/ecom-black.png differ diff --git a/master_search/static/description/assets/icons/education-black.png b/master_search/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/master_search/static/description/assets/icons/education-black.png differ diff --git a/master_search/static/description/assets/icons/feature-icons/._lifebuoy.png b/master_search/static/description/assets/icons/feature-icons/._lifebuoy.png new file mode 100644 index 000000000..4f178d2ad Binary files /dev/null and b/master_search/static/description/assets/icons/feature-icons/._lifebuoy.png differ diff --git a/master_search/static/description/assets/icons/feature-icons/document.png b/master_search/static/description/assets/icons/feature-icons/document.png new file mode 100644 index 000000000..4054e8480 Binary files /dev/null and b/master_search/static/description/assets/icons/feature-icons/document.png differ diff --git a/master_search/static/description/assets/icons/feature-icons/down.png b/master_search/static/description/assets/icons/feature-icons/down.png new file mode 100644 index 000000000..65a94a23b Binary files /dev/null and b/master_search/static/description/assets/icons/feature-icons/down.png differ diff --git a/master_search/static/description/assets/icons/feature-icons/lifebuoy.png b/master_search/static/description/assets/icons/feature-icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/master_search/static/description/assets/icons/feature-icons/lifebuoy.png differ diff --git a/master_search/static/description/assets/icons/hotel-black.png b/master_search/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/master_search/static/description/assets/icons/hotel-black.png differ diff --git a/master_search/static/description/assets/icons/license.png b/master_search/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/master_search/static/description/assets/icons/license.png differ diff --git a/master_search/static/description/assets/icons/lifebuoy.png b/master_search/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/master_search/static/description/assets/icons/lifebuoy.png differ diff --git a/master_search/static/description/assets/icons/manufacturing-black.png b/master_search/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/master_search/static/description/assets/icons/manufacturing-black.png differ diff --git a/master_search/static/description/assets/icons/pos-black.png b/master_search/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/master_search/static/description/assets/icons/pos-black.png differ diff --git a/master_search/static/description/assets/icons/puzzle.png b/master_search/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/master_search/static/description/assets/icons/puzzle.png differ diff --git a/master_search/static/description/assets/icons/restaurant-black.png b/master_search/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/master_search/static/description/assets/icons/restaurant-black.png differ diff --git a/master_search/static/description/assets/icons/service-black.png b/master_search/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/master_search/static/description/assets/icons/service-black.png differ diff --git a/master_search/static/description/assets/icons/trading-black.png b/master_search/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/master_search/static/description/assets/icons/trading-black.png differ diff --git a/master_search/static/description/assets/icons/training.png b/master_search/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/master_search/static/description/assets/icons/training.png differ diff --git a/master_search/static/description/assets/icons/update.png b/master_search/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/master_search/static/description/assets/icons/update.png differ diff --git a/master_search/static/description/assets/icons/user.png b/master_search/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/master_search/static/description/assets/icons/user.png differ diff --git a/master_search/static/description/assets/icons/wrench.png b/master_search/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/master_search/static/description/assets/icons/wrench.png differ diff --git a/master_search/static/description/assets/modules/discount.png b/master_search/static/description/assets/modules/discount.png new file mode 100644 index 000000000..2901d6ef4 Binary files /dev/null and b/master_search/static/description/assets/modules/discount.png differ diff --git a/master_search/static/description/assets/modules/dynamic_financial_report.jpg b/master_search/static/description/assets/modules/dynamic_financial_report.jpg new file mode 100644 index 000000000..c79986ab0 Binary files /dev/null and b/master_search/static/description/assets/modules/dynamic_financial_report.jpg differ diff --git a/master_search/static/description/assets/modules/invoice.jpg b/master_search/static/description/assets/modules/invoice.jpg new file mode 100644 index 000000000..26fb9d33f Binary files /dev/null and b/master_search/static/description/assets/modules/invoice.jpg differ diff --git a/master_search/static/description/assets/modules/payroll_accounting.png b/master_search/static/description/assets/modules/payroll_accounting.png new file mode 100644 index 000000000..488b05c36 Binary files /dev/null and b/master_search/static/description/assets/modules/payroll_accounting.png differ diff --git a/master_search/static/description/assets/modules/pos_dashboard.png b/master_search/static/description/assets/modules/pos_dashboard.png new file mode 100644 index 000000000..a915fe4c5 Binary files /dev/null and b/master_search/static/description/assets/modules/pos_dashboard.png differ diff --git a/master_search/static/description/assets/modules/shopify.png b/master_search/static/description/assets/modules/shopify.png new file mode 100644 index 000000000..f2751c663 Binary files /dev/null and b/master_search/static/description/assets/modules/shopify.png differ diff --git a/master_search/static/description/assets/screenshots/1-Master-Search-User-Access.png b/master_search/static/description/assets/screenshots/1-Master-Search-User-Access.png new file mode 100644 index 000000000..bb092a9b0 Binary files /dev/null and b/master_search/static/description/assets/screenshots/1-Master-Search-User-Access.png differ diff --git a/master_search/static/description/assets/screenshots/2-Master-Search-main-screenshot.png b/master_search/static/description/assets/screenshots/2-Master-Search-main-screenshot.png new file mode 100644 index 000000000..baf684dc7 Binary files /dev/null and b/master_search/static/description/assets/screenshots/2-Master-Search-main-screenshot.png differ diff --git a/master_search/static/description/assets/screenshots/A1-Search-in-Customer-data.png b/master_search/static/description/assets/screenshots/A1-Search-in-Customer-data.png new file mode 100644 index 000000000..bcf84193e Binary files /dev/null and b/master_search/static/description/assets/screenshots/A1-Search-in-Customer-data.png differ diff --git a/master_search/static/description/assets/screenshots/A2-Customer-Search-record-view.png b/master_search/static/description/assets/screenshots/A2-Customer-Search-record-view.png new file mode 100644 index 000000000..ec6acdf30 Binary files /dev/null and b/master_search/static/description/assets/screenshots/A2-Customer-Search-record-view.png differ diff --git a/master_search/static/description/assets/screenshots/B1-Search-in-Inventory-Data.png b/master_search/static/description/assets/screenshots/B1-Search-in-Inventory-Data.png new file mode 100644 index 000000000..d2ea6f20c Binary files /dev/null and b/master_search/static/description/assets/screenshots/B1-Search-in-Inventory-Data.png differ diff --git a/master_search/static/description/assets/screenshots/B2-Inventory-Search-record-view.png b/master_search/static/description/assets/screenshots/B2-Inventory-Search-record-view.png new file mode 100644 index 000000000..1f2c7c5b8 Binary files /dev/null and b/master_search/static/description/assets/screenshots/B2-Inventory-Search-record-view.png differ diff --git a/master_search/static/description/assets/screenshots/C1-Search-in-accounting-data.png b/master_search/static/description/assets/screenshots/C1-Search-in-accounting-data.png new file mode 100644 index 000000000..289da798a Binary files /dev/null and b/master_search/static/description/assets/screenshots/C1-Search-in-accounting-data.png differ diff --git a/master_search/static/description/assets/screenshots/C2-Accounting-Search-record-view.png b/master_search/static/description/assets/screenshots/C2-Accounting-Search-record-view.png new file mode 100644 index 000000000..04490d4b4 Binary files /dev/null and b/master_search/static/description/assets/screenshots/C2-Accounting-Search-record-view.png differ diff --git a/master_search/static/description/assets/screenshots/Search-in-Product-data.png b/master_search/static/description/assets/screenshots/Search-in-Product-data.png new file mode 100644 index 000000000..7c62d8d00 Binary files /dev/null and b/master_search/static/description/assets/screenshots/Search-in-Product-data.png differ diff --git a/master_search/static/description/assets/screenshots/Search-in-Purchase-data.png b/master_search/static/description/assets/screenshots/Search-in-Purchase-data.png new file mode 100644 index 000000000..4acf27501 Binary files /dev/null and b/master_search/static/description/assets/screenshots/Search-in-Purchase-data.png differ diff --git a/master_search/static/description/assets/screenshots/Search-in-Sale-data.png b/master_search/static/description/assets/screenshots/Search-in-Sale-data.png new file mode 100644 index 000000000..700ee96fe Binary files /dev/null and b/master_search/static/description/assets/screenshots/Search-in-Sale-data.png differ diff --git a/master_search/static/description/banner.jpg b/master_search/static/description/banner.jpg new file mode 100644 index 000000000..36273440d Binary files /dev/null and b/master_search/static/description/banner.jpg differ diff --git a/master_search/static/description/icon.png b/master_search/static/description/icon.png new file mode 100644 index 000000000..75f15e880 Binary files /dev/null and b/master_search/static/description/icon.png differ diff --git a/master_search/static/description/index.html b/master_search/static/description/index.html new file mode 100644 index 000000000..96e472745 --- /dev/null +++ b/master_search/static/description/index.html @@ -0,0 +1,634 @@ + +
+
+
+

+ Master Search +

+

+ Easy Search in Customers, Products, Sale, Purchase, Inventory and Accounting modules

+
+ Key Features
+ + + +

Dynamic Search View Option

+
+ + + +

Easily Search Records in Customers, Products, Sale, Purchase, Inventory and Accounting Data

+
+ + + +

Possible to search with + different attributes like name, reference, number, etc. +

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

+ Overview

+
+ +
+

+ Master Search module enables advance and simple search in different modules. It helps users to search the records + in Customers, Products, Sale, Purchase, Inventory and Accounting Modules for + 'Master Search' group users. Possible to search using different attributes like name, reference, number, etc. +

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

+ Dynamic Search View Option

+

+ Separate View for Search bar and also to show the search results

+
+
+
+
+

+ Easily Search Records in Different Modules

+

+ Easily Search Records in Customers, Products, Sale, Purchase, Inventory and Accounting Module

+
+
+
+ +
+
+
+

+ Option to Search with different attributes

+

+ Possible to search with + different attributes like name, reference, customer name, number, etc.

+
+
+
+
+

+ Recent Search Results

+

+ Possible to access the Recent Search History

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

+ Screenshots

+
+ +
+
+
+
1
+
+
Master Search User Access
+
+ +
+ +
+
+
+
2
+
+
Master Search
+
+ +
+ +
+
+
+
3
+
+
Search in Customer Data
+
+ +
+ + +
+
+
+
4
+
+
Customer Search Record View
+
+ +
+ +
+
+
+
5
+
+
Search in Inventory Data
+
+ +
+ + +
+
+
+
6
+
+
Search in Inventory Data
+
+ +
+ +
+
+
+
7
+
+
Search Record View
+
+ +
+ +
+
+
+
8
+
+
Accounting Search Record View
+
+ +
+ +
+
+
+
9
+
+
Search in Product Data
+
+ +
+ +
+
+
+
10
+
+
Search in Purchase Data
+
+ +
+ +
+
+
+
11
+
+
Search in Sale Data
+
+ +
+ +
+
+ + + + +
+
+
+

+ Suggested Products

+

+ Check out our other products

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

+ Our Services

+

+ We provide following services

+
+ +
+
+ +
+
Odoo + Customization
+
+ +
+
+ +
+
Odoo + Implementation
+
+ +
+
+ +
+
Odoo + Support
+
+ + +
+
+ +
+
Hire + Odoo + Developer
+
+ +
+
+ +
+
Odoo + Integration
+
+ +
+
+ +
+
Odoo + Migration
+
+ + +
+
+ +
+
Odoo + Consultancy
+
+ +
+
+ +
+
Odoo + Implementation
+
+ +
+
+ +
+
Odoo + Licensing Consultancy
+
+
+
+ + + +
+
+
+

+ Our Industries

+

+ Our Industry Specifics And Process Segments To Solve Your Complex Business Barriers.

+
+ +
+
+ +
+ Trading +
+

Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

An + all-inclusive + hotel management application

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

+ Need Help?

+

+ Do you have any queries regarding our products & services? Let us know.

+
+
+ + +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ \ No newline at end of file diff --git a/master_search/static/src/js/form_renderer.js b/master_search/static/src/js/form_renderer.js new file mode 100644 index 000000000..e2d16ad69 --- /dev/null +++ b/master_search/static/src/js/form_renderer.js @@ -0,0 +1,143 @@ +odoo.define('master_search.FormRenderer', function(require) { +"use strict"; + + var FormRenderer = require('web.FormRenderer'); + var framework = require('web.framework'); + + FormRenderer.include({ + events: _.extend({}, FormRenderer.prototype.events, { + 'click .oe_search_tab': '_onSearchTabClick', + 'click .oe_search_btn': '_onSearchButtonClick', + 'keyup .search_input': '_onKeypressSearch', + 'click .re_search': '_onHistoryClick', + }), + // Research on history click + _onHistoryClick: function(ev){ + var history_key = ev.currentTarget.parentElement.firstChild.innerText; + var edit_flag = $(".search_input").hasClass('o_input') + // search if in edit mode + if (edit_flag){ + $(".search_input").val(history_key) + .trigger('change'); + $('.oe_search_btn').trigger('click'); + } + else{ + // trigger edit mode if search screen + $('.o_form_button_edit').trigger('click'); + //var search_input = $(".search_input").length + //if (search_input <= 0 ){$('.o_form_button_edit').trigger('click');} + } + }, + // Trigger search while enter is pressed and process input + _onKeypressSearch: function(ev){ + var search_string = $(".search_input").val(); + if(search_string.includes("*") == true){ + $(".not-allowed").css("display", 'block'); + // remove * from the input + $(".search_input") + .val(search_string.replace('*', '')) + .trigger('change'); + } + else{$(".not-allowed").css("display", 'none');} + if (ev.which == 13){$('.oe_search_btn').trigger('click');} + }, + // block UI while searching + _onSearchButtonClick: function(ev){ + if( $(".search_input").val() != ''){framework.blockUI();} + }, + + // collapse and expand tabs + _onSearchTabClick: function(ev){ + var targetDiv = ev.currentTarget.parentElement.children[1] + var targetIcon = ev.currentTarget.getElementsByClassName('fa')[0] + if (targetDiv){ + if(targetDiv.style.display == "block") { + console.log(targetDiv.style.display, "ddddddd") + targetDiv.style.display = "none"; + targetIcon.className = "fa fa-caret-down" + } + else { + console.log(targetDiv.style.display, "sssssss") + targetDiv.style.display = "block"; + targetIcon.className = "fa fa-caret-up" + } + } + }, + + // override existing form renderer function + _renderView: function () { + var self = this; + + // render the form and evaluate the modifiers + var defs = []; + var colour_list = [] + this.defs = defs; + this.inactiveNotebooks = []; + var $form = this._renderNode(this.arch).addClass(this.className); + delete this.defs; + + return Promise.all(defs).then(function () { + self._updateView($form.contents()); + if (self.state.res_id in self.alertFields) { + self.displayTranslationAlert(); + } + self.trigger_up('edit_mode'); + }).then(function(){ + if (self.lastActivatedFieldIndex >= 0) { + self._activateNextFieldWidget(self.state, self.lastActivatedFieldIndex); + } + if (self._isInDom) { + _.forEach(self.allFieldWidgets, function (widgets){ + _.invoke(widgets, 'on_attach_callback'); + }); + } + // function for getting random light colors + function getRandomColor() { + var color = "hsl(" + Math.random() * 360 + ", 100%, 75%)"; + // avoid colour repetition + if(colour_list.indexOf(color) > -1){color = getRandomColor()} + colour_list.push(color); + return color; + } + // function for expanding tabs with result count + function onSearchButtonClick(ev){ + $('.oe_search_tab').each(function(i, obj) { + var result_count = parseInt(obj.getElementsByClassName('oe_tab_count')[0].innerHTML) + if (result_count > 0){ + obj.click() + } + }); + } + // Highlight all the words in result with different color + var text = $(".search_input").val(); + if (text){ + var keyword_list = [] + var key_list = text.split(" ") + for (var i = 0; i< key_list.length; i++) { + keyword_list[i] = {'key': key_list[i], 'color':getRandomColor()} + } + for (var i = 0; i< keyword_list.length; i++) { + var key = keyword_list[i].key; + var color = keyword_list[i].color + var regex = new RegExp("("+key+")", "ig"); + $('.o_data_cell').each(function(i, obj) { + var old_text = obj.innerHTML + if (!obj.firstChild || obj.firstChild.type != 'button'){ + obj.innerHTML = old_text.replace(regex, "$1"); + } + }); + } + } + // trigger search button click for expand tab with value + if((self.$el.find(".search_input")).length > 0){onSearchButtonClick()} + // unblock UI + framework.unblockUI(); + // change document title on search refresh + var search_input = $(".search_input").length + if (search_input <= 0 ){document.title = 'Search';} + }).guardedCatch(function () { + $form.remove(); + }); + }, + }); +}); diff --git a/master_search/static/src/scss/master_search.scss b/master_search/static/src/scss/master_search.scss new file mode 100644 index 000000000..35f79709f --- /dev/null +++ b/master_search/static/src/scss/master_search.scss @@ -0,0 +1,31 @@ +.oe_search_tab{ + cursor: pointer; + transition: .2s; + &:hover { + background-color: #7c7bad !important; + } +} +.oe_details_tree{ + display: none; +} +.btn_master_search{ + display: inline-block; + background-color:#5f5e97; + color:#fff !important; + color: #fff;margin-left: 1px; + margin-top: -1px; +} +.btn_master_search:hover{ + background-color: rgb(255, 255, 255) !important; + color: rgb(61, 155, 187) !important; +} +.not-allowed{ + color: #d94242; + border: 1px solid #ea9292; + border-radius: 5px; + background-color: #f9e7e7; + padding: 1px 55px; + width: 370px; + margin-bottom: 5px; + display: none; +} \ No newline at end of file diff --git a/master_search/views/master_search_view.xml b/master_search/views/master_search_view.xml new file mode 100644 index 000000000..9b11624c9 --- /dev/null +++ b/master_search/views/master_search_view.xml @@ -0,0 +1,253 @@ + + + + + + Search + master.search + +
+ + + +
+
+
+
+
+
+
+
+ +
+
+ Recent Searches +
+ + Records Found + + + +
+
+
+ + + + + + +
+
+ +
+
+ Customer Search Results +
+ + Records Found + + + +
+
+
+ + + + + + +
+
+
+
+ Product Search Results +
+ + Records Found + + + +
+
+
+ + + + + + + + + + + +
+
+
+
+ Inventory Search Results +
+ + Records Found + + + +
+
+ +
+ + + + + + + + + +
+
+
+
+ Sale Search Results +
+ + Records Found + + + +
+
+ +
+ + + + + + + + + +
+
+
+
+ Purchase Search Results +
+ + Records Found + + + +
+
+ +
+ + + + + + + +
+
+
+
+ Accounting Search Results +
+ + Records Found + + + +
+
+ +
+ + + + + + + +
+
+
+ +
+
+ + + + + Search + master.search + form + {'active_test': False, 'search_default_filter_active': 1} + + + + +
+
diff --git a/master_search/views/template.xml b/master_search/views/template.xml new file mode 100644 index 000000000..cf2ca324c --- /dev/null +++ b/master_search/views/template.xml @@ -0,0 +1,9 @@ + + +