diff --git a/pos_fix_search_limit/__init__.py b/pos_fix_search_limit/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pos_fix_search_limit/__manifest__.py b/pos_fix_search_limit/__manifest__.py new file mode 100644 index 00000000..af32595b --- /dev/null +++ b/pos_fix_search_limit/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2018 Akretion +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Pos Fix Search Limit", + "summary": "Increase search in the PoS", + "version": "12.0.1.0.0", + "category": "Point of Sale", + "author": "Akretion, Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + "point_of_sale", + ], + "data": [ + "views/pos_fix_limit.xml", + ] +} diff --git a/pos_fix_search_limit/i18n/pos_fix_search_limit.pot b/pos_fix_search_limit/i18n/pos_fix_search_limit.pot new file mode 100644 index 00000000..447d3bb3 --- /dev/null +++ b/pos_fix_search_limit/i18n/pos_fix_search_limit.pot @@ -0,0 +1,14 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + diff --git a/pos_fix_search_limit/readme/CONTRIBUTORS.rst b/pos_fix_search_limit/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..296e72d1 --- /dev/null +++ b/pos_fix_search_limit/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Raphaël Reverdy (https://www.akretion.com) diff --git a/pos_fix_search_limit/readme/CREDITS.rst b/pos_fix_search_limit/readme/CREDITS.rst new file mode 100644 index 00000000..fdc8ca1e --- /dev/null +++ b/pos_fix_search_limit/readme/CREDITS.rst @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +* Akretion diff --git a/pos_fix_search_limit/readme/DESCRIPTION.rst b/pos_fix_search_limit/readme/DESCRIPTION.rst new file mode 100644 index 00000000..7f893b61 --- /dev/null +++ b/pos_fix_search_limit/readme/DESCRIPTION.rst @@ -0,0 +1,8 @@ +This module makes the distinction between the limit of search results +and the limit of product displayed. + +Without this module, if you have many products, all the searches are limited +to 100 firsts results. + +This module increase the limit of search results to a high number +and keep the number of product displayed to 100. \ No newline at end of file diff --git a/pos_fix_search_limit/readme/HISTORY.rst b/pos_fix_search_limit/readme/HISTORY.rst new file mode 100644 index 00000000..21116ee5 --- /dev/null +++ b/pos_fix_search_limit/readme/HISTORY.rst @@ -0,0 +1,4 @@ +12.0.1.0.0 (2019-11-20) +~~~~~~~~~~~~~~~~~~~~~~~ + +* [MIG] Migrated to Odoo 12 diff --git a/pos_fix_search_limit/readme/ROADMAP.rst b/pos_fix_search_limit/readme/ROADMAP.rst new file mode 100644 index 00000000..993c7a7c --- /dev/null +++ b/pos_fix_search_limit/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +* Display a last element like "More products" to let the user know his search has been truncated. +* Truncate the list of partners with the display limit. \ No newline at end of file diff --git a/pos_fix_search_limit/readme/USAGE.rst b/pos_fix_search_limit/readme/USAGE.rst new file mode 100644 index 00000000..599bc22d --- /dev/null +++ b/pos_fix_search_limit/readme/USAGE.rst @@ -0,0 +1,5 @@ +This module is a dependency of other modules like pos_product_template. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/184/10.0 \ No newline at end of file diff --git a/pos_fix_search_limit/static/description/icon.png b/pos_fix_search_limit/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/pos_fix_search_limit/static/description/icon.png differ diff --git a/pos_fix_search_limit/static/src/js/pos_fix_search_limit.js b/pos_fix_search_limit/static/src/js/pos_fix_search_limit.js new file mode 100644 index 00000000..0c1aec30 --- /dev/null +++ b/pos_fix_search_limit/static/src/js/pos_fix_search_limit.js @@ -0,0 +1,50 @@ +/* Copyright 2018 Akretion - Raphaël Reverdy + License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */ +odoo.define("pos_fix_search_limit.db", function (require) { + "use strict"; + var PosDB = require("point_of_sale.DB"); + PosDB.include({ + limit: 314159265, // the maximum number of results returned by a search + }); +}); + +odoo.define('pos_fix_search_limit.product_list', function(require) { + "use strict"; + var screens = require('point_of_sale.screens'); + var core = require('web.core'); + var qweb = core.qweb; + + screens.ProductListWidget.include({ + displayLimit: 100, //number of elements displayed + renderElement: function() { + //Limit the number of elements to displayLimit (instead of db.limit) + // (db.limit has been increased to return more results) + // (but we still want to limit the display) + //And make use of document fragment, because better perfs + var self = this; + var i = 0; + var len = Math.min(this.product_list.length, this.displayLimit); + var frag = document.createDocumentFragment(); + var product_node = null; + + var el_str = qweb.render(this.template, {widget: this}); + var el_node = document.createElement('div'); + el_node.innerHTML = el_str; + el_node = el_node.childNodes[1]; + + if(this.el && this.el.parentNode){ + this.el.parentNode.replaceChild(el_node,this.el); + } + this.el = el_node; + + var list_container = el_node.querySelector('.product-list'); + for(i=0; i < len; i++){ + product_node = this.render_product(this.product_list[i]); + product_node.addEventListener('click',this.click_product_handler); + product_node.addEventListener('keypress',this.keypress_product_handler); + frag.appendChild(product_node); + } + list_container.appendChild(frag); + } + }); +}); diff --git a/pos_fix_search_limit/views/pos_fix_limit.xml b/pos_fix_search_limit/views/pos_fix_limit.xml new file mode 100644 index 00000000..5b27a735 --- /dev/null +++ b/pos_fix_search_limit/views/pos_fix_limit.xml @@ -0,0 +1,11 @@ + + + + + + +