[FIX] res_partner_address: make name_search consistent with respect to name_get
bzr revid: rco@openerp.com-20120319130422-wc6icri4v0o3z8wg
This commit is contained in:
parent
307726c6ba
commit
baa522eba1
|
@ -349,18 +349,14 @@ class res_partner_address(osv.osv):
|
|||
args=[]
|
||||
if not context:
|
||||
context={}
|
||||
if context.get('contact_display', 'contact')=='partner ' or context.get('contact_display', 'contact')=='partner_address ' :
|
||||
ids = self.search(cr, user, [('partner_id',operator,name)], limit=limit, context=context)
|
||||
if context.get('contact_display', 'contact')=='partner':
|
||||
fields = ['partner_id']
|
||||
else:
|
||||
if not name:
|
||||
ids = self.search(cr, user, args, limit=limit, context=context)
|
||||
else:
|
||||
ids = self.search(cr, user, [('zip','=',name)] + args, limit=limit, context=context)
|
||||
if not ids:
|
||||
ids = self.search(cr, user, [('city',operator,name)] + args, limit=limit, context=context)
|
||||
if name:
|
||||
ids += self.search(cr, user, [('name',operator,name)] + args, limit=limit, context=context)
|
||||
ids += self.search(cr, user, [('partner_id',operator,name)] + args, limit=limit, context=context)
|
||||
fields = ['name', 'country_id', 'city', 'street']
|
||||
if context.get('contact_display', 'contact')=='partner_address':
|
||||
fields.append('partner_id')
|
||||
domain = ['|'] * (len(fields)-1) + map(lambda f: (f, operator, name), fields)
|
||||
ids = self.search(cr, user, domain + args, limit=limit, context=context)
|
||||
return self.name_get(cr, user, ids, context=context)
|
||||
|
||||
def get_city(self, cr, uid, id):
|
||||
|
|
Loading…
Reference in New Issue