summaryrefslogtreecommitdiff
path: root/addons/web/controllers
diff options
context:
space:
mode:
authorAnh Thao Pham (pta) <pta@odoo.com>2020-05-15 07:28:39 +0000
committerAnh Thao Pham (pta) <pta@odoo.com>2020-05-18 15:35:00 +0000
commitbf6c4e18aeefcd7f2550c0373c7d74901e18a638 (patch)
tree1adeafc245dd784824710cd1d4e06826f4b251d7 /addons/web/controllers
parentd9912d76577976a2b692316fe3984f465595a1e6 (diff)
[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) <nim@odoo.com>
Diffstat (limited to 'addons/web/controllers')
-rw-r--r--addons/web/controllers/main.py2
1 files changed, 2 insertions, 0 deletions
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