From a4e4079e8dacf5a2af16f7e21522400e45fc90b6 Mon Sep 17 00:00:00 2001 From: Benjamin Willig Date: Thu, 17 May 2018 14:37:54 +0200 Subject: [PATCH] [FIX] web_export_view: Several things: * Retrieve all columns even if they are not sortable. Prevent to get select record column * Prevent to process float time numbers as real numbers during the export --- web_export_view/static/src/js/web_export_view.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/web_export_view/static/src/js/web_export_view.js b/web_export_view/static/src/js/web_export_view.js index 3e49e310..f773491c 100644 --- a/web_export_view/static/src/js/web_export_view.js +++ b/web_export_view/static/src/js/web_export_view.js @@ -42,11 +42,13 @@ odoo.define('web_export_view', function (require) { var export_columns_keys = []; var export_columns_names = []; var column_index = 0; + var column_header_selector; $.each(view.renderer.columns, function () { if (this.tag == 'field' && (this.attrs.widget === undefined || this.attrs.widget != 'handle')) { // non-fields like `_group` or buttons export_columns_keys.push(column_index); - export_columns_names.push(view.$el.find('.o_list_view > thead > tr> th[title]:eq('+column_index+')')[0].textContent); + column_header_selector = '.o_list_view > thead > tr> th:not([class*="o_list_record_selector"]):eq('+column_index+')'; + export_columns_names.push(view.$el.find(column_header_selector)[0].textContent); } column_index ++; }); @@ -69,7 +71,11 @@ odoo.define('web_export_view', function (require) { } else { var text = $cell.text().trim(); - if ($cell.hasClass("o_list_number")) { + var is_number = ( + $cell.hasClass('o_list_number') && + !$cell.hasClass('o_float_time_cell') + ); + if (is_number) { export_row.push(parseFloat( text // Remove thousands separator @@ -80,8 +86,7 @@ odoo.define('web_export_view', function (require) { // Remove non-numeric characters .replace(/[^\d\.-]/g, "") )); - } - else { + } else { export_row.push(text); } }