Move plugin for __unported__ dir

This commit is contained in:
Adil Houmadi
2014-07-26 13:57:10 +02:00
parent 13faa4066d
commit a0c192e8e0
12 changed files with 61 additions and 56 deletions

View File

@@ -0,0 +1,7 @@
Authors
=======
Simone Orsi <simone.orsi@domsense.com> [simahawk]
Lorenzo Battistini <lorenzo.battistini@agilebg.com>
Stefan Rijnhart <stefan@therp.nl>
Leonardo Pistone <leonardo.pistone@agilebg.com>

View File

@@ -0,0 +1,21 @@
# -*- 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/>.
#
##############################################################################
import controllers

View File

@@ -0,0 +1,61 @@
# -*- 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/>.
#
##############################################################################
{
'name': 'Export Current View',
'version': '1.1',
'category': 'Web',
'description': """
WEB EXPORT VIEW
===============
One of the best OpenERPs features is exporting custom data to CSV/XLS. You can
do it by clicking on the export link in the sidebar. The export action allows
use to configure what to be exported by selecting fields, etc, and allows you
to save your export as a template so that you can export it once again without
having to configure it again.
That feature is as great and advanced as limited for an everyday experience.
A lot of customers want simply to export the tree view they are looking to.
If you miss this feature as us, probably youll find an answer into our
web_export_view module.
After you installed it, youll find an additional link Export current view
right below the Export one. By clicking on it youll get a XLS file contains
the same data of the tree view you are looking at, headers included.
""",
'author': 'Agile Business Group',
'website': 'http://www.agilebg.com',
'license': 'AGPL-3',
'depends': [
'web',
],
'js': [
'static/src/js/web_advanced_export.js',
],
'qweb': [
'static/src/xml/web_advanced_export.xml',
],
'installable': True,
'auto_install': False,
}

View File

@@ -0,0 +1,55 @@
# -*- 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/>.
#
##############################################################################
try:
import json
except ImportError:
import simplejson as json
import openerp
import openerp.http as http
from openerp.http import request
from openerp.addons.web.controllers.main import ExcelExport
class ExcelExportView(ExcelExport):
_cp_path = '/web/export/xls_view'
def __getattribute__(self, name):
if name == 'fmt':
raise AttributeError()
return super(ExcelExportView, self).__getattribute__(name)
@http.route('/web/export/xls_view', type='json', auth='user')
def index(self, data, token):
data = json.loads(data)
model = data.get('model', [])
columns_headers = data.get('headers', [])
rows = data.get('rows', [])
#
# return req.make_response(
# self.from_data(columns_headers, rows),
# headers=[
# ('Content-Disposition', 'attachment; filename="%s"'
# % self.filename(model)),
# ('Content-Type', self.content_type)
# ],
# cookies={'fileToken': token}
# )

View File

@@ -0,0 +1,44 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-10-21 11:59+0000\n"
"PO-Revision-Date: 2013-12-07 17:21+0000\n"
"Last-Translator: Nicolas JEUDY <njeudy@tuxservices.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2014-06-28 06:02+0000\n"
"X-Generator: Launchpad (build 17077)\n"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/xml/web_advanced_export.xml:7
#, python-format
msgid "Export Current View"
msgstr "Aktuelle Liste exportieren"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/xml/web_advanced_export.xml:9
#, python-format
msgid "Excel"
msgstr "Excel"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:81
#, python-format
msgid "True"
msgstr ""
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84
#, python-format
msgid "False"
msgstr ""

View File

@@ -0,0 +1,46 @@
# Spanish translation for web-addons
# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
# This file is distributed under the same license as the web-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
#
msgid ""
msgstr ""
"Project-Id-Version: web-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2013-10-21 11:59+0000\n"
"PO-Revision-Date: 2014-02-20 23:18+0000\n"
"Last-Translator: Pedro Manuel Baeza <pedro.baeza@gmail.com>\n"
"Language-Team: Spanish <es@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2014-06-28 06:02+0000\n"
"X-Generator: Launchpad (build 17077)\n"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/xml/web_advanced_export.xml:7
#, python-format
msgid "Export Current View"
msgstr "Exportar vista actual"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/xml/web_advanced_export.xml:9
#, python-format
msgid "Excel"
msgstr "Excel"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:81
#, python-format
msgid "True"
msgstr "Verdadero"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84
#, python-format
msgid "False"
msgstr "Falso"

View File

