[FIX] base: fix batched version of get_metadata
- The batch version of get_metadata won't work correctly for the xmlid
returns due to the limit=1 (cause by
718b0f8b63 ). Fix the
previous issue by reversing the order and without limit.
- The read should be read with the correct user.
closes odoo/odoo#79091
X-original-commit: 29a53f19a7729f486cbc6ff69893b8d150c3512d
Signed-off-by: Rémy Voet <ryv@odoo.com>
This commit is contained in:
+2
-3
@@ -3418,14 +3418,13 @@ Fields:
|
||||
|
||||
IrModelData = self.env['ir.model.data'].sudo()
|
||||
if self._log_access:
|
||||
res = self.sudo().read(LOG_ACCESS_COLUMNS)
|
||||
res = self.read(LOG_ACCESS_COLUMNS)
|
||||
else:
|
||||
res = [{'id': x} for x in self.ids]
|
||||
xml_data = dict((x['res_id'], x) for x in IrModelData.search_read([('model', '=', self._name),
|
||||
('res_id', 'in', self.ids)],
|
||||
['res_id', 'noupdate', 'module', 'name'],
|
||||
order='id',
|
||||
limit=1))
|
||||
order='id DESC'))
|
||||
for r in res:
|
||||
value = xml_data.get(r['id'], {})
|
||||
r['xmlid'] = '%(module)s.%(name)s' % value if value else False
|
||||
|
||||
Reference in New Issue
Block a user