Migrated base_search_fuzzy to v9
parent
11d5cb9735
commit
ee0e5efee1
|
@ -87,6 +87,8 @@ Contributors
|
|||
------------
|
||||
|
||||
* Christoph Giesel <https://github.com/christophlsa>
|
||||
* Jordi Ballester <jordi.ballester@eficent.com>
|
||||
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Eficent Business and IT Consulting Services S.L.
|
||||
# © 2016 Serpent Consulting Services Pvt. Ltd.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import models
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Eficent Business and IT Consulting Services S.L.
|
||||
# © 2016 Serpent Consulting Services Pvt. Ltd.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
{
|
||||
'name': "Fuzzy Search",
|
||||
'summary': "Fuzzy search with the PostgreSQL trigram extension",
|
||||
'category': 'Uncategorized',
|
||||
'version': '8.0.1.0.0',
|
||||
'version': '9.0.1.0.0',
|
||||
'website': 'https://odoo-community.org/',
|
||||
'author': 'bloopark systems GmbH & Co. KG, '
|
||||
'Eficent, '
|
||||
'Serpent CS, '
|
||||
'Odoo Community Association (OCA)',
|
||||
'license': 'AGPL-3',
|
||||
'depends': [
|
||||
'base',
|
||||
],
|
||||
'depends': ['base'],
|
||||
'data': [
|
||||
'views/trgm_index.xml',
|
||||
'security/ir.model.access.csv',
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Eficent Business and IT Consulting Services S.L.
|
||||
# © 2016 Serpent Consulting Services Pvt. Ltd.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import ir_model
|
||||
from . import trgm_index
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Eficent Business and IT Consulting Services S.L.
|
||||
# © 2016 Serpent Consulting Services Pvt. Ltd.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
import logging
|
||||
|
||||
from openerp import models
|
||||
from openerp import models, api
|
||||
from openerp.osv import expression
|
||||
|
||||
|
||||
|
@ -21,9 +23,9 @@ def patch_leaf_trgm(method):
|
|||
params = []
|
||||
|
||||
if left in model._columns:
|
||||
format = model._columns[left]._symbol_set[0]
|
||||
formats = model._columns[left]._symbol_set[0]
|
||||
column = '%s.%s' % (table_alias, expression._quote(left))
|
||||
query = '(%s %s %s)' % (column, sql_operator, format)
|
||||
query = '(%s %s %s)' % (column, sql_operator, formats)
|
||||
elif left in expression.MAGIC_COLUMNS:
|
||||
query = "(%s.\"%s\" %s %%s)" % (
|
||||
table_alias, left, sql_operator)
|
||||
|
@ -49,6 +51,8 @@ def patch_leaf_trgm(method):
|
|||
|
||||
|
||||
def patch_generate_order_by(method):
|
||||
|
||||
@api.model
|
||||
def decorate_generate_order_by(self, order_spec, query):
|
||||
if order_spec and order_spec.startswith('similarity('):
|
||||
return ' ORDER BY ' + order_spec
|
||||
|
@ -78,5 +82,4 @@ class IrModel(models.Model):
|
|||
'__decorated__'):
|
||||
models.BaseModel._generate_order_by = patch_generate_order_by(
|
||||
models.BaseModel._generate_order_by)
|
||||
|
||||
return super(IrModel, self)._register_hook(cr)
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Eficent Business and IT Consulting Services S.L.
|
||||
# © 2016 Serpent Consulting Services Pvt. Ltd.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
import logging
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Eficent Business and IT Consulting Services S.L.
|
||||
# © 2016 Serpent Consulting Services Pvt. Ltd.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import test_query_generation
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Eficent Business and IT Consulting Services S.L.
|
||||
# © 2016 Serpent Consulting Services Pvt. Ltd.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from openerp.osv import expression
|
||||
from openerp.tests.common import TransactionCase, at_install, post_install
|
||||
|
|
Loading…
Reference in New Issue