From 5a35d6748ae2c197968a950e89f49b3089aab9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Voet=20=28ryv=29?= Date: Thu, 21 Oct 2021 13:56:55 +0000 Subject: [PATCH] [FIX] base: fix batched version of get_metadata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The batch version of get_metadata won't work correctly for the xmlid returns due to the limit=1 (cause by 718b0f8b63261e1312b5626d48de050b21a9dccf ). 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 --- odoo/models.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/odoo/models.py b/odoo/models.py index 29bfea68f5c..289e9daaf68 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -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