1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# document_csv module for OpenERP
5
# Copyright (C) 2009 SYLEAM (<http://www.syleam.fr>) Christophe CHAUVET
7
# This file is a part of document_csv
9
# document_csv is free software: you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation, either version 3 of the License, or
12
# (at your option) any later version.
14
# document_csv is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
19
# You should have received a copy of the GNU General Public License
20
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22
##############################################################################
25
from osv import fields
27
class ir_model_fields(osv.osv):
28
_inherit = 'ir.model.fields'
30
def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=80):
32
Extend this method to retrieve the model and these inherits
34
if context.get('import'):
35
model_obj = self.pool.get('ir.model')
36
model = model_obj.read(cr, uid, args[0][2], ['model'])
37
inherits = self.pool.get(model['model'])._inherits
39
mod_ids = [args[0][2]]
41
mod_id = model_obj.search(cr, uid, [('model','=', m)])
42
mod_ids.append(mod_id[0])
43
args = [('model_id','in', mod_ids)]
44
return super(ir_model_fields, self).name_search(cr, uid, name, args, operator, context, limit)
48
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: