diff --git a/web_export_view/README.rst b/web_export_view/README.rst index 4f765987..7bf25d2a 100644 --- a/web_export_view/README.rst +++ b/web_export_view/README.rst @@ -59,6 +59,7 @@ Contributors * Lorenzo Battistini * Stefan Rijnhart * Leonardo Pistone + * Jose Maria Bernet Maintainer ---------- diff --git a/web_export_view/__manifest__.py b/web_export_view/__manifest__.py index 2281d685..a70928b1 100644 --- a/web_export_view/__manifest__.py +++ b/web_export_view/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 Henry Zhou (http://www.maxodoo.com) # Copyright 2016 Rodney (http://clearcorp.cr/) # Copyright 2012 Agile Business Group @@ -8,11 +7,11 @@ { 'name': 'Web Export Current View', - 'version': '10.0.1.0.0', + 'version': '11.0.1.0.0', 'category': 'Web', 'author': 'Henry Zhou, Agile Business Group, \ Odoo Community Association (OCA)', - 'website': 'http://www.agilebg.com', + 'website': 'https://github.com/OCA/web', 'license': 'AGPL-3', 'depends': [ 'web', diff --git a/web_export_view/controllers/__init__.py b/web_export_view/controllers/__init__.py index b0f26a9a..e046e49f 100644 --- a/web_export_view/controllers/__init__.py +++ b/web_export_view/controllers/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import controllers diff --git a/web_export_view/controllers/controllers.py b/web_export_view/controllers/controllers.py index 090a96de..fed05996 100644 --- a/web_export_view/controllers/controllers.py +++ b/web_export_view/controllers/controllers.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 Henry Zhou (http://www.maxodoo.com) # Copyright 2016 Rodney (http://clearcorp.cr/) # Copyright 2012 Agile Business Group 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 3b4fb0bc..3e49e310 100644 --- a/web_export_view/static/src/js/web_export_view.js +++ b/web_export_view/static/src/js/web_export_view.js @@ -3,16 +3,18 @@ odoo.define('web_export_view', function (require) { var core = require('web.core'); var Sidebar = require('web.Sidebar'); + var session = require('web.session'); + var QWeb = core.qweb; var _t = core._t; Sidebar.include({ - redraw: function () { + _redraw: function () { var self = this; this._super.apply(this, arguments); - if (self.getParent().ViewManager.active_view.type == 'list') { + if (self.getParent().renderer.viewType == 'list') { self.$el.find('.o_dropdown').last().append(QWeb.render('WebExportTreeViewXls', {widget: self})); self.$el.find('.export_treeview_xls').on('click', self.on_sidebar_export_treeview_xls); } @@ -39,23 +41,25 @@ odoo.define('web_export_view', function (require) { } var export_columns_keys = []; var export_columns_names = []; - $.each(view.visible_columns, function () { - if (this.tag == 'field' && (this.widget === undefined || this.widget != 'handle')) { + var column_index = 0; + $.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(this.id); - export_columns_names.push(this.string); + 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_index ++; }); var export_rows = []; $.blockUI(); if (children) { // find only rows with data - view.$el.find('.o_list_view > tbody > tr[data-id]:has(.o_list_record_selector input:checkbox:checked)') + view.$el.find('.o_list_view > tbody > tr.o_data_row:has(.o_list_record_selector input:checkbox:checked)') .each(function () { var $row = $(this); var export_row = []; $.each(export_columns_keys, function () { - var $cell = $row.find('td[data-field="' + this + '"]') + var $cell = $row.find('td.o_data_cell:eq('+this+')') var $cellcheckbox = $cell.find('.o_checkbox input:checkbox'); if ($cellcheckbox.length) { export_row.push( @@ -85,10 +89,10 @@ odoo.define('web_export_view', function (require) { export_rows.push(export_row); }); } - view.session.get_file({ + session.get_file({ url: '/web/export/xls_view', data: {data: JSON.stringify({ - model: view.model, + model: view.modelName, headers: export_columns_names, rows: export_rows })},