diff --git a/base_name_search_improved/README.rst b/base_name_search_improved/README.rst index af51fdf1d07..4e82a868969 100644 --- a/base_name_search_improved/README.rst +++ b/base_name_search_improved/README.rst @@ -17,52 +17,55 @@ Improved Name Search :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github - :target: https://github.com/OCA/server-tools/tree/16.0/base_name_search_improved + :target: https://github.com/OCA/server-tools/tree/17.0/base_name_search_improved :alt: OCA/server-tools .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-base_name_search_improved + :target: https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-0-base_name_search_improved :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -Extends the name search feature to use additional, more relaxed -matching methods, and to allow searching into configurable additional -record fields. +Extends the name search feature to use additional, more relaxed matching +methods, and to allow searching into configurable additional record +fields. -The name search is the lookup feature to select a related record. -For example, selecting a Customer on a new Sales order. +The name search is the lookup feature to select a related record. For +example, selecting a Customer on a new Sales order. -For example, typing "john brown" doesn't match "John M. Brown". -The relaxed search also looks up for records containing all the words, -so "John M. Brown" would be a match. -It also tolerates words in a different order, so searching -for "brown john" also works. +For example, typing "john brown" doesn't match "John M. Brown". The +relaxed search also looks up for records containing all the words, so +"John M. Brown" would be a match. It also tolerates words in a different +order, so searching for "brown john" also works. -.. figure:: https://raw.githubusercontent.com/OCA/server-tools/11.0/base_name_search_improved/images/image0.png +|image1| -Additionally, an Administrator can configure other fields to also lookup into. -For example, Customers could be additionally searched by City or Phone number. +Additionally, an Administrator can configure other fields to also lookup +into. For example, Customers could be additionally searched by City or +Phone number. -.. figure:: https://raw.githubusercontent.com/OCA/server-tools/11.0/base_name_search_improved/images/image2.png +|image2| How it works: -Regular name search is performed, and the additional search logic is only -triggered if not enough results are found. -This way, no overhead is added on searches that would normally yield results. +Regular name search is performed, and the additional search logic is +only triggered if not enough results are found. This way, no overhead is +added on searches that would normally yield results. -But if not enough results are found, then additional search methods are tried. -The specific methods used are: +But if not enough results are found, then additional search methods are +tried. The specific methods used are: -- Try regular search on each of the additional fields -- Try ordered word search on each of the search fields -- Try unordered word search on each of the search fields +- Try regular search on each of the additional fields +- Try ordered word search on each of the search fields +- Try unordered word search on each of the search fields -All results found are presented in that order, -hopefully presenting them in order of relevance. +All results found are presented in that order, hopefully presenting them +in order of relevance. + +.. |image1| image:: https://raw.githubusercontent.com/OCA/server-tools/11.0/base_name_search_improved/images/image0.png +.. |image2| image:: https://raw.githubusercontent.com/OCA/server-tools/11.0/base_name_search_improved/images/image2.png **Table of contents** @@ -72,16 +75,16 @@ hopefully presenting them in order of relevance. Configuration ============= -The fuzzy search is automatically enabled on all Models. -Note that this only affects typing in related fields. -The regular ``search()``, used in the top right search box, is not affected. +The fuzzy search is automatically enabled on all Models. Note that this +only affects typing in related fields. The regular ``search()``, used in +the top right search box, is not affected. + +Additional search fields can be configured at Settings > Technical > +Database > Models, using the "Name Search Fields" field. -Additional search fields can be configured at Settings > Technical > Database > Models, -using the "Name Search Fields" field. +|image1| -.. figure:: https://raw.githubusercontent.com/OCA/server-tools/11.0/base_name_search_improved/images/image1.png - :alt: Name Search Fields - :width: 600 px +.. |image1| image:: https://raw.githubusercontent.com/OCA/server-tools/11.0/base_name_search_improved/images/image1.png Usage ===== @@ -91,11 +94,20 @@ Just type into any related field, such as Customer on a Sale Order. Known issues / Roadmap ====================== -* Also use fuzzy search, such as the Levenshtein distance: - https://www.postgresql.org/docs/9.5/static/fuzzystrmatch.html -* The list of additional fields to search could benefit from caching, for efficiency. -* This feature could also be implemented for regular ``search`` on the ``name`` field. -* While adding m2o or other related field that also have an improved name search, that improved name search is not used (while if name_search is customizend on a module and you add a field of that model on another model it works ok). Esto por ejemplo es en productos si agregamos campo "categoría pública" y a categoría pública le ponemos "parent_id". Entonces vamos a ver que si buscamos por una categoría padre no busca nada, en vez si hacemos esa lógica en name_search de modulo si funciona +- Also use fuzzy search, such as the Levenshtein distance: + https://www.postgresql.org/docs/9.5/static/fuzzystrmatch.html +- The list of additional fields to search could benefit from caching, + for efficiency. +- This feature could also be implemented for regular ``search`` on the + ``name`` field. +- While adding m2o or other related field that also have an improved + name search, that improved name search is not used (while if + name_search is customizend on a module and you add a field of that + model on another model it works ok). Esto por ejemplo es en productos + si agregamos campo "categoría pública" y a categoría pública le + ponemos "parent_id". Entonces vamos a ver que si buscamos por una + categoría padre no busca nada, en vez si hacemos esa lógica en + name_search de modulo si funciona Bug Tracker =========== @@ -103,7 +115,7 @@ 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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -111,27 +123,27 @@ Credits ======= Authors -~~~~~~~ +------- * Daniel Reis * ADHOC SA Contributors -~~~~~~~~~~~~ +------------ -* Daniel Reis -* Kitti U. (migrate to v14) -* Radovan Skolnik +- Daniel Reis +- Kitti U. (migrate to v14) +- Radovan Skolnik Other credits -~~~~~~~~~~~~~ +------------- The development of this module has been financially supported by: -* Odoo Community Association +- Odoo Community Association Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -143,6 +155,6 @@ 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. -This module is part of the `OCA/server-tools `_ project on GitHub. +This module is part of the `OCA/server-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_name_search_improved/models/ir_model.py b/base_name_search_improved/models/ir_model.py index 3f654381c57..792b97080b7 100644 --- a/base_name_search_improved/models/ir_model.py +++ b/base_name_search_improved/models/ir_model.py @@ -126,7 +126,6 @@ def _name_search( class Base(models.AbstractModel): - _inherit = "base" # TODO perhaps better to create only the field when enabled on the model diff --git a/base_name_search_improved/pyproject.toml b/base_name_search_improved/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/base_name_search_improved/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/base_name_search_improved/readme/CONFIGURE.md b/base_name_search_improved/readme/CONFIGURE.md new file mode 100644 index 00000000000..a4080a66f0d --- /dev/null +++ b/base_name_search_improved/readme/CONFIGURE.md @@ -0,0 +1,8 @@ +The fuzzy search is automatically enabled on all Models. Note that this +only affects typing in related fields. The regular `search()`, used in +the top right search box, is not affected. + +Additional search fields can be configured at Settings \> Technical \> +Database \> Models, using the "Name Search Fields" field. + +![](https://raw.githubusercontent.com/OCA/server-tools/11.0/base_name_search_improved/images/image1.png) diff --git a/base_name_search_improved/readme/CONFIGURE.rst b/base_name_search_improved/readme/CONFIGURE.rst deleted file mode 100644 index e4d666e8ba5..00000000000 --- a/base_name_search_improved/readme/CONFIGURE.rst +++ /dev/null @@ -1,10 +0,0 @@ -The fuzzy search is automatically enabled on all Models. -Note that this only affects typing in related fields. -The regular ``search()``, used in the top right search box, is not affected. - -Additional search fields can be configured at Settings > Technical > Database > Models, -using the "Name Search Fields" field. - -.. figure:: https://raw.githubusercontent.com/OCA/server-tools/11.0/base_name_search_improved/images/image1.png - :alt: Name Search Fields - :width: 600 px diff --git a/base_name_search_improved/readme/CONTRIBUTORS.md b/base_name_search_improved/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..94149fb7bb6 --- /dev/null +++ b/base_name_search_improved/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- Daniel Reis \<\> +- Kitti U. \<\> (migrate to v14) +- Radovan Skolnik \<\> diff --git a/base_name_search_improved/readme/CONTRIBUTORS.rst b/base_name_search_improved/readme/CONTRIBUTORS.rst deleted file mode 100644 index e49ac772818..00000000000 --- a/base_name_search_improved/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,3 +0,0 @@ -* Daniel Reis -* Kitti U. (migrate to v14) -* Radovan Skolnik diff --git a/base_name_search_improved/readme/CREDITS.rst b/base_name_search_improved/readme/CREDITS.md similarity index 69% rename from base_name_search_improved/readme/CREDITS.rst rename to base_name_search_improved/readme/CREDITS.md index 10db89c6818..da765433609 100644 --- a/base_name_search_improved/readme/CREDITS.rst +++ b/base_name_search_improved/readme/CREDITS.md @@ -1,3 +1,3 @@ The development of this module has been financially supported by: -* Odoo Community Association +- Odoo Community Association diff --git a/base_name_search_improved/readme/DESCRIPTION.md b/base_name_search_improved/readme/DESCRIPTION.md new file mode 100644 index 00000000000..88b7ee5448b --- /dev/null +++ b/base_name_search_improved/readme/DESCRIPTION.md @@ -0,0 +1,35 @@ +Extends the name search feature to use additional, more relaxed matching +methods, and to allow searching into configurable additional record +fields. + +The name search is the lookup feature to select a related record. For +example, selecting a Customer on a new Sales order. + +For example, typing "john brown" doesn't match "John M. Brown". The +relaxed search also looks up for records containing all the words, so +"John M. Brown" would be a match. It also tolerates words in a different +order, so searching for "brown john" also works. + +![](https://raw.githubusercontent.com/OCA/server-tools/11.0/base_name_search_improved/images/image0.png) + +Additionally, an Administrator can configure other fields to also lookup +into. For example, Customers could be additionally searched by City or +Phone number. + +![](https://raw.githubusercontent.com/OCA/server-tools/11.0/base_name_search_improved/images/image2.png) + +How it works: + +Regular name search is performed, and the additional search logic is +only triggered if not enough results are found. This way, no overhead is +added on searches that would normally yield results. + +But if not enough results are found, then additional search methods are +tried. The specific methods used are: + +- Try regular search on each of the additional fields +- Try ordered word search on each of the search fields +- Try unordered word search on each of the search fields + +All results found are presented in that order, hopefully presenting them +in order of relevance. diff --git a/base_name_search_improved/readme/DESCRIPTION.rst b/base_name_search_improved/readme/DESCRIPTION.rst deleted file mode 100644 index a35c57e465e..00000000000 --- a/base_name_search_improved/readme/DESCRIPTION.rst +++ /dev/null @@ -1,35 +0,0 @@ -Extends the name search feature to use additional, more relaxed -matching methods, and to allow searching into configurable additional -record fields. - -The name search is the lookup feature to select a related record. -For example, selecting a Customer on a new Sales order. - -For example, typing "john brown" doesn't match "John M. Brown". -The relaxed search also looks up for records containing all the words, -so "John M. Brown" would be a match. -It also tolerates words in a different order, so searching -for "brown john" also works. - -.. figure:: https://raw.githubusercontent.com/OCA/server-tools/11.0/base_name_search_improved/images/image0.png - -Additionally, an Administrator can configure other fields to also lookup into. -For example, Customers could be additionally searched by City or Phone number. - -.. figure:: https://raw.githubusercontent.com/OCA/server-tools/11.0/base_name_search_improved/images/image2.png - -How it works: - -Regular name search is performed, and the additional search logic is only -triggered if not enough results are found. -This way, no overhead is added on searches that would normally yield results. - -But if not enough results are found, then additional search methods are tried. -The specific methods used are: - -- Try regular search on each of the additional fields -- Try ordered word search on each of the search fields -- Try unordered word search on each of the search fields - -All results found are presented in that order, -hopefully presenting them in order of relevance. diff --git a/base_name_search_improved/readme/ROADMAP.md b/base_name_search_improved/readme/ROADMAP.md new file mode 100644 index 00000000000..d068a4f0984 --- /dev/null +++ b/base_name_search_improved/readme/ROADMAP.md @@ -0,0 +1,14 @@ +- Also use fuzzy search, such as the Levenshtein distance: + +- The list of additional fields to search could benefit from caching, + for efficiency. +- This feature could also be implemented for regular `search` on the + `name` field. +- While adding m2o or other related field that also have an improved + name search, that improved name search is not used (while if + name_search is customizend on a module and you add a field of that + model on another model it works ok). Esto por ejemplo es en productos + si agregamos campo "categoría pública" y a categoría pública le + ponemos "parent_id". Entonces vamos a ver que si buscamos por una + categoría padre no busca nada, en vez si hacemos esa lógica en + name_search de modulo si funciona diff --git a/base_name_search_improved/readme/ROADMAP.rst b/base_name_search_improved/readme/ROADMAP.rst deleted file mode 100644 index 3f4a485d2ea..00000000000 --- a/base_name_search_improved/readme/ROADMAP.rst +++ /dev/null @@ -1,5 +0,0 @@ -* Also use fuzzy search, such as the Levenshtein distance: - https://www.postgresql.org/docs/9.5/static/fuzzystrmatch.html -* The list of additional fields to search could benefit from caching, for efficiency. -* This feature could also be implemented for regular ``search`` on the ``name`` field. -* While adding m2o or other related field that also have an improved name search, that improved name search is not used (while if name_search is customizend on a module and you add a field of that model on another model it works ok). Esto por ejemplo es en productos si agregamos campo "categoría pública" y a categoría pública le ponemos "parent_id". Entonces vamos a ver que si buscamos por una categoría padre no busca nada, en vez si hacemos esa lógica en name_search de modulo si funciona diff --git a/base_name_search_improved/readme/USAGE.rst b/base_name_search_improved/readme/USAGE.md similarity index 100% rename from base_name_search_improved/readme/USAGE.rst rename to base_name_search_improved/readme/USAGE.md