François Kawala
5 years ago
committed by
Francois Kawala
4 changed files with 101 additions and 33 deletions
-
71pos_accented_search/README.rst
-
25pos_accented_search/__openerp__.py
-
25pos_accented_search/static/src/js/db.js
-
13pos_accented_search/views/templates.xml
@ -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 |
||||
|
<https://github.com/OCA/{project_repo}/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 |
||||
|
<https://github.com/OCA/ |
||||
|
pos/issues/new?body=module:%20 |
||||
|
pos_accented_search%0Aversion:%20 |
||||
|
9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
||||
|
|
||||
|
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. |
@ -1,22 +1,19 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- 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", |
'website': "http://www.lenid.ch", |
||||
'license': 'AGPL-3', |
'license': 'AGPL-3', |
||||
'category': 'Point of Sale', |
|
||||
'version': '0.1', |
|
||||
'depends': ['point_of_sale'], |
|
||||
|
'depends': [ |
||||
|
'point_of_sale', |
||||
|
], |
||||
'data': [ |
'data': [ |
||||
'views/templates.xml', |
'views/templates.xml', |
||||
], |
], |
||||
|
'installable': True, |
||||
} |
} |
@ -1,22 +1,25 @@ |
|||||
odoo.define('pos_accented_search', function (require) { |
odoo.define('pos_accented_search', function (require) { |
||||
|
|
||||
"use strict"; |
"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; |
||||
|
|
||||
}); |
}); |
||||
|
|
@ -1,10 +1,7 @@ |
|||||
<odoo> |
<odoo> |
||||
<data> |
|
||||
|
|
||||
<template id="assets_backend" name="pos_accented_search" inherit_id="point_of_sale.assets"> |
|
||||
<xpath expr="." position="inside"> |
|
||||
<script type="text/javascript" src="/pos_accented_search/static/src/js/db.js"></script> |
|
||||
</xpath> |
|
||||
</template> |
|
||||
</data> |
|
||||
|
<template id="assets_backend" name="pos_accented_search" inherit_id="point_of_sale.assets"> |
||||
|
<xpath expr="." position="inside"> |
||||
|
<script type="text/javascript" src="/pos_accented_search/static/src/js/db.js"></script> |
||||
|
</xpath> |
||||
|
</template> |
||||
</odoo> |
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue