From bf6c4e18aeefcd7f2550c0373c7d74901e18a638 Mon Sep 17 00:00:00 2001 From: "Anh Thao Pham (pta)" Date: Fri, 15 May 2020 07:28:39 +0000 Subject: [PATCH] [FIX] web: fix array values export - Install Sales and Accounting - Go to Sales > Orders > Quotations - Create a new quotation - Add a product and in Order Line form, select a tax - Save the Order Line - Save the quotation - Go back to quotation list - Select (checkbox) the created quotation - Select "Export" in Action menu - In export wizard, choose "Excel" format and add field "Tax amount by group" - Validate with "EXPORT TO FILE" An error is triggered. The issue comes from the fact that the value of "amount_by_group" is an array of tuples and "xlwt" cannot write that type of value. opw-2255054 closes odoo/odoo#51480 X-original-commit: dde2ca9943362b20853ab11b15fe1504c0b8d848 Signed-off-by: Nicolas Martinelli (nim) --- addons/web/controllers/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 97f1f1a1735..30cca5b9566 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1959,6 +1959,8 @@ class ExcelExport(ExportFormat, http.Controller): with ExportXlsxWriter(fields, len(rows)) as xlsx_writer: for row_index, row in enumerate(rows): for cell_index, cell_value in enumerate(row): + if isinstance(cell_value, (list, tuple)): + cell_value = pycompat.to_text(cell_value) xlsx_writer.write_cell(row_index + 1, cell_index, cell_value) return xlsx_writer.value