'Returns some metadata about the given records.
:return: list of ownership dictionaries for each requested record
:rtype: list of dictionaries with the following keys:
* id: object id
* create_uid: user who created the record
* create_date: date when the record was created
* write_uid: last user who changed the record
* write_date: date of the last change to the record
* xmlid: XML ID to use to refer to this record (if there is one), in format ``module.name``
* noupdate: A boolean telling if the record will be updated or not'

@api.multi
def get_metadata(self):

    fields = ['id']
    if self._log_access:
        fields += LOG_ACCESS_COLUMNS
    quoted_table = ('"%s"' % self._table)
    fields_str = ','.join((('%s.%s' % (quoted_table, field)) for field in fields))
    query = ('SELECT    %s,    __imd.noupdate,    __imd.module,    __imd.name\n                                                                            FROM    %s    LEFT    JOIN    ir_model_data    __imd\n                                                                                            ON    (__imd.model    =    %%s    and    __imd.res_id    =    %s.id)\n                                                                            WHERE    %s.id    IN    %%s' % (fields_str, quoted_table, quoted_table, quoted_table))
    self._cr.execute(query, (self._name, tuple(self.ids)))
    res = self._cr.dictfetchall()
    uids = set((r[k] for r in res for k in ['write_uid', 'create_uid'] if r.get(k)))
    names = dict(self.env['res.users'].browse(uids).name_get())
    for r in res:
        for key in r:
            value = r[key] = (r[key] or False)
            if ((key in ('write_uid', 'create_uid')) and (value in names)):
                r[key] = (value, names[value])
        r['xmlid'] = (('%(module)s.%(name)s' % r) if r['name'] else False)
        del r['name'], r['module']
    return res
