base_search_fuzzy: Migration to 13.0
parent
37fb022bee
commit
1b9706d8fd
|
@ -14,13 +14,13 @@ Fuzzy Search
|
||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
|
||||||
:target: https://github.com/OCA/server-tools/tree/12.0/base_search_fuzzy
|
:target: https://github.com/OCA/server-tools/tree/13.0/base_search_fuzzy
|
||||||
:alt: OCA/server-tools
|
:alt: OCA/server-tools
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
:target: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-base_search_fuzzy
|
:target: https://translation.odoo-community.org/projects/server-tools-13-0/server-tools-13-0-base_search_fuzzy
|
||||||
:alt: Translate me on Weblate
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||||
:target: https://runbot.odoo-community.org/runbot/149/12.0
|
:target: https://runbot.odoo-community.org/runbot/149/13.0
|
||||||
:alt: Try me on Runbot
|
:alt: Try me on Runbot
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
@ -81,6 +81,19 @@ Usage
|
||||||
For further questions read the Documentation of the
|
For further questions read the Documentation of the
|
||||||
`pg_trgm <https://www.postgresql.org/docs/current/static/pgtrgm.html>`_ module.
|
`pg_trgm <https://www.postgresql.org/docs/current/static/pgtrgm.html>`_ module.
|
||||||
|
|
||||||
|
|
||||||
|
Usage with demo data
|
||||||
|
====================
|
||||||
|
|
||||||
|
There are some demo data that allow you to test functionally this module
|
||||||
|
if you are in a **demo** database. The steps are the following:
|
||||||
|
|
||||||
|
#. Then type the text **Jon Smith** or **Smith John** in the search box and
|
||||||
|
select **Search Display Name for: ...**
|
||||||
|
#. You will see two contacts, and they are the ones with display names
|
||||||
|
**John Smith** and **John Smizz**. (See corresponding `demo code
|
||||||
|
<https://github.com/OCA/server-tools/tree/13.0/base_search_fuzzy/demo/res_partner_demo.xml#L18>`_)
|
||||||
|
|
||||||
Known issues / Roadmap
|
Known issues / Roadmap
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
@ -93,7 +106,7 @@ Bug Tracker
|
||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
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
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_search_fuzzy%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_search_fuzzy%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
Do not contact contributors directly about support or help with technical issues.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
|
@ -133,6 +146,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
promote its widespread use.
|
||||||
|
|
||||||
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/12.0/base_search_fuzzy>`_ project on GitHub.
|
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/13.0/base_search_fuzzy>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"name": "Fuzzy Search",
|
"name": "Fuzzy Search",
|
||||||
"summary": "Fuzzy search with the PostgreSQL trigram extension",
|
"summary": "Fuzzy search with the PostgreSQL trigram extension",
|
||||||
"category": "Uncategorized",
|
"category": "Uncategorized",
|
||||||
"version": "12.0.1.0.0",
|
"version": "13.0.1.0.0",
|
||||||
"website": "https://github.com/OCA/server-tools",
|
"website": "https://github.com/OCA/server-tools",
|
||||||
"author": "bloopark systems GmbH & Co. KG, "
|
"author": "bloopark systems GmbH & Co. KG, "
|
||||||
"Eficent, "
|
"Eficent, "
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
"Odoo Community Association (OCA)",
|
"Odoo Community Association (OCA)",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"depends": ["base"],
|
"depends": ["base"],
|
||||||
"data": ["views/trgm_index.xml", "security/ir.model.access.csv",],
|
"data": ["views/trgm_index.xml", "security/ir.model.access.csv"],
|
||||||
|
"demo": ["demo/res_partner_demo.xml", "demo/TrgmIndex_demo.xml"],
|
||||||
"installable": True,
|
"installable": True,
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="trgm_index_gin_partner_name" model="trgm.index">
|
||||||
|
<field name="field_id" ref="base.field_res_partner__name" />
|
||||||
|
<field name="index_type">gin</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="res_partner_John_Smith" model="res.partner">
|
||||||
|
<field name="name">John Smith</field>
|
||||||
|
</record>
|
||||||
|
<record id="res_partner_John_Smizz" model="res.partner">
|
||||||
|
<field name="name">John Smizz</field>
|
||||||
|
</record>
|
||||||
|
<record id="res_partner_Linus_Torvalds" model="res.partner">
|
||||||
|
<field name="name">Linus Torvalds</field>
|
||||||
|
</record>
|
||||||
|
<record id="view_res_partner_filter" model="ir.ui.view">
|
||||||
|
<field name="model">res.partner</field>
|
||||||
|
<field name="inherit_id" ref="base.view_res_partner_filter" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="name" position="after">
|
||||||
|
<field name="display_name" operator="%" />
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 13.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"Last-Translator: <>\n"
|
"Last-Translator: <>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
|
|
|
@ -25,15 +25,15 @@ def patch_leaf_trgm(method):
|
||||||
if left in model._fields:
|
if left in model._fields:
|
||||||
column = "{}.{}".format(table_alias, expression._quote(left))
|
column = "{}.{}".format(table_alias, expression._quote(left))
|
||||||
query = "({} {} {})".format(
|
query = "({} {} {})".format(
|
||||||
column,
|
column, sql_operator, model._fields[left].column_format,
|
||||||
sql_operator,
|
|
||||||
model._fields[left].column_format,
|
|
||||||
)
|
)
|
||||||
elif left in models.MAGIC_COLUMNS:
|
elif left in models.MAGIC_COLUMNS:
|
||||||
query = '({}."{}" {} %s)'.format(table_alias, left, sql_operator)
|
query = '({}."{}" {} %s)'.format(table_alias, left, sql_operator)
|
||||||
params = right
|
params = right
|
||||||
else: # Must not happen
|
else: # Must not happen
|
||||||
raise ValueError(_("Invalid field {!r} in domain term {!r}".format(left, leaf)))
|
raise ValueError(
|
||||||
|
_("Invalid field {!r} in domain term {!r}".format(left, leaf))
|
||||||
|
)
|
||||||
|
|
||||||
if left in model._fields:
|
if left in model._fields:
|
||||||
params = str(right)
|
params = str(right)
|
||||||
|
@ -67,7 +67,6 @@ class IrModel(models.Model):
|
||||||
|
|
||||||
_inherit = "ir.model"
|
_inherit = "ir.model"
|
||||||
|
|
||||||
@api.model_cr
|
|
||||||
def _register_hook(self):
|
def _register_hook(self):
|
||||||
# We have to prevent wrapping the function twice to avoid recursion
|
# We have to prevent wrapping the function twice to avoid recursion
|
||||||
# errors
|
# errors
|
||||||
|
@ -83,4 +82,4 @@ class IrModel(models.Model):
|
||||||
models.BaseModel._generate_order_by = patch_generate_order_by(
|
models.BaseModel._generate_order_by = patch_generate_order_by(
|
||||||
models.BaseModel._generate_order_by
|
models.BaseModel._generate_order_by
|
||||||
)
|
)
|
||||||
return super(IrModel, self)._register_hook()
|
return super()._register_hook()
|
||||||
|
|
|
@ -47,7 +47,6 @@ class TrgmIndex(models.Model):
|
||||||
'GiST for often-updated data."',
|
'GiST for often-updated data."',
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.model_cr
|
|
||||||
def _trgm_extension_exists(self):
|
def _trgm_extension_exists(self):
|
||||||
self.env.cr.execute(
|
self.env.cr.execute(
|
||||||
"""
|
"""
|
||||||
|
@ -67,18 +66,16 @@ class TrgmIndex(models.Model):
|
||||||
|
|
||||||
return "installed"
|
return "installed"
|
||||||
|
|
||||||
@api.model_cr
|
|
||||||
def _is_postgres_superuser(self):
|
def _is_postgres_superuser(self):
|
||||||
self.env.cr.execute("SHOW is_superuser;")
|
self.env.cr.execute("SHOW is_superuser;")
|
||||||
superuser = self.env.cr.fetchone()
|
superuser = self.env.cr.fetchone()
|
||||||
return superuser is not None and superuser[0] == "on" or False
|
return superuser is not None and superuser[0] == "on" or False
|
||||||
|
|
||||||
@api.model_cr
|
|
||||||
def _install_trgm_extension(self):
|
def _install_trgm_extension(self):
|
||||||
extension = self._trgm_extension_exists()
|
extension = self._trgm_extension_exists()
|
||||||
if extension == "missing":
|
if extension == "missing":
|
||||||
_logger.warning(
|
_logger.warning(
|
||||||
"To use pg_trgm you have to install the " "postgres-contrib module."
|
"To use pg_trgm you have to install the postgres-contrib module."
|
||||||
)
|
)
|
||||||
elif extension == "uninstalled":
|
elif extension == "uninstalled":
|
||||||
if self._is_postgres_superuser():
|
if self._is_postgres_superuser():
|
||||||
|
@ -94,9 +91,8 @@ class TrgmIndex(models.Model):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@api.model_cr_context
|
|
||||||
def _auto_init(self):
|
def _auto_init(self):
|
||||||
res = super(TrgmIndex, self)._auto_init()
|
res = super()._auto_init()
|
||||||
if self._install_trgm_extension():
|
if self._install_trgm_extension():
|
||||||
_logger.info(
|
_logger.info(
|
||||||
"The pg_trgm is loaded in the database and the "
|
"The pg_trgm is loaded in the database and the "
|
||||||
|
@ -104,7 +100,6 @@ class TrgmIndex(models.Model):
|
||||||
)
|
)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.model_cr
|
|
||||||
def get_not_used_index(self, index_name, table_name, inc=1):
|
def get_not_used_index(self, index_name, table_name, inc=1):
|
||||||
if inc > 1:
|
if inc > 1:
|
||||||
new_index_name = index_name + str(inc)
|
new_index_name = index_name + str(inc)
|
||||||
|
@ -127,13 +122,12 @@ class TrgmIndex(models.Model):
|
||||||
|
|
||||||
return False, new_index_name
|
return False, new_index_name
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def create_index(self):
|
def create_index(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
|
|
||||||
if not self._install_trgm_extension():
|
if not self._install_trgm_extension():
|
||||||
raise exceptions.UserError(
|
raise exceptions.UserError(
|
||||||
_("The pg_trgm extension does not exists or cannot be " "installed.")
|
_("The pg_trgm extension does not exists or cannot be installed.")
|
||||||
)
|
)
|
||||||
|
|
||||||
table_name = self.env[self.field_id.model_id.model]._table
|
table_name = self.env[self.field_id.model_id.model]._table
|
||||||
|
@ -172,17 +166,16 @@ class TrgmIndex(models.Model):
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def create(self, vals):
|
def create(self, vals):
|
||||||
rec = super(TrgmIndex, self).create(vals)
|
rec = super().create(vals)
|
||||||
rec.index_name = rec.create_index()
|
rec.index_name = rec.create_index()
|
||||||
return rec
|
return rec
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def unlink(self):
|
def unlink(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
self.env.cr.execute(
|
self.env.cr.execute(
|
||||||
"""
|
"""
|
||||||
DROP INDEX IF EXISTS %(index)s;
|
DROP INDEX IF EXISTS %(index)s;
|
||||||
""",
|
""",
|
||||||
{"index": AsIs(rec.index_name),},
|
{"index": AsIs(rec.index_name)},
|
||||||
)
|
)
|
||||||
return super(TrgmIndex, self).unlink()
|
return super().unlink()
|
||||||
|
|
|
@ -22,3 +22,15 @@
|
||||||
|
|
||||||
For further questions read the Documentation of the
|
For further questions read the Documentation of the
|
||||||
`pg_trgm <https://www.postgresql.org/docs/current/static/pgtrgm.html>`_ module.
|
`pg_trgm <https://www.postgresql.org/docs/current/static/pgtrgm.html>`_ module.
|
||||||
|
|
||||||
|
|
||||||
|
Usage with demo data
|
||||||
|
====================
|
||||||
|
|
||||||
|
There are some demo data that allow you to test functionally this module
|
||||||
|
if you are in a **demo** database. The steps are the following:
|
||||||
|
|
||||||
|
#. Go to *Contacts* and type the text **Jon Smith** or **Smith John** in
|
||||||
|
the search box and select **Search Display Name for: ...**
|
||||||
|
#. You will see two contacts, and they are the ones with display names
|
||||||
|
**John Smith** and **John Smizz**.
|
||||||
|
|
|
@ -367,7 +367,7 @@ ul.auto-toc {
|
||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-tools/tree/12.0/base_search_fuzzy"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-base_search_fuzzy"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/149/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-tools/tree/13.0/base_search_fuzzy"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-tools-13-0/server-tools-13-0-base_search_fuzzy"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/149/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>This addon provides the ability to create GIN or GiST indexes of char and text
|
<p>This addon provides the ability to create GIN or GiST indexes of char and text
|
||||||
fields and also to use the search operator <cite>%</cite> in search domains. Currently
|
fields and also to use the search operator <cite>%</cite> in search domains. Currently
|
||||||
this module doesn’t change the backend search or anything else. It provides
|
this module doesn’t change the backend search or anything else. It provides
|
||||||
|
@ -378,12 +378,13 @@ only the possibility to perform the fuzzy search for external addons.</p>
|
||||||
<li><a class="reference internal" href="#installation" id="id1">Installation</a></li>
|
<li><a class="reference internal" href="#installation" id="id1">Installation</a></li>
|
||||||
<li><a class="reference internal" href="#configuration" id="id2">Configuration</a></li>
|
<li><a class="reference internal" href="#configuration" id="id2">Configuration</a></li>
|
||||||
<li><a class="reference internal" href="#usage" id="id3">Usage</a></li>
|
<li><a class="reference internal" href="#usage" id="id3">Usage</a></li>
|
||||||
<li><a class="reference internal" href="#known-issues-roadmap" id="id4">Known issues / Roadmap</a></li>
|
<li><a class="reference internal" href="#usage-with-demo-data" id="id4">Usage with demo data</a></li>
|
||||||
<li><a class="reference internal" href="#bug-tracker" id="id5">Bug Tracker</a></li>
|
<li><a class="reference internal" href="#known-issues-roadmap" id="id5">Known issues / Roadmap</a></li>
|
||||||
<li><a class="reference internal" href="#credits" id="id6">Credits</a><ul>
|
<li><a class="reference internal" href="#bug-tracker" id="id6">Bug Tracker</a></li>
|
||||||
<li><a class="reference internal" href="#authors" id="id7">Authors</a></li>
|
<li><a class="reference internal" href="#credits" id="id7">Credits</a><ul>
|
||||||
<li><a class="reference internal" href="#contributors" id="id8">Contributors</a></li>
|
<li><a class="reference internal" href="#authors" id="id8">Authors</a></li>
|
||||||
<li><a class="reference internal" href="#maintainers" id="id9">Maintainers</a></li>
|
<li><a class="reference internal" href="#contributors" id="id9">Contributors</a></li>
|
||||||
|
<li><a class="reference internal" href="#maintainers" id="id10">Maintainers</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -434,25 +435,36 @@ followed:</p>
|
||||||
<p>For further questions read the Documentation of the
|
<p>For further questions read the Documentation of the
|
||||||
<a class="reference external" href="https://www.postgresql.org/docs/current/static/pgtrgm.html">pg_trgm</a> module.</p>
|
<a class="reference external" href="https://www.postgresql.org/docs/current/static/pgtrgm.html">pg_trgm</a> module.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="section" id="usage-with-demo-data">
|
||||||
|
<h1><a class="toc-backref" href="#id4">Usage with demo data</a></h1>
|
||||||
|
<p>There are some demo data that allow you to test functionally this module
|
||||||
|
if you are in a <strong>demo</strong> database. The steps are the following:</p>
|
||||||
|
<ol class="arabic simple">
|
||||||
|
<li>Then type the text <strong>Jon Smith</strong> or <strong>Smith John</strong> in the search box and
|
||||||
|
select <strong>Search Display Name for: …</strong></li>
|
||||||
|
<li>You will see two contacts, and they are the ones with display names
|
||||||
|
<strong>John Smith</strong> and <strong>John Smizz</strong>. (See corresponding <a class="reference external" href="https://github.com/OCA/server-tools/tree/13.0/base_search_fuzzy/demo/res_partner_demo.xml#L18">demo code</a>)</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
<div class="section" id="known-issues-roadmap">
|
<div class="section" id="known-issues-roadmap">
|
||||||
<h1><a class="toc-backref" href="#id4">Known issues / Roadmap</a></h1>
|
<h1><a class="toc-backref" href="#id5">Known issues / Roadmap</a></h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Modify the general search parts (e.g. in tree view or many2one fields)</li>
|
<li>Modify the general search parts (e.g. in tree view or many2one fields)</li>
|
||||||
<li>Add better <cite>order by</cite> handling</li>
|
<li>Add better <cite>order by</cite> handling</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="bug-tracker">
|
<div class="section" id="bug-tracker">
|
||||||
<h1><a class="toc-backref" href="#id5">Bug Tracker</a></h1>
|
<h1><a class="toc-backref" href="#id6">Bug Tracker</a></h1>
|
||||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
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
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_search_fuzzy%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_search_fuzzy%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<div class="section" id="credits">
|
||||||
<h1><a class="toc-backref" href="#id6">Credits</a></h1>
|
<h1><a class="toc-backref" href="#id7">Credits</a></h1>
|
||||||
<div class="section" id="authors">
|
<div class="section" id="authors">
|
||||||
<h2><a class="toc-backref" href="#id7">Authors</a></h2>
|
<h2><a class="toc-backref" href="#id8">Authors</a></h2>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>bloopark systems GmbH & Co. KG</li>
|
<li>bloopark systems GmbH & Co. KG</li>
|
||||||
<li>Eficent</li>
|
<li>Eficent</li>
|
||||||
|
@ -460,7 +472,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="contributors">
|
<div class="section" id="contributors">
|
||||||
<h2><a class="toc-backref" href="#id8">Contributors</a></h2>
|
<h2><a class="toc-backref" href="#id9">Contributors</a></h2>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Christoph Giesel <<a class="reference external" href="https://github.com/christophlsa">https://github.com/christophlsa</a>></li>
|
<li>Christoph Giesel <<a class="reference external" href="https://github.com/christophlsa">https://github.com/christophlsa</a>></li>
|
||||||
<li>Jordi Ballester <<a class="reference external" href="mailto:jordi.ballester@eficent.com">jordi.ballester@eficent.com</a>></li>
|
<li>Jordi Ballester <<a class="reference external" href="mailto:jordi.ballester@eficent.com">jordi.ballester@eficent.com</a>></li>
|
||||||
|
@ -474,13 +486,13 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="maintainers">
|
<div class="section" id="maintainers">
|
||||||
<h2><a class="toc-backref" href="#id9">Maintainers</a></h2>
|
<h2><a class="toc-backref" href="#id10">Maintainers</a></h2>
|
||||||
<p>This module is maintained by the OCA.</p>
|
<p>This module is maintained by the OCA.</p>
|
||||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.</p>
|
promote its widespread use.</p>
|
||||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/12.0/base_search_fuzzy">OCA/server-tools</a> project on GitHub.</p>
|
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/13.0/base_search_fuzzy">OCA/server-tools</a> project on GitHub.</p>
|
||||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
|
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
from odoo.osv import expression
|
from odoo.osv import expression
|
||||||
from odoo.tests.common import TransactionCase, at_install, post_install
|
from odoo.tests.common import TransactionCase, tagged
|
||||||
|
|
||||||
|
|
||||||
@at_install(False)
|
@tagged("post_install", "-at_install")
|
||||||
@post_install(True)
|
|
||||||
class QueryGenerationCase(TransactionCase):
|
class QueryGenerationCase(TransactionCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(QueryGenerationCase, self).setUp()
|
super(QueryGenerationCase, self).setUp()
|
||||||
|
@ -30,7 +29,8 @@ class QueryGenerationCase(TransactionCase):
|
||||||
# test the right sql query statement creation
|
# test the right sql query statement creation
|
||||||
# now there should be only one '%'
|
# now there should be only one '%'
|
||||||
complete_where = self.env.cr.mogrify(
|
complete_where = self.env.cr.mogrify(
|
||||||
"SELECT FROM {} WHERE {}".format(from_clause, where_clause), where_clause_params
|
"SELECT FROM {} WHERE {}".format(from_clause, where_clause),
|
||||||
|
where_clause_params,
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
complete_where,
|
complete_where,
|
||||||
|
@ -53,7 +53,8 @@ class QueryGenerationCase(TransactionCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
complete_where = self.env.cr.mogrify(
|
complete_where = self.env.cr.mogrify(
|
||||||
"SELECT FROM {} WHERE {}".format(from_clause, where_clause), where_clause_params
|
"SELECT FROM {} WHERE {}".format(from_clause, where_clause),
|
||||||
|
where_clause_params,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
|
@ -76,7 +77,7 @@ class QueryGenerationCase(TransactionCase):
|
||||||
if not self.TrgmIndex.index_exists("res.partner", "name"):
|
if not self.TrgmIndex.index_exists("res.partner", "name"):
|
||||||
field_partner_name = self.env.ref("base.field_res_partner__name")
|
field_partner_name = self.env.ref("base.field_res_partner__name")
|
||||||
self.TrgmIndex.create(
|
self.TrgmIndex.create(
|
||||||
{"field_id": field_partner_name.id, "index_type": "gin",}
|
{"field_id": field_partner_name.id, "index_type": "gin"}
|
||||||
)
|
)
|
||||||
|
|
||||||
partner1 = self.ResPartner.create({"name": "John Smith"})
|
partner1 = self.ResPartner.create({"name": "John Smith"})
|
||||||
|
|
|
@ -32,9 +32,7 @@
|
||||||
<record model="ir.actions.act_window" id="trgm_index_action">
|
<record model="ir.actions.act_window" id="trgm_index_action">
|
||||||
<field name="name">Trigram Index</field>
|
<field name="name">Trigram Index</field>
|
||||||
<field name="res_model">trgm.index</field>
|
<field name="res_model">trgm.index</field>
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">tree,form</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
|
||||||
</record>
|
</record>
|
||||||
<menuitem
|
<menuitem
|
||||||
id="trgm_index_menu"
|
id="trgm_index_menu"
|
||||||
|
|
Loading…
Reference in New Issue