Browse Source

[ADD]-web_export_view: Migrate from API8 to API9

pull/461/head
Rodney Vargas 9 years ago
committed by Simone Orsi
parent
commit
aa13a90549
  1. 1
      web_export_view/README.rst
  2. 22
      web_export_view/__init__.py
  3. 25
      web_export_view/__openerp__.py
  4. 22
      web_export_view/controllers/__init__.py
  5. 23
      web_export_view/controllers/controllers.py
  6. 30
      web_export_view/static/src/js/web_export_view.js
  7. 9
      web_export_view/static/src/xml/web_export_view_template.xml
  8. 2
      web_export_view/view/web_export_view.xml

1
web_export_view/README.rst

@ -45,6 +45,7 @@ Contributors
* Lorenzo Battistini <lorenzo.battistini@agilebg.com> * Lorenzo Battistini <lorenzo.battistini@agilebg.com>
* Stefan Rijnhart <stefan@therp.nl> * Stefan Rijnhart <stefan@therp.nl>
* Leonardo Pistone <leonardo.pistone@camptocamp.com> * Leonardo Pistone <leonardo.pistone@camptocamp.com>
* Rodney Vargas <rodney.vargas@clearcorp.cr>
Maintainer Maintainer
---------- ----------

22
web_export_view/__init__.py

@ -1,21 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2016 Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import controllers from . import controllers

25
web_export_view/__openerp__.py

@ -1,27 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2016 Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
'name': 'Export Current View', 'name': 'Export Current View',
'version': '8.0.1.2.0',
'version': '9.0.0.1',
'category': 'Web', 'category': 'Web',
'author': "Agile Business Group,Odoo Community Association (OCA)", 'author': "Agile Business Group,Odoo Community Association (OCA)",
'website': 'http://www.agilebg.com', 'website': 'http://www.agilebg.com',
@ -35,6 +18,6 @@
'qweb': [ 'qweb': [
'static/src/xml/web_export_view_template.xml', 'static/src/xml/web_export_view_template.xml',
], ],
'installable': False,
'installable': True,
'auto_install': False, 'auto_install': False,
} }

22
web_export_view/controllers/__init__.py

@ -1,21 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2016 Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import controllers from . import controllers

23
web_export_view/controllers/controllers.py

@ -1,24 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
# Copyright (C) 2012-2013:
# Agile Business Group sagl (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2016 Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
try: try:
import json import json
except ImportError: except ImportError:

30
web_export_view/static/src/js/web_export_view.js

@ -1,23 +1,7 @@
// @@@ web_export_view custom JS @@@
//#############################################################################
//
// Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
// Copyright (C) 2012 Therp BV (<http://therp.nl>)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//#############################################################################
//# -*- coding: utf-8 -*-
//# © 2016 Agile Business Group
//# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
openerp.web_export_view = function (instance) { openerp.web_export_view = function (instance) {
var _t = instance.web._t, QWeb = instance.web.qweb; var _t = instance.web._t, QWeb = instance.web.qweb;
@ -26,7 +10,7 @@ openerp.web_export_view = function (instance) {
redraw: function () { redraw: function () {
var self = this; var self = this;
this._super.apply(this, arguments); this._super.apply(this, arguments);
if (self.getParent().ViewManager.active_view == 'list') {
if (self.getParent().ViewManager.active_view.type == 'list') {
self.$el.find('.oe_sidebar').append(QWeb.render('AddExportViewMain', {widget: self})); self.$el.find('.oe_sidebar').append(QWeb.render('AddExportViewMain', {widget: self}));
self.$el.find('.oe_sidebar_export_view_xls').on('click', self.on_sidebar_export_view_xls); self.$el.find('.oe_sidebar_export_view_xls').on('click', self.on_sidebar_export_view_xls);
} }
@ -67,8 +51,8 @@ openerp.web_export_view = function (instance) {
// find only rows with data // find only rows with data
if ($row.attr('data-id')) { if ($row.attr('data-id')) {
export_row = []; export_row = [];
checked = $row.find('th input[type=checkbox]').attr("checked");
if (children && checked === "checked") {
checked = $row.find('th input[type=checkbox]').is(':checked');
if (children && checked === true) {
$.each(export_columns_keys, function () { $.each(export_columns_keys, function () {
cell = $row.find('td[data-field="' + this + '"]').get(0); cell = $row.find('td[data-field="' + this + '"]').get(0);
text = cell.text || cell.textContent || cell.innerHTML || ""; text = cell.text || cell.textContent || cell.innerHTML || "";

9
web_export_view/static/src/xml/web_export_view_template.xml

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- -*- coding: utf-8 -*-
© 2016 Agile Business Group
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-->
<templates id="template" xml:space="preserve"> <templates id="template" xml:space="preserve">
<t t-name="AddExportViewMain"> <t t-name="AddExportViewMain">
<div class="oe_form_dropdown_section">
<button class="oe_dropdown_toggle oe_dropdown_arrow">Export Current View</button>
<ul class="oe_dropdown_menu">
<div class="oe_form_dropdown_section btn-group btn-group-sm">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button">Export Current View</button>
<ul class="dropdown-menu" role="menu">
<li class="oe_sidebar_export_view_xls"><span>Excel</span></li> <li class="oe_sidebar_export_view_xls"><span>Excel</span></li>
</ul> </ul>
</div> </div>

2
web_export_view/view/web_export_view.xml

@ -2,7 +2,7 @@
<openerp> <openerp>
<data> <data>
<template id="assets_backend" name="web_export_view assets" inherit_id="web.assets_backend">
<template id="assets_backend" name="web_export_view_assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<script type="text/javascript" src="/web_export_view/static/src/js/web_export_view.js"></script> <script type="text/javascript" src="/web_export_view/static/src/js/web_export_view.js"></script>
</xpath> </xpath>

Loading…
Cancel
Save