Browse Source

[MIG] web_export_view: Migration to 11.0

pull/1269/head
JBF91 7 years ago
committed by ernesto
parent
commit
5be4d84cac
  1. 1
      web_export_view/README.rst
  2. 5
      web_export_view/__manifest__.py
  3. 2
      web_export_view/controllers/__init__.py
  4. 1
      web_export_view/controllers/controllers.py
  5. 24
      web_export_view/static/src/js/web_export_view.js

1
web_export_view/README.rst

@ -59,6 +59,7 @@ Contributors
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
* Stefan Rijnhart <stefan@therp.nl>
* Leonardo Pistone <leonardo.pistone@camptocamp.com>
* Jose Maria Bernet <josemaria.bernet@guadaltech.com>
Maintainer
----------

5
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',

2
web_export_view/controllers/__init__.py

@ -1,3 +1 @@
# -*- coding: utf-8 -*-
from . import controllers

1
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

24
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
})},

Loading…
Cancel
Save