From 26b0b026401d5386afa7b5e2ae135726aabf5cf0 Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Wed, 25 Mar 2026 19:53:27 +0100 Subject: [PATCH] [IMP] lighting_export_xlsx: add progress logging for xlsx writing phase The product generation phase logs progress every 1%, but the xlsx cell writing and attachment public update had no logging. With 36K rows and 344 columns (~12M cells), this phase takes significant time after the 100% generation message, leaving the user with no feedback. Add progress logging for the xlsx writing loop and the attachment public update at the end. --- .../report/export_product_xlsx.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lighting_export_xlsx/report/export_product_xlsx.py b/lighting_export_xlsx/report/export_product_xlsx.py index 54bb414c..ce35b96b 100644 --- a/lighting_export_xlsx/report/export_product_xlsx.py +++ b/lighting_export_xlsx/report/export_product_xlsx.py @@ -86,8 +86,11 @@ def generate_xlsx_report_ctx(self, workbook, data, objects): # noqa: C901 cell_format = self._get_cell_format(workbook, data["lang"]) # write data to xlsx + n = len(objects_ld) + th = int(n / 100) or 1 + _logger.info("Writing %i rows to xlsx..." % n) row = 1 - for obj in objects_ld: + for i, obj in enumerate(objects_ld, 1): col = 0 for _field, meta in header: if not meta["num"] and data.get("hide_empty_fields"): @@ -110,13 +113,22 @@ def generate_xlsx_report_ctx(self, workbook, data, objects): # noqa: C901 sheet.write(row, col, value) col += 1 row += 1 + if (i % th) == 0: + _logger.info( + " - Progress xlsx writing %i%%" % round(i / n * 100) + ) + _logger.info("Xlsx writing completed...") # make exported attachments public (single write at the end to avoid # concurrent access issues during batch processing) if non_public_ids: - self.env["lighting.attachment"].sudo().browse(non_public_ids).write( - {"public": True} + _logger.info( + "Setting %i attachments to public..." % len(non_public_ids) ) + self.env["lighting.attachment"].sudo().browse( + non_public_ids + ).write({"public": True}) + _logger.info("Attachments updated...") def _check_duplicate_labels(self, header, template_id): seen_labels = {}