function field not searchable

Bug #479194 reported by Ferdinand on 2009-11-09
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fleet manager

Bug Description

this construct does not allow to search for tenant_id - it just does nothing - the query criteria is ignored

'tenant_id' : fields.function(_tenant_current, method=True, type='many2one', relation='res.partner', string='Tenant' ),

     def _tenant_current(self, cr, uid, ids, field_name, arg, context={}):
         result = {}
         partner_id = ''
         for p in self.browse(cr, uid, ids, context):
             pid =
             cr.execute("""select partner_id from chricar_tenant
                            where (to_date is null or to_date > current_date)
                              and top_id = %d
                            order by name desc;
             """ % pid)
             res = cr.fetchone()
             partner_id = (res and res[0]) or False
             result[] = partner_id
         return result

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers