241
244
return [('id', 'in', res_ids)]
246
def _is_function(self, cr, uid, ids, field_name, args, context={}):
248
Determines if the field is a function or not
252
for field in self.browse(cr, uid, ids, context=context):
253
res[field.id] = False
254
if self.pool.get(field.model_id.model)._columns[field.name]._properties:
260
def _search_function(self, cr, uid, obj, name, args, context={}):
262
Return all fields which are a function field
268
if a[0] == 'is_function':
271
model_ids = context.get('model_ids', [(6,0,[])])[0][2]
274
model_ids = self.pool.get('ir.model').search(cr, uid, [], context=context)
276
for obj in self.pool.get('ir.model').browse(cr, uid, model_ids, context=context):
277
for field in obj.field_id:
278
all_fields_ids.append(field.id)
279
if self.pool.get(obj.model)._columns[field.name]._properties:
280
field_ids.append(field.id)
282
if (a[1] == '=' and a[2] == False) or (a[1] == '!=' and a[2] == True):
283
return [('id', 'not in', field_ids)]
285
return [('id', 'in', field_ids)]
244
292
'model_search_id': fields.function(_get_model_search,
245
293
fnct_search=_search_model_search,
247
295
type='many2one', relation='ir.model',
297
'is_function': fields.function(_is_function,
298
fnct_search=_search_function,
300
type='boolean', string='Is function ?'),
303
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False):
305
Call the view on context if there is.
307
if view_type == 'tree' and context and 'special_tree_id' in context:
308
view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'object_query', context.get('special_tree_id'))[1]
309
if view_type == 'search' and context and 'special_search_id' in context:
310
view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'object_query', context.get('special_search_id'))[1]
312
return super(ir_fields, self).fields_view_get(cr, uid,
253
322
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
b'\\ No newline at end of file'