From b2a2e11641db049aff4e519777beb378f0607d59 Mon Sep 17 00:00:00 2001 From: KevinKhao Date: Fri, 23 Jul 2021 00:52:35 +0200 Subject: [PATCH] [IMP] Add superuser to running attachment queue --- attachment_queue/models/attachment_queue.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attachment_queue/models/attachment_queue.py b/attachment_queue/models/attachment_queue.py index d379f6b63..b7d279c8c 100644 --- a/attachment_queue/models/attachment_queue.py +++ b/attachment_queue/models/attachment_queue.py @@ -2,7 +2,7 @@ import logging -from odoo import api, fields, models, registry +from odoo import SUPERUSER_ID, api, fields, models, registry _logger = logging.getLogger(__name__) @@ -72,7 +72,7 @@ class AttachmentQueue(models.Model): for attachment in self: with api.Environment.manage(): with registry(self.env.cr.dbname).cursor() as new_cr: - new_env = api.Environment(new_cr, self.env.uid, self.env.context) + new_env = api.Environment(new_cr, SUPERUSER_ID, self.env.context) attach = attachment.with_env(new_env) try: attach._run()