~al-openerp/openobject-server/5.0_cache_lru2

« back to all changes in this revision

Viewing changes to bin/osv/orm.py

  • Committer: Jay(OpenERP)
  • Date: 2010-09-03 13:06:06 UTC
  • Revision ID: jvo@tinyerp.com-20100903130606-0sc1rftfxns40anw
[FIX] read() should never return [] if fields are not empty

Show diffs side-by-side

added added

removed removed

Lines of Context:
2303
2303
                res.extend(cr.dictfetchall())
2304
2304
        else:
2305
2305
            res = map(lambda x: {'id': x}, ids)
2306
 
 
 
2306
        
 
2307
        if not res:
 
2308
            res = map(lambda x: {'id': x}, ids)
 
2309
            for record in res:
 
2310
                for f in fields_to_read:
 
2311
                    field_val = False
 
2312
                    if f in self._columns.keys():
 
2313
                        ftype = self._columns[f]._type
 
2314
                    elif key in self._inherit_fields.keys():
 
2315
                        ftype = self._inherit_fields[f][2]._type
 
2316
                    else:
 
2317
                        continue
 
2318
                    if ftype in ('one2many', 'many2many'):
 
2319
                        field_val = []
 
2320
                    record.update({f:field_val})
 
2321
        
2307
2322
        for f in fields_pre:
2308
2323
            if f == self.CONCURRENCY_CHECK_FIELD:
2309
2324
                continue