[FIX] change the module of the override of name_search
This commit is contained in:
@@ -62,18 +62,6 @@ class Partner(models.Model):
|
||||
name_title = ' '.join([title, name_title])
|
||||
self.name_title = name_title
|
||||
|
||||
@api.model
|
||||
def name_search(self, name, args=None, operator='ilike', limit=100):
|
||||
if args is None:
|
||||
args = []
|
||||
if name:
|
||||
# only filter on name and ref not in email
|
||||
args += [
|
||||
'|', ('display_name', 'ilike', name), ('ref', 'ilike', name)]
|
||||
res = super(Partner, self).name_search(
|
||||
name, args=args, operator=operator, limit=limit)
|
||||
return [(pid, val.replace('\n', ' ')) for pid, val in res]
|
||||
|
||||
|
||||
class ResPartnerCategory(models.Model):
|
||||
_inherit = 'res.partner.category'
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
from . import partner
|
||||
|
||||
39
partner_search/partner.py
Normal file
39
partner_search/partner.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Base Usability module for Odoo
|
||||
# Copyright (C) 2015 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import models, api
|
||||
|
||||
|
||||
class Partner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
@api.model
|
||||
def name_search(self, name, args=None, operator='ilike', limit=100):
|
||||
if args is None:
|
||||
args = []
|
||||
if name:
|
||||
# only filter on name and ref not in email
|
||||
args += [
|
||||
'|', ('display_name', 'ilike', name), ('ref', 'ilike', name)]
|
||||
res = super(Partner, self).name_search(
|
||||
name, args=args, operator=operator, limit=limit)
|
||||
return [(pid, val.replace('\n', ' ')) for pid, val in res]
|
||||
Reference in New Issue
Block a user