1
# -*- encoding: utf-8 -*-
2
###########################################################################
3
# Module Writen to OpenERP, Open Source Management Solution
5
# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com
8
############################################################################
9
# Coded by: julio (julio@vauxoo.com)
10
############################################################################
12
# This program is free software: you can redistribute it and/or modify
13
# it under the terms of the GNU Affero General Public License as
14
# published by the Free Software Foundation, either version 3 of the
15
# License, or (at your option) any later version.
17
# This program is distributed in the hope that it will be useful,
18
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
# GNU Affero General Public License for more details.
22
# You should have received a copy of the GNU Affero General Public License
23
# along with this program. If not, see <http://www.gnu.org/licenses/>.
25
##############################################################################
27
from osv import osv, fields
30
class stock_location(osv.osv):
31
_inherit = 'stock.location'
33
'code' : fields.char('Code', size=64)
36
def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100):
40
ids = self.search(cr, user, [('code','=',name)]+ args, limit=limit, context=context)
43
ids.update(self.search(cr, user, args + [('code',operator,name)], limit=limit, context=context))
44
ids.update(map(lambda a: a[0], super(stock_location, self).name_search(cr, user, name=name, args=args, operator=operator, context=context, limit=limit)))
47
ids = self.search(cr, user, args, limit=limit, context=context)
48
result = self.name_get(cr, user, ids, context=context)