From ee9d583d1cb5882d7268a4708c721a61c1d7f62c Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Wed, 25 Mar 2026 19:18:50 +0100 Subject: [PATCH] [FIX] lighting_export_xlsx: remove write from export_xlsx on attachments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The public=True write inside export_xlsx causes concurrent access issues in any caller that processes many products, not just the XLSX export. Remove the fallback write entirely — export_xlsx is now purely read-only. The caller is responsible for setting the non_public_attachment_ids context key and doing the write at the end. --- lighting_export_xlsx/models/product_attachment.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lighting_export_xlsx/models/product_attachment.py b/lighting_export_xlsx/models/product_attachment.py index fe788b12..d9905b92 100644 --- a/lighting_export_xlsx/models/product_attachment.py +++ b/lighting_export_xlsx/models/product_attachment.py @@ -17,11 +17,7 @@ def export_xlsx(self, template_id=None): if prod_attachment_ids.mapped("attachment_id"): non_public = prod_attachment_ids.filtered(lambda x: not x.public) if non_public: - ids_list = self.env.context.get("non_public_attachment_ids") - if ids_list is not None: - ids_list.extend(non_public.ids) - else: - non_public.sudo().write({"public": True}) + self.env.context["non_public_attachment_ids"].extend(non_public.ids) for pa in prod_attachment_ids: res.append( OrderedDict(