From a92f3b5ee5bbfcddceaac29adfdb4f69578381e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Kawala?= Date: Wed, 22 Jan 2020 09:32:33 +0100 Subject: [PATCH] Fix reviews PR 442. --- pos_accented_search/README.rst | 71 +++++++++++++++++++++++++ pos_accented_search/__openerp__.py | 25 ++++----- pos_accented_search/static/src/js/db.js | 25 +++++---- pos_accented_search/views/templates.xml | 13 ++--- 4 files changed, 101 insertions(+), 33 deletions(-) create mode 100644 pos_accented_search/README.rst diff --git a/pos_accented_search/README.rst b/pos_accented_search/README.rst new file mode 100644 index 00000000..0790c7fc --- /dev/null +++ b/pos_accented_search/README.rst @@ -0,0 +1,71 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +====================================================== +Point of Sale - +====================================================== + +This add-on make pos product search insensitive to accented characters in the product +name. For instance, café will match both cafe and café. + +Installation +============ + +Normal installation. + +Configuration +============= + +No configuration required. + +Limits / Roadmap +================ + +Usage +===== + +.. 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/9.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed `feedback +`_. + +Credits +======= + +Authors +------- + +* Le Nid +* CoopITEasy + +Contributors +------------ + +* François Kawala + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/pos_accented_search/__openerp__.py b/pos_accented_search/__openerp__.py index 425bc871..bc7550cb 100644 --- a/pos_accented_search/__openerp__.py +++ b/pos_accented_search/__openerp__.py @@ -1,22 +1,19 @@ # -*- coding: utf-8 -*- +# @author: François Kawala +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { - 'name': "pos_accented_search", - - 'summary': """ - Better product search in POS. Accented characters like é are normalized.""", - - 'description': """ - This add-on make pos product search insensitive to accented characters in the product - name. For instance, café will match both cafe and café. - """, - - 'author': "Le Nid", + 'name': "Point of Sale - Accented Product Search", + 'version': '9.0.0.0.1', + 'category': 'Point of Sale', + 'summary': 'Point of Sale - Product search works regardless of accented characters', + 'author': "Le Nid, Odoo Community Association (OCA)", 'website': "http://www.lenid.ch", 'license': 'AGPL-3', - 'category': 'Point of Sale', - 'version': '0.1', - 'depends': ['point_of_sale'], + 'depends': [ + 'point_of_sale', + ], 'data': [ 'views/templates.xml', ], + 'installable': True, } diff --git a/pos_accented_search/static/src/js/db.js b/pos_accented_search/static/src/js/db.js index 89c23d39..519c72cd 100644 --- a/pos_accented_search/static/src/js/db.js +++ b/pos_accented_search/static/src/js/db.js @@ -1,22 +1,25 @@ odoo.define('pos_accented_search', function (require) { "use strict"; - var db = require("point_of_sale.DB"); - db.include({ + var db = require("point_of_sale.DB"); + db.include({ - remove_accented_characters: function(product){ - return product.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[\u0152-\u0153]/g, "oe") + normalize_characters: function (product) { + return product.normalize("NFD") + .replace(/[\u0300-\u036f]/g, "") + .replace(/[\u0152-\u0153]/g, "oe"); }, - _product_search_string: function(product){ - return this.remove_accented_characters(this._super(product)); + _product_search_string: function (product) { + return this.normalize_characters(this._super(product)); }, - search_product_in_category: function(category_id, query){ - return this._super(category_id, this.remove_accented_characters(query)) - } - }); + search_product_in_category: function (category_id, query) { + return this._super(category_id, this.normalize_characters(query)); + }, + }); - return db; + return db; }); + diff --git a/pos_accented_search/views/templates.xml b/pos_accented_search/views/templates.xml index bdf5ad31..bdf19225 100644 --- a/pos_accented_search/views/templates.xml +++ b/pos_accented_search/views/templates.xml @@ -1,10 +1,7 @@ - - - - +