Browse Source

web_export_view: fix JS selectors for v9

pull/461/head
Simone Orsi 9 years ago
parent
commit
db311ca1fd
  1. 63
      web_export_view/static/src/js/web_export_view.js

63
web_export_view/static/src/js/web_export_view.js

@ -62,45 +62,42 @@ Sidebar.include({
export_columns_names.push(this.string);
}
});
var rows = view.$el.find('.oe_list_content > tbody > tr');
var rows = view.$el.find('.o_list_view > tbody > tr[data-id]');
var export_rows = [];
$.each(rows, function () {
var $row = $(this);
// find only rows with data
if ($row.attr('data-id')) {
var export_row = [];
var checked = $row.find('th input[type=checkbox]').is(':checked');
if (children && checked === true) {
$.each(export_columns_keys, function () {
var cell = $row.find('td[data-field="' + this + '"]').get(0);
var text = cell.text || cell.textContent || cell.innerHTML || "";
if (cell.classList.contains("oe_list_field_float")) {
export_row.push(instance.web.parse_value(text, {'type': "float"}));
}
else if (cell.classList.contains("oe_list_field_boolean")) {
var data_id = $('<div>' + cell.innerHTML + '</div>');
if (data_id.find('input').get(0).checked) {
export_row.push(_t("True"));
}
else {
export_row.push(_t("False"));
}
}
else if (cell.classList.contains("oe_list_field_integer")) {
var tmp2 = text;
do {
tmp = tmp2;
tmp2 = tmp.replace(instance.web._t.database.parameters.thousands_sep, "");
} while (tmp !== tmp2);
export_row.push(parseInt(tmp2));
var export_row = [];
var checked = $row.find('.o_list_record_selector input[type=checkbox]').is(':checked');
if (children && checked === true) {
$.each(export_columns_keys, function () {
var cell = $row.find('td[data-field="' + this + '"]').get(0);
var text = cell.text || cell.textContent || cell.innerHTML || "";
if (cell.classList.contains("oe_list_field_float")) {
export_row.push(instance.web.parse_value(text, {'type': "float"}));
}
else if (cell.classList.contains("oe_list_field_boolean")) {
var data_id = $('<div>' + cell.innerHTML + '</div>');
if (data_id.find('input').get(0).checked) {
export_row.push(_t("True"));
}
else {
export_row.push(text.trim());
export_row.push(_t("False"));
}
});
export_rows.push(export_row);
}
}
else if (cell.classList.contains("oe_list_field_integer")) {
var tmp2 = text;
do {
tmp = tmp2;
tmp2 = tmp.replace(instance.web._t.database.parameters.thousands_sep, "");
} while (tmp !== tmp2);
export_row.push(parseInt(tmp2));
}
else {
export_row.push(text.trim());
}
});
export_rows.push(export_row);
}
});
$.blockUI();

Loading…
Cancel
Save