diff --git a/pos_accented_search/README.rst b/pos_accented_search/README.rst new file mode 100644 index 00000000..57de6975 --- /dev/null +++ b/pos_accented_search/README.rst @@ -0,0 +1,88 @@ +======================================= +Point of Sale - Accented Product Search +======================================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/12.0/pos_accented_search + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-12-0/pos-12-0-pos_accented_search + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/184/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This add-on makes pos product search insensitive to accented characters in the product +name. For instance, café will match both cafe and café. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Simply install the addon and enjoy product search working regardless of the accented characters in the product name. + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Le Nid + +Contributors +~~~~~~~~~~~~ + +- Le Nid +- CoopITEasy + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +.. |maintainer-fkawala| image:: https://github.com/fkawala.png?size=40px + :target: https://github.com/fkawala + :alt: fkawala + +Current `maintainer `__: + +|maintainer-fkawala| + +This module is part of the `OCA/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_accented_search/__init__.py b/pos_accented_search/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pos_accented_search/__manifest__.py b/pos_accented_search/__manifest__.py new file mode 100644 index 00000000..4dea3855 --- /dev/null +++ b/pos_accented_search/__manifest__.py @@ -0,0 +1,18 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + 'name': "Point of Sale - Accented Product Search", + 'version': '12.0.1.0.0', + 'category': 'Point of Sale', + 'summary': 'Point of Sale - Product search works regardless of accented characters', + 'author': "Le Nid, Odoo Community Association (OCA)", + 'website': "https://github.com/OCA/pos", + 'license': 'AGPL-3', + 'maintainers': ['fkawala'], + 'depends': [ + 'point_of_sale', + ], + 'data': [ + 'views/templates.xml', + ], + 'installable': True, +} diff --git a/pos_accented_search/i18n/pos_accented_search.pot b/pos_accented_search/i18n/pos_accented_search.pot new file mode 100644 index 00000000..c3c86c11 --- /dev/null +++ b/pos_accented_search/i18n/pos_accented_search.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 9.0c\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_accented_search/readme/CONTRIBUTORS.rst b/pos_accented_search/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..250f9dd1 --- /dev/null +++ b/pos_accented_search/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +- Le Nid +- CoopITEasy diff --git a/pos_accented_search/readme/DESCRIPTION.rst b/pos_accented_search/readme/DESCRIPTION.rst new file mode 100644 index 00000000..995e5a30 --- /dev/null +++ b/pos_accented_search/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This add-on makes pos product search insensitive to accented characters in the product +name. For instance, café will match both cafe and café. diff --git a/pos_accented_search/readme/USAGE.rst b/pos_accented_search/readme/USAGE.rst new file mode 100644 index 00000000..398017a8 --- /dev/null +++ b/pos_accented_search/readme/USAGE.rst @@ -0,0 +1 @@ +Simply install the addon and enjoy product search working regardless of the accented characters in the product name. diff --git a/pos_accented_search/static/description/icon.png b/pos_accented_search/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/pos_accented_search/static/description/icon.png differ diff --git a/pos_accented_search/static/description/index.html b/pos_accented_search/static/description/index.html new file mode 100644 index 00000000..0364d692 --- /dev/null +++ b/pos_accented_search/static/description/index.html @@ -0,0 +1,428 @@ + + + + + + +Point of Sale - Accented Product Search + + + + + + diff --git a/pos_accented_search/static/src/js/db.js b/pos_accented_search/static/src/js/db.js new file mode 100644 index 00000000..7998ed6d --- /dev/null +++ b/pos_accented_search/static/src/js/db.js @@ -0,0 +1,29 @@ +odoo.define('pos_accented_search', function (require) { + + "use strict"; + var db = require("point_of_sale.DB"); + db.include({ + + normalize_characters: function (product) { + // The normalization extract out combining diacritical marks + // All those diacritics in range [\u0300-\u036f]. + // See https://en.wikipedia.org/wiki/Combining_Diacritical_Marks. + // All the diacritics are removed by the code below. + return product.normalize("NFD") + .replace(/[\u0300-\u036f]/g, "") + .replace(/[\u0152-\u0153]/g, "oe"); + }, + + _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.normalize_characters(query)); + }, + }); + + return db; + +}); + diff --git a/pos_accented_search/views/templates.xml b/pos_accented_search/views/templates.xml new file mode 100644 index 00000000..bdf19225 --- /dev/null +++ b/pos_accented_search/views/templates.xml @@ -0,0 +1,7 @@ + + +