@@ -0,0 +1,44 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-10-21 11:59+0000\n"
"PO-Revision-Date: 2014-03-13 09:06+0000\n"
"Last-Translator: Sylvain LE GAL (GRAP) <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2014-06-28 06:02+0000\n"
"X-Generator: Launchpad (build 17077)\n"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/xml/web_advanced_export.xml:7
#, python-format
msgid "Export Current View"
msgstr "Exporter la vue courante"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/xml/web_advanced_export.xml:9
#, python-format
msgid "Excel"
msgstr "Excel"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:81
#, python-format
msgid "True"
msgstr ""
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84
#, python-format
msgid "False"
msgstr ""

View File

@@ -0,0 +1,46 @@
# Icelandic translation for web-addons
# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
# This file is distributed under the same license as the web-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
#
msgid ""
msgstr ""
"Project-Id-Version: web-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2013-10-21 11:59+0000\n"
"PO-Revision-Date: 2014-04-11 08:56+0000\n"
"Last-Translator: Sveinn í Felli <sv1@fellsnet.is>\n"
"Language-Team: Icelandic <is@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2014-06-28 06:02+0000\n"
"X-Generator: Launchpad (build 17077)\n"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/xml/web_advanced_export.xml:7
#, python-format
msgid "Export Current View"
msgstr "Flytja út núverandi sýn"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/xml/web_advanced_export.xml:9
#, python-format
msgid "Excel"
msgstr "Excel"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:81
#, python-format
msgid "True"
msgstr ""
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84
#, python-format
msgid "False"
msgstr ""

View File

@@ -0,0 +1,44 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-10-21 11:59+0000\n"
"PO-Revision-Date: 2013-12-07 17:21+0000\n"
"Last-Translator: Nicolas JEUDY <njeudy@tuxservices.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2014-06-28 06:02+0000\n"
"X-Generator: Launchpad (build 17077)\n"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/xml/web_advanced_export.xml:7
#, python-format
msgid "Export Current View"
msgstr "Huidige lijst exporteren"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/xml/web_advanced_export.xml:9
#, python-format
msgid "Excel"
msgstr "Excel"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:81
#, python-format
msgid "True"
msgstr ""
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84
#, python-format
msgid "False"
msgstr ""

View File

@@ -0,0 +1,43 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-10-21 11:59+0000\n"
"PO-Revision-Date: 2013-10-21 11:59+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/xml/web_advanced_export.xml:7
#, python-format
msgid "Export Current View"
msgstr ""
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/xml/web_advanced_export.xml:9
#, python-format
msgid "Excel"
msgstr ""
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:81
#, python-format
msgid "True"
msgstr ""
#. module: web_export_view
#. openerp-web
#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84
#, python-format
msgid "False"
msgstr ""

View File

@@ -0,0 +1,114 @@
// @@@ 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/>.
//
//#############################################################################
openerp.web_export_view = function (instance) {
debugger;
var _t = instance.web._t,
QWeb = instance.web.qweb;
instance.web.Sidebar.include({
redraw: function () {
var self = this;
this._super.apply(this, arguments);
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);
},
on_sidebar_export_view_xls: function () {
// Select the first list of the current (form) view
// or assume the main view is a list view and use that
var self = this,
view = this.getParent(),
children = view.getChildren();
if (children) {
children.every(function (child) {
if (child.field && child.field.type == 'one2many') {
view = child.viewmanager.views.list.controller;
return false; // break out of the loop
}
if (child.field && child.field.type == 'many2many') {
view = child.list_view;
return false; // break out of the loop
}
return true;
});
}
export_columns_keys = [];
export_columns_names = [];
$.each(view.visible_columns, function () {
if (this.tag == 'field') {
// non-fields like `_group` or buttons
export_columns_keys.push(this.id);
export_columns_names.push(this.string);
}
});
rows = view.$el.find('.oe_list_content > tbody > tr');
export_rows = [];
$.each(rows, function () {
$row = $(this);
// find only rows with data
if ($row.attr('data-id')) {
export_row = [];
checked = $row.find('th input[type=checkbox]').attr("checked");
if (children && checked === "checked") {
$.each(export_columns_keys, function () {
cell = $row.find('td[data-field="' + this + '"]').get(0);
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")) {
export_row.push(parseInt(text));
}
else {
export_row.push(text.trim());
}
});
export_rows.push(export_row);
}
;
}
});
$.blockUI();
view.session.get_file({
url: '/web/export/xls_view',
data: {data: JSON.stringify({
model: view.model,
headers: export_columns_names,
rows: export_rows,
})},
complete: $.unblockUI
});
},
});
};

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- vim:fdl=1:
-->
<templates id="template" xml:space="preserve">
<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">
<li class="oe_sidebar_export_view_xls"><span>Excel</span></li>
</ul>
</div>
</t>
</templates>