[IMP] remove useless variable, where_clause at least '' as created from a str.join()
authorMartin Trigaux <mat@openerp.com>
Wed, 29 Jan 2014 11:19:59 +0000 (12:19 +0100)
committerMartin Trigaux <mat@openerp.com>
Wed, 29 Jan 2014 11:19:59 +0000 (12:19 +0100)
bzr revid: mat@openerp.com-20140129111959-7y9su01ooneu0mco

openerp/addons/base/res/res_partner.py

index 46ecbbe..d3d8804 100644 (file)
@@ -601,7 +601,6 @@ class res_partner(osv.osv, format_address):
             where_query = self._where_calc(cr, uid, args, context=context)
             self._apply_ir_rules(cr, uid, where_query, 'read', context=context)
             from_clause, where_clause, where_clause_params = where_query.get_sql()
-            where_str = where_clause and (" WHERE %s" % where_clause) or ''
 
             # search on the name of the contacts and of its company
             search_name = name
@@ -618,8 +617,8 @@ class res_partner(osv.osv, format_address):
             #            a random selection of `limit` results.
             query = ('''SELECT res_partner.id FROM res_partner
                                           LEFT JOIN res_partner company
-                                               ON res_partner.parent_id = company.id'''
-                        + where_str +
+                                               ON res_partner.parent_id = company.id
+                        WHERE ''' + where_clause +
                         ''' AND res_partner.email ''' + operator + ''' %s OR
                               CASE
                                    WHEN company.id IS NULL OR res_partner.is_company
@@ -639,7 +638,6 @@ class res_partner(osv.osv, format_address):
                 where_clause_params.append(limit)
             cr.execute(query, where_clause_params)
             ids = map(lambda x: x[0], cr.fetchall())
-
             if ids:
                 return self.name_get(cr, uid, ids, context)
         return super(res_partner,self).name_search(cr, uid, name, args, operator=operator, context=context, limit=limit)