~clearcorp-drivers/openobject-server/5.0-ccorp

« back to all changes in this revision

Viewing changes to bin/addons/base/res/partner/partner.py

  • Committer: pso (OpenERP)
  • Author(s): Ila(OpenERP), Vincent(Camptocamp)
  • Date: 2011-07-01 07:29:24 UTC
  • Revision ID: pso@tinyerp.com-20110701072924-xfxgwh68t8ygre0a
[IMP] Improved address_get method of partner for few corrections, replaced query by ORM Methods and addition of active field in address (case:6198)

Show diffs side-by-side

added added

removed removed

Lines of Context:
217
217
        return True
218
218
 
219
219
    def address_get(self, cr, uid, ids, adr_pref=['default']):
220
 
        cr.execute('select type,id from res_partner_address where partner_id in %s', (tuple(ids),))
221
 
        res = cr.fetchall()
 
220
        address_obj = self.pool.get('res.partner.address')
 
221
        address_ids = address_obj.search(cr, uid, [('partner_id', '=', ids)])
 
222
        address_rec = address_obj.read(cr, uid, address_ids, ['type'])
 
223
        res = list(tuple(addr.values()) for addr in address_rec)
222
224
        adr = dict(res)
223
225
        # get the id of the (first) default address if there is one,
224
226
        # otherwise get the id of the first address in the list