+
+
+
+ Global Search
+
+ Easy Search in Customers, Products, Sale, Purchase, Inventory and Accounting modules
+
+
+
+
+
+
+
+
+ Explore this module
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+
+
+
+
+
+ Global 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
+ 'Global Search' group users. Possible to search using different attributes like name, reference,
+ number, etc.
+
+
+
+
+
+
+
+
+
+ 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.
+
+
+
+
+
+
+ Screenshots
+
+
+
+
+ Global Search User Access
+
+
+
+
+
+
+ Global Search
+
+
+
+
+
+
+
+ Search in Customer Data
+
+
+
+
+ Customer Search Record View
+
+
+
+
+ Search in Inventory Data
+
+
+
+
+ Search Record View
+
+
+
+
+ Accounting Search Record View
+
+
+
+
+ Search in Product Data
+
+
+
+
+ Search in Purchase Data
+
+
+
+
+ Search in Sale Data
+
+
+
+
+
+
+
+
+
+ Video
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Suggested Products
+
+
+
+
+
+
+
+
+
+
+
+
Our Services
+
+
+
+
+
+
+
+
+ Odoo
+ Customization
+
+
+
+
+
+
+
+ Odoo
+ Implementation
+
+
+
+
+
+
+
+ Odoo
+ Support
+
+
+
+
+
+
+
+
+ Hire
+ Odoo
+ Developer
+
+
+
+
+
+
+
+ Odoo
+ Integration
+
+
+
+
+
+
+
+ Odoo
+ Migration
+
+
+
+
+
+
+
+
+ Odoo
+ Consultancy
+
+
+
+
+
+
+
+ Odoo
+ Implementation
+
+
+
+
+
+
+
+ Odoo
+ Licensing Consultancy
+
+
+
+
+
+
+
+
+
+
Our Industries
+
+
+
+
+
+
+
+ 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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/master_search/static/description/logo.png b/master_search/static/description/logo.png
new file mode 100644
index 000000000..478462d3e
Binary files /dev/null and b/master_search/static/description/logo.png differ
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..e6cf10c0a
--- /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(() => this.__renderView()).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
+
+
+
+
+
+
+
+
+ Search
+ master.search
+ form
+ {'active_test': False, 'search_default_filter_active': 1}
+
+
+
+
+
+