function field not searchable

Bug #479194 reported by Ferdinand
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fleet manager
New
Undecided
Unassigned

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 = p.id
             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[p.id] = partner_id
         return result

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.