mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[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
This commit is contained in:
committed by
Pedro M. Baeza
parent
e770e46026
commit
a4e4079e8d
@@ -42,11 +42,13 @@ odoo.define('web_export_view', function (require) {
|
|||||||
var export_columns_keys = [];
|
var export_columns_keys = [];
|
||||||
var export_columns_names = [];
|
var export_columns_names = [];
|
||||||
var column_index = 0;
|
var column_index = 0;
|
||||||
|
var column_header_selector;
|
||||||
$.each(view.renderer.columns, function () {
|
$.each(view.renderer.columns, function () {
|
||||||
if (this.tag == 'field' && (this.attrs.widget === undefined || this.attrs.widget != 'handle')) {
|
if (this.tag == 'field' && (this.attrs.widget === undefined || this.attrs.widget != 'handle')) {
|
||||||
// non-fields like `_group` or buttons
|
// non-fields like `_group` or buttons
|
||||||
export_columns_keys.push(column_index);
|
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 ++;
|
column_index ++;
|
||||||
});
|
});
|
||||||
@@ -69,7 +71,11 @@ odoo.define('web_export_view', function (require) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var text = $cell.text().trim();
|
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(
|
export_row.push(parseFloat(
|
||||||
text
|
text
|
||||||
// Remove thousands separator
|
// Remove thousands separator
|
||||||
@@ -80,8 +86,7 @@ odoo.define('web_export_view', function (require) {
|
|||||||
// Remove non-numeric characters
|
// Remove non-numeric characters
|
||||||
.replace(/[^\d\.-]/g, "")
|
.replace(/[^\d\.-]/g, "")
|
||||||
));
|
));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
export_row.push(text);
|
export_row.push(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user