diff --git a/.travis.yml b/.travis.yml index cbaeef968..7dd62db0d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: required language: python python: diff --git a/__unported__/web_nocreatedb/__openerp__.py b/__unported__/web_nocreatedb/__openerp__.py deleted file mode 100644 index 3594c90d5..000000000 --- a/__unported__/web_nocreatedb/__openerp__.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# Financed and Planified by Vauxoo -# developed by: tulio@vauxoo.com -# - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################################## - -{ - 'name': "NO create database link", - 'author': "Vauxoo,Odoo Community Association (OCA)", - 'category': "Web", - 'website': "http://vauxoo.com", - 'description': """ -After install this module, you will not see anymore the -"Manage Databases" link in login screen. - -See the image bellow: - -.. image:: web_nocreatedb/static/src/img/screen.png - -How to use: - -When you start your server add the name of this module in the "load" option:: - - $./openerp-server --load=web,web_nocreatedb -u all -d database - -Then you can start your server without the -u and -d (just the first time you -need update all to be sure all base and web will be fine). - -With this option you can just take off and restart the server if you need to show -the link temporaly again. - -TODO: It should be great add a parameter in the database to hide it configurable -way and with web_preload: True, but BTW, in old versions of openerp it was a -parameter in the config file, i think as it is is fine for now. - -.. note:: This module probably will not be shown in your module list by default -You should create a menu to see "All modules without filter. - """, - 'version': "1.0", - 'depends': [ - 'web', - ], - 'js': [ - ], - 'css': [ - ], - 'qweb': [ - 'static/src/xml/web_nocreatedb.xml', - ], - 'installable': False, - 'auto_install': False, -} diff --git a/__unported__/web_nocreatedb/static/src/img/screen.png b/__unported__/web_nocreatedb/static/src/img/screen.png deleted file mode 100644 index 48e758713..000000000 Binary files a/__unported__/web_nocreatedb/static/src/img/screen.png and /dev/null differ diff --git a/__unported__/web_nocreatedb/static/src/xml/web_nocreatedb.xml b/__unported__/web_nocreatedb/static/src/xml/web_nocreatedb.xml deleted file mode 100644 index 805aa331c..000000000 --- a/__unported__/web_nocreatedb/static/src/xml/web_nocreatedb.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - diff --git a/help_online/i18n/help_online.pot b/help_online/i18n/help_online.pot new file mode 100644 index 000000000..eb01e7f04 --- /dev/null +++ b/help_online/i18n/help_online.pot @@ -0,0 +1,166 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * help_online +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-04-24 05:56+0000\n" +"PO-Revision-Date: 2015-04-24 05:56+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: help_online +#: view:export.help.wizard:help_online.export_help_wizard_view +#: view:import.help.wizard:help_online.import_help_wizard_view +msgid "Close" +msgstr "" + +#. module: help_online +#: field:export.help.wizard,create_uid:0 +#: field:help.online,create_uid:0 +#: field:import.help.wizard,create_uid:0 +msgid "Created by" +msgstr "" + +#. module: help_online +#: field:export.help.wizard,create_date:0 +#: field:help.online,create_date:0 +#: field:import.help.wizard,create_date:0 +msgid "Created on" +msgstr "" + +#. module: help_online +#: view:export.help.wizard:help_online.export_help_wizard_view +msgid "Export" +msgstr "" + +#. module: help_online +#: model:ir.actions.act_window,name:help_online.action_export_help_wizard +msgid "Export Help" +msgstr "" + +#. module: help_online +#: view:export.help.wizard:help_online.export_help_wizard_view +msgid "Export Help Data" +msgstr "" + +#. module: help_online +#: model:ir.model,name:help_online.model_export_help_wizard +#: model:ir.ui.menu,name:help_online.menu_help_export +msgid "Export Help Online" +msgstr "" + +#. module: help_online +#: field:export.help.wizard,export_filename:0 +msgid "Export XML Filename" +msgstr "" + +#. module: help_online +#: model:ir.ui.menu,name:help_online.menu_help +#: model:ir.ui.menu,name:help_online.menu_help_main +msgid "Help Online" +msgstr "" + +#. module: help_online +#: model:res.groups,name:help_online.help_online_group_reader +msgid "Help reader" +msgstr "" + +#. module: help_online +#: model:res.groups,name:help_online.help_online_group_writer +msgid "Help writer" +msgstr "" + +#. module: help_online +#: field:export.help.wizard,id:0 +#: field:help.online,id:0 +#: field:import.help.wizard,id:0 +msgid "ID" +msgstr "" + +#. module: help_online +#: view:import.help.wizard:help_online.import_help_wizard_view +msgid "Import" +msgstr "" + +#. module: help_online +#: model:ir.actions.act_window,name:help_online.action_import_help_wizard +msgid "Import Help" +msgstr "" + +#. module: help_online +#: view:import.help.wizard:help_online.import_help_wizard_view +msgid "Import Help Data" +msgstr "" + +#. module: help_online +#: model:ir.ui.menu,name:help_online.menu_help_import +msgid "Import Help Online" +msgstr "" + +#. module: help_online +#: field:export.help.wizard,write_uid:0 +#: field:help.online,write_uid:0 +#: field:import.help.wizard,write_uid:0 +msgid "Last Updated by" +msgstr "" + +#. module: help_online +#: field:export.help.wizard,write_date:0 +#: field:help.online,write_date:0 +#: field:import.help.wizard,write_date:0 +msgid "Last Updated on" +msgstr "" + +#. module: help_online +#: field:import.help.wizard,source_file:0 +msgid "Source File" +msgstr "" + +#. module: help_online +#: view:export.help.wizard:help_online.export_help_wizard_view +msgid "This wizard allow you to export all QWeb views\n" +" related to help online. The result will be an Odoo\n" +" data xml file." +msgstr "" + +#. module: help_online +#: view:import.help.wizard:help_online.import_help_wizard_view +msgid "This wizard allow you to import QWeb views\n" +" related to help online. The required file format is an Odoo\n" +" data xml file." +msgstr "" + +#. module: help_online +#: view:ir.ui.view:help_online.view_view_search +msgid "Website Page" +msgstr "" + +#. module: help_online +#: view:ir.ui.view:help_online.view_view_form +msgid "Website Page?" +msgstr "" + +#. module: help_online +#: model:ir.actions.act_window,name:help_online.action_website_pages +#: model:ir.ui.menu,name:help_online.menu_help_pages +msgid "Website Pages" +msgstr "" + +#. module: help_online +#: field:export.help.wizard,data:0 +msgid "XML" +msgstr "" + +#. module: help_online +#: view:export.help.wizard:help_online.export_help_wizard_view +#: view:import.help.wizard:help_online.import_help_wizard_view +msgid "or" +msgstr "" + diff --git a/help_online/i18n/sl.po b/help_online/i18n/sl.po new file mode 100644 index 000000000..4bde976b0 --- /dev/null +++ b/help_online/i18n/sl.po @@ -0,0 +1,179 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * help_online +# +# Matjaž Mozetič , 2015. +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-04-24 05:56+0000\n" +"PO-Revision-Date: 2015-04-24 08:06+0100\n" +"Last-Translator: Matjaž Mozetič \n" +"Language-Team: Slovenian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" +"Language: sl\n" +"X-Generator: Lokalize 2.0\n" + +#. module: help_online +#: view:export.help.wizard:help_online.export_help_wizard_view +#: view:import.help.wizard:help_online.import_help_wizard_view +msgid "Close" +msgstr "Zaključi" + +#. module: help_online +#: field:export.help.wizard,create_uid:0 +#: field:help.online,create_uid:0 +#: field:import.help.wizard,create_uid:0 +msgid "Created by" +msgstr "Ustvaril" + +#. module: help_online +#: field:export.help.wizard,create_date:0 +#: field:help.online,create_date:0 +#: field:import.help.wizard,create_date:0 +msgid "Created on" +msgstr "Ustvarjeno" + +#. module: help_online +#: view:export.help.wizard:help_online.export_help_wizard_view +msgid "Export" +msgstr "Izvoz" + +#. module: help_online +#: model:ir.actions.act_window,name:help_online.action_export_help_wizard +msgid "Export Help" +msgstr "Izvoz navodil" + +#. module: help_online +#: view:export.help.wizard:help_online.export_help_wizard_view +msgid "Export Help Data" +msgstr "Izvoz podatkov spletnih navodil" + +#. module: help_online +#: model:ir.model,name:help_online.model_export_help_wizard +#: model:ir.ui.menu,name:help_online.menu_help_export +msgid "Export Help Online" +msgstr "Izvozi spletna navodila" + +#. module: help_online +#: field:export.help.wizard,export_filename:0 +msgid "Export XML Filename" +msgstr "Naziv izvožene XML datoteke" + +#. module: help_online +#: model:ir.ui.menu,name:help_online.menu_help +#: model:ir.ui.menu,name:help_online.menu_help_main +msgid "Help Online" +msgstr "Spletna navodila" + +#. module: help_online +#: model:res.groups,name:help_online.help_online_group_reader +msgid "Help reader" +msgstr "Bralec navodil" + +#. module: help_online +#: model:res.groups,name:help_online.help_online_group_writer +msgid "Help writer" +msgstr "Avtor navodil" + +#. module: help_online +#: field:export.help.wizard,id:0 +#: field:help.online,id:0 +#: field:import.help.wizard,id:0 +msgid "ID" +msgstr "ID" + +#. module: help_online +#: view:import.help.wizard:help_online.import_help_wizard_view +msgid "Import" +msgstr "Uvoz" + +#. module: help_online +#: model:ir.actions.act_window,name:help_online.action_import_help_wizard +msgid "Import Help" +msgstr "Uvoz navodil" + +#. module: help_online +#: view:import.help.wizard:help_online.import_help_wizard_view +msgid "Import Help Data" +msgstr "Uvoz podatkov navodil" + +#. module: help_online +#: model:ir.ui.menu,name:help_online.menu_help_import +msgid "Import Help Online" +msgstr "Uvoz spletnih navodil" + +#. module: help_online +#: field:export.help.wizard,write_uid:0 +#: field:help.online,write_uid:0 +#: field:import.help.wizard,write_uid:0 +msgid "Last Updated by" +msgstr "Zadnjič posodobil" + +#. module: help_online +#: field:export.help.wizard,write_date:0 +#: field:help.online,write_date:0 +#: field:import.help.wizard,write_date:0 +msgid "Last Updated on" +msgstr "Zadnjič posodobljeno" + +#. module: help_online +#: field:import.help.wizard,source_file:0 +msgid "Source File" +msgstr "Izvorna datoteka" + +#. module: help_online +#: view:export.help.wizard:help_online.export_help_wizard_view +msgid "" +"This wizard allow you to export all QWeb views\n" +" related to help online. The result will be an Odoo\n" +" data xml file." +msgstr "" +"Ta čarovnik omogoča izvoz vseh QWeb pogledov,\n" +" ki se tičejo spletnih navodil v Odoo\n" +" xml podatkovno datoteko." + +#. module: help_online +#: view:import.help.wizard:help_online.import_help_wizard_view +msgid "" +"This wizard allow you to import QWeb views\n" +" related to help online. The required file format is " +"an Odoo\n" +" data xml file." +msgstr "" +"Ta čarovnik omogoča uvoz QWeb pogledov,\n" +" ki se tičejo spletnih navodil iz Odoo\n" +" xml podatkovne datoteke." + +#. module: help_online +#: view:ir.ui.view:help_online.view_view_search +msgid "Website Page" +msgstr "Spletna stran" + +#. module: help_online +#: view:ir.ui.view:help_online.view_view_form +msgid "Website Page?" +msgstr "Spletna stran?" + +#. module: help_online +#: model:ir.actions.act_window,name:help_online.action_website_pages +#: model:ir.ui.menu,name:help_online.menu_help_pages +msgid "Website Pages" +msgstr "Spletne strani" + +#. module: help_online +#: field:export.help.wizard,data:0 +msgid "XML" +msgstr "XML" + +#. module: help_online +#: view:export.help.wizard:help_online.export_help_wizard_view +#: view:import.help.wizard:help_online.import_help_wizard_view +msgid "or" +msgstr "ali" + + diff --git a/web_export_view/AUTHORS.txt b/web_export_view/AUTHORS.txt deleted file mode 100644 index 76bbca72f..000000000 --- a/web_export_view/AUTHORS.txt +++ /dev/null @@ -1,7 +0,0 @@ -Authors -======= - -Simone Orsi [simahawk] -Lorenzo Battistini -Stefan Rijnhart -Leonardo Pistone diff --git a/web_export_view/README.rst b/web_export_view/README.rst new file mode 100644 index 000000000..ab9b4f3c2 --- /dev/null +++ b/web_export_view/README.rst @@ -0,0 +1,50 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License + +Export Current View +=================== + +One of the best OpenERP's 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 +us 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 you'll find an answer into our +web_export_view module. + + +Usage +===== + +After you installed it, you'll find an additional link 'Export current view' +right below the 'Export' one. By clicking on it you'll get a XLS file contains +the same data of the tree view you are looking at, headers included. + + +Credits +======= + +Contributors +------------ + + * Simone Orsi + * Lorenzo Battistini + * Stefan Rijnhart + * Leonardo Pistone + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/web_export_view/__openerp__.py b/web_export_view/__openerp__.py index 8f5738b5a..b08c09a6f 100644 --- a/web_export_view/__openerp__.py +++ b/web_export_view/__openerp__.py @@ -23,26 +23,6 @@ 'name': 'Export Current View', 'version': '1.2', 'category': 'Web', - 'description': """ -WEB EXPORT VIEW -=============== - -One of the best OpenERP’s 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 you’ll find an answer into our -web_export_view module. - -After you installed it, you’ll find an additional link ‘Export current view’ -right below the ‘Export’ one. By clicking on it you’ll get a XLS file contains -the same data of the tree view you are looking at, headers included. -""", 'author': "Agile Business Group,Odoo Community Association (OCA)", 'website': 'http://www.agilebg.com', 'license': 'AGPL-3', diff --git a/web_export_view/i18n/sl.po b/web_export_view/i18n/sl.po new file mode 100644 index 000000000..832cf5b42 --- /dev/null +++ b/web_export_view/i18n/sl.po @@ -0,0 +1,47 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# +# Matjaž Mozetič , 2015. +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: 2015-04-24 08:07+0100\n" +"Last-Translator: Matjaž Mozetič \n" +"Language-Team: Slovenian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" +"Language: sl\n" +"X-Generator: Lokalize 2.0\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 "Izvoz trenutnega pogleda" + +#. 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 "Pravilno" + +#. module: web_export_view +#. openerp-web +#: code:addons/web_export_view/static/src/js/web_advanced_export.js:84 +#, python-format +msgid "False" +msgstr "Nepravilno" + diff --git a/web_export_view/static/description/icon.png b/web_export_view/static/description/icon.png new file mode 100644 index 000000000..1b1b0d1e3 Binary files /dev/null and b/web_export_view/static/description/icon.png differ 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 df4419de2..00cb047e4 100644 --- a/web_export_view/static/src/js/web_export_view.js +++ b/web_export_view/static/src/js/web_export_view.js @@ -85,7 +85,13 @@ openerp.web_export_view = function (instance) { } } else if (cell.classList.contains("oe_list_field_integer")) { - export_row.push(parseInt(text)); + 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()); diff --git a/web_hide_db_manager_link/README.rst b/web_hide_db_manager_link/README.rst new file mode 100644 index 000000000..d8aebd806 --- /dev/null +++ b/web_hide_db_manager_link/README.rst @@ -0,0 +1,46 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License + +Hide link to database manager in login screen +============================================= + +This module hides the "Manage Databases" link at the bottom of login screen. + +The image in *web_hide_db_manager_link/static/src/img/screen.png* shows the resulting loging screen. + +.. image:: web_hide_db_manager_link/static/src/img/screenshot.png + +Installation +============ + +To install this module, you need to: + + * Go to Settings / Local Modules + * Search by module name "Hide link to database manager in login screen" or by module technical name "*web_hide_db_manager_link*" + * Click install button + +Known issues +============ + +As Odoo v8 templates only live in the database, this module must be installed in each database you want this to be in effect. + +Credits +======= + +Contributors +------------ + +* Alejandro Santana + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/__unported__/web_nocreatedb/__init__.py b/web_hide_db_manager_link/__init__.py similarity index 100% rename from __unported__/web_nocreatedb/__init__.py rename to web_hide_db_manager_link/__init__.py diff --git a/web_hide_db_manager_link/__openerp__.py b/web_hide_db_manager_link/__openerp__.py new file mode 100644 index 000000000..70537fc0e --- /dev/null +++ b/web_hide_db_manager_link/__openerp__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Odoo, Open Source Management Solution +# +# Copyright (c) All rights reserved: +# (c) 2015 Anubía, soluciones en la nube,SL (http://www.anubia.es) +# Alejandro Santana +# +# 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': 'Hide link to database manager in login screen', + 'version': "1.0", + 'category': 'Web', + 'license': 'AGPL-3', + 'author': 'Alejandro Santana, Odoo Community Association (OCA)', + 'website': 'http://anubia.es', + 'summary': 'Hide link to database manager in login screen', + 'depends': ['web'], + 'data': ['views/webclient_templates.xml'], + 'installable': True, +} diff --git a/web_hide_db_manager_link/static/description/icon.png b/web_hide_db_manager_link/static/description/icon.png new file mode 100644 index 000000000..4891d91a0 Binary files /dev/null and b/web_hide_db_manager_link/static/description/icon.png differ diff --git a/web_hide_db_manager_link/static/description/icon.svg b/web_hide_db_manager_link/static/description/icon.svg new file mode 100644 index 000000000..eac5a4836 --- /dev/null +++ b/web_hide_db_manager_link/static/description/icon.svg @@ -0,0 +1,128 @@ + +image/svg+xml \ No newline at end of file diff --git a/web_hide_db_manager_link/static/src/img/screenshot.png b/web_hide_db_manager_link/static/src/img/screenshot.png new file mode 100644 index 000000000..1bf96f9e2 Binary files /dev/null and b/web_hide_db_manager_link/static/src/img/screenshot.png differ diff --git a/web_hide_db_manager_link/views/webclient_templates.xml b/web_hide_db_manager_link/views/webclient_templates.xml new file mode 100644 index 000000000..de635c311 --- /dev/null +++ b/web_hide_db_manager_link/views/webclient_templates.xml @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/web_ir_actions_act_window_message/README.rst b/web_ir_actions_act_window_message/README.rst new file mode 100644 index 000000000..c68947125 --- /dev/null +++ b/web_ir_actions_act_window_message/README.rst @@ -0,0 +1,48 @@ +Client side message boxes +========================= + +This module allows to show a message popup on the client side as result of a button. + +Usage +===== + +Depend on this module and return + +.. code:: python + + { + 'type': 'ir.actions.act_window.message', + 'title': _('My title'), + 'message': _('My message'), + } + +You are responsible for translating the messages. + +Known issues / Roadmap +====================== + +* add `message_type` to differenciate between warnings, errors, etc. +* have one `message_type` to show a nonmodal warning on top right +* have `button_title` to set the button title +* have `buttons` containing button names and action definitions for triggering actions from the message box + +Credits +======= + +Contributors +------------ + +* Holger Brunn + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/web_ir_actions_act_window_message/__init__.py b/web_ir_actions_act_window_message/__init__.py new file mode 100644 index 000000000..faef9dac0 --- /dev/null +++ b/web_ir_actions_act_window_message/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2015 Therp BV . +# +# 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 . +# +############################################################################## diff --git a/web_ir_actions_act_window_message/__openerp__.py b/web_ir_actions_act_window_message/__openerp__.py new file mode 100644 index 000000000..7cd5baaed --- /dev/null +++ b/web_ir_actions_act_window_message/__openerp__.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2015 Therp BV . +# +# 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 . +# +############################################################################## +{ + "name": "Client side message boxes", + "version": "1.0", + "author": "Therp BV", + "license": "AGPL-3", + "category": "Hidden/Dependency", + "summary": "Show a message box to users", + "depends": [ + 'web', + ], + "data": [ + 'views/templates.xml', + ], + "qweb": [ + 'static/src/xml/web_ir_actions_act_window_message.xml', + ], + "auto_install": False, + "installable": True, + "application": False, + "external_dependencies": { + 'python': [], + }, +} diff --git a/web_ir_actions_act_window_message/static/description/icon.png b/web_ir_actions_act_window_message/static/description/icon.png new file mode 100644 index 000000000..989658727 Binary files /dev/null and b/web_ir_actions_act_window_message/static/description/icon.png differ diff --git a/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js b/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js new file mode 100644 index 000000000..bfc6f55da --- /dev/null +++ b/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js @@ -0,0 +1,50 @@ +//-*- coding: utf-8 -*- +//############################################################################ +// +// OpenERP, Open Source Management Solution +// This module copyright (C) 2015 Therp BV . +// +// 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 . +// +//############################################################################ + +openerp.web_ir_actions_act_window_message = function(instance) +{ + instance.web.ActionManager.include({ + ir_actions_act_window_message: function(action, options) + { + var dialog = new instance.web.Dialog( + this, + { + size: 'medium', + title: action.title, + buttons: [ + { + text: instance.web._t('Close'), + click: function() { dialog.close() }, + oe_link_class: 'oe_highlight', + }, + ], + }, + jQuery(instance.web.qweb.render( + 'web_ir_actions_act_window_message', + { + 'this': this, + 'action': action, + })) + ) + return dialog.open(); + }, + }); +} diff --git a/web_ir_actions_act_window_message/static/src/xml/web_ir_actions_act_window_message.xml b/web_ir_actions_act_window_message/static/src/xml/web_ir_actions_act_window_message.xml new file mode 100644 index 000000000..5f0742294 --- /dev/null +++ b/web_ir_actions_act_window_message/static/src/xml/web_ir_actions_act_window_message.xml @@ -0,0 +1,5 @@ + +
+
+
+
diff --git a/web_ir_actions_act_window_message/views/templates.xml b/web_ir_actions_act_window_message/views/templates.xml new file mode 100644 index 000000000..9ba42b0b2 --- /dev/null +++ b/web_ir_actions_act_window_message/views/templates.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/web_option_auto_color/README.rst b/web_option_auto_color/README.rst new file mode 100644 index 000000000..bb95448f4 --- /dev/null +++ b/web_option_auto_color/README.rst @@ -0,0 +1,54 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License + +Web Option Auto Color +===================== + +This module was written to offer a new autocolor attribute which can be used on +field in trees view. Using this attribute causes an identical coloration for +cells of the same value in a list view. + +Installation +============ + +To install this module, you need to: + + * Click on install button + + Usage + ===== + + In the view declaration, put autocolor="1" attribute in the field tag:: + + ... + + + ... + + + ... + + + ... + +Credits +======= + +Contributors +------------ + +* Stéphane Bidoul (ACSONE) +* Adrien Peiffer (ACSONE) + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. \ No newline at end of file diff --git a/web_option_auto_color/__init__.py b/web_option_auto_color/__init__.py new file mode 100644 index 000000000..40a96afc6 --- /dev/null +++ b/web_option_auto_color/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/web_option_auto_color/__openerp__.py b/web_option_auto_color/__openerp__.py new file mode 100644 index 000000000..719c3a396 --- /dev/null +++ b/web_option_auto_color/__openerp__.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# This file is part of web_option_auto_color, +# an Odoo module. +# +# Copyright (c) 2015 ACSONE SA/NV () +# +# web_option_auto_color 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. +# +# web_option_auto_color 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 web_option_auto_color. +# If not, see . +# +############################################################################## +{ + 'name': "Web Option Auto Color", + 'author': "ACSONE SA/NV,Odoo Community Association (OCA)", + 'website': "http://acsone.eu", + 'category': 'web', + 'version': '0.1', + 'license': 'AGPL-3', + 'depends': [ + 'web', + ], + 'data': [ + 'views/web_option_auto_color.xml', + ], + 'qweb': [ + 'static/src/xml/templates.xml', + ], +} diff --git a/web_option_auto_color/static/src/js/view_list.js b/web_option_auto_color/static/src/js/view_list.js new file mode 100644 index 000000000..1cc6b1e33 --- /dev/null +++ b/web_option_auto_color/static/src/js/view_list.js @@ -0,0 +1,57 @@ +openerp.web_option_auto_color = function(instance) { + var _t = instance.web._t, + _lt = instance.web._lt; + var QWeb = instance.web.qweb; + + instance.web.ListView.include({ + + dh : function (n){ + var hex = (255-n).toString(16).toUpperCase(); + if (hex.length==1) { + hex='0'+hex; + } + return (hex); + }, + + inverse_color: function (couleur) { + + var r = /#?(\w{2})(\w{2})(\w{2})/i; + var splitH = r.exec(couleur); + + var ar=16*Number('0x'+splitH[1].slice(0,1))+Number('0x'+splitH[1].slice(1,2)); + var br=16*Number('0x'+splitH[2].slice(0,1))+Number('0x'+splitH[2].slice(1,2)); + var cr=16*Number('0x'+splitH[3].slice(0,1))+Number('0x'+splitH[3].slice(1,2)); + + return ('#'+this.dh(ar)+this.dh(br)+this.dh(cr)); + + }, + + get_seed_random_color: function(seed){ + color = Math.floor((Math.abs(Math.sin(seed) * 16777215)) % 16777215); + color = color.toString(16); + while(color.length < 6) { + color = '0' + color; + } + return '#' + color; + }, + + getIntValue: function(str){ + var sum = 0 + for (i=0; i + + + + this.attr('t-att-style', "column.autocolor == '1' and view.auto_color_cell_style(render_cell(record, column), column)") + + + diff --git a/web_option_auto_color/views/web_option_auto_color.xml b/web_option_auto_color/views/web_option_auto_color.xml new file mode 100644 index 000000000..a417cc818 --- /dev/null +++ b/web_option_auto_color/views/web_option_auto_color.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/web_searchbar_full_width/README.rst b/web_searchbar_full_width/README.rst new file mode 100644 index 000000000..56dd90db3 --- /dev/null +++ b/web_searchbar_full_width/README.rst @@ -0,0 +1,30 @@ +Show searchbar over full width +============================== + +Odoo's default search bar is rather narrow, which causes it to grow vertically when applying a lot of filters. For small screens this can be a problem as it wastes a lot of space. This addon addresses this issue by growing the search bar to the whole width of the screen, moving it below the breadcrumb. A side effect of this is that the breadcrumb can also use the full screen width, which makes it reasonable not to cut off titles after 7 characters. + +The result looks like this: + +.. image:: /web_searchbar_full_width/static/description/preview.png + :alt: Searchbar over full screen width + +Credits +======= + +Contributors +------------ + +* Holger Brunn + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/web_searchbar_full_width/__init__.py b/web_searchbar_full_width/__init__.py new file mode 100644 index 000000000..faef9dac0 --- /dev/null +++ b/web_searchbar_full_width/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2015 Therp BV . +# +# 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 . +# +############################################################################## diff --git a/web_searchbar_full_width/__openerp__.py b/web_searchbar_full_width/__openerp__.py new file mode 100644 index 000000000..7a8cbc47c --- /dev/null +++ b/web_searchbar_full_width/__openerp__.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2015 Therp BV . +# +# 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 . +# +############################################################################## +{ + "name": "Full width searchbar", + "version": "1.0", + "author": "Therp BV", + "license": "AGPL-3", + "category": "Tools", + "summary": "Show search bar in full screen width", + "depends": [ + 'web', + ], + "data": [ + 'views/templates.xml', + ], + "qweb": [ + 'static/src/xml/web_searchbar_full_width.xml', + ], + "test": [ + ], + "auto_install": False, + "installable": True, + "application": False, + "external_dependencies": { + 'python': [], + }, +} diff --git a/web_searchbar_full_width/static/description/icon.png b/web_searchbar_full_width/static/description/icon.png new file mode 100644 index 000000000..80100ac65 Binary files /dev/null and b/web_searchbar_full_width/static/description/icon.png differ diff --git a/web_searchbar_full_width/static/description/preview.png b/web_searchbar_full_width/static/description/preview.png new file mode 100644 index 000000000..51be22037 Binary files /dev/null and b/web_searchbar_full_width/static/description/preview.png differ diff --git a/web_searchbar_full_width/static/src/css/web_searchbar_full_width.css b/web_searchbar_full_width/static/src/css/web_searchbar_full_width.css new file mode 100644 index 000000000..160ecbf74 --- /dev/null +++ b/web_searchbar_full_width/static/src/css/web_searchbar_full_width.css @@ -0,0 +1,20 @@ +.openerp .oe_application .oe_breadcrumb_item:not(:last-child) +{ + max-width: inherit; +} +.openerp .oe_searchview +{ + width: 100%; +} +.openerp .oe_view_manager_current > .oe_view_manager_header .oe_header_row_top td +{ + padding-bottom: 0px; +} +.openerp .oe_view_manager_current > .oe_view_manager_header span.oe_breadcrumb_item +{ + padding-top: 3px; +} +.openerp .oe_view_manager table.oe_view_manager_header h2 +{ + line-height: 20px; +} diff --git a/web_searchbar_full_width/static/src/xml/web_searchbar_full_width.xml b/web_searchbar_full_width/static/src/xml/web_searchbar_full_width.xml new file mode 100644 index 000000000..8a2c3d70c --- /dev/null +++ b/web_searchbar_full_width/static/src/xml/web_searchbar_full_width.xml @@ -0,0 +1,15 @@ + + + + + jQuery(this).attr('colspan', 4); + + + var $new_row = jQuery(''); + jQuery(this) + .parents('tr') + .after($new_row); + $new_row.append(jQuery(this).attr('colspan', 4)); + + + diff --git a/web_searchbar_full_width/views/templates.xml b/web_searchbar_full_width/views/templates.xml new file mode 100644 index 000000000..013cffa74 --- /dev/null +++ b/web_searchbar_full_width/views/templates.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js b/web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js index e05f226ab..fef506470 100644 --- a/web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js +++ b/web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js @@ -47,7 +47,9 @@ openerp.web_tree_many2one_clickable = function(instance, local) .filter([['key', '=', 'web_tree_many2one_clickable.default']]) .first() .then(function(param) { - self.use_many2one_clickable = (param.value == 'true'); + if (param) { + self.use_many2one_clickable = (param.value == 'true'); + } self.ir_option_clickable_loaded.resolve(); }); return this.ir_option_clickable_loaded; diff --git a/web_widget_many2many_tags_multi_selection/README.rst b/web_widget_many2many_tags_multi_selection/README.rst new file mode 100644 index 000000000..4d2b3ea34 --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/README.rst @@ -0,0 +1,35 @@ +Allows multiple selection on many2many_tags widget +================================================== + +In a many2many_tags widget when a lot of entries should be selected it's fastidious to select 80% of them. Then you may click on 'search more', but impossible to select several attributes at once. + +This module adds a checkbox to this list so multiple entries can be selected at once. + +Installation +============ + +It was tested on Odoo 8.0 branch. + +Credits +======= + +Akretion + +Contributors +------------ + +* Sylvain Calador + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. + diff --git a/web_widget_many2many_tags_multi_selection/__init__.py b/web_widget_many2many_tags_multi_selection/__init__.py new file mode 100644 index 000000000..56bc1ffd6 --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2015-TODAY Akretion (). +# +# 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 . +# +############################################################################## diff --git a/web_widget_many2many_tags_multi_selection/__openerp__.py b/web_widget_many2many_tags_multi_selection/__openerp__.py new file mode 100644 index 000000000..4bf59acd8 --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/__openerp__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2015-TODAY Akretion (). +# +# 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 . +# +############################################################################## + +{ + 'name': 'Tags multiple selection', + 'version': '0.1', + 'author': 'Akretion, Odoo Community Association (OCA)', + 'depends': [ + 'web', + ], + 'demo': [], + 'website': 'https://www.akretion.com', + 'data': [ + 'views/web_widget_many2many_tags_multi_selection.xml', + ], + 'installable': True, + 'auto_install': False, +} diff --git a/web_widget_many2many_tags_multi_selection/static/src/js/view_form.js b/web_widget_many2many_tags_multi_selection/static/src/js/view_form.js new file mode 100644 index 000000000..1d073fe6b --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/static/src/js/view_form.js @@ -0,0 +1,38 @@ +openerp.web_widget_many2many_tags_multi_selection = function(instance, local) { + + var _t = instance.web._t; + + instance.web.form.CompletionFieldMixin._search_create_popup = function(view, ids, context) { + var self = this; + var pop = new instance.web.form.SelectCreatePopup(this); + var domain = self.build_domain(); + + if (self.field.type == 'many2many') { + var selected_ids = self.get_search_blacklist(); + if (selected_ids.length > 0) { + domain = new instance.web.CompoundDomain(domain, ["!", ["id", "in", selected_ids]]); + } + } + + pop.select_element( + self.field.relation, + { + title: (view === 'search' ? _t("Search: ") : _t("Create: ")) + this.string, + initial_ids: ids ? _.map(ids, function(x) {return x[0];}) : undefined, + initial_view: view, + disable_multiple_selection: this.field.type != 'many2many', + }, + domain, + new instance.web.CompoundContext(self.build_context(), context || {}) + ); + pop.on("elements_selected", self, function(element_ids) { + for(var i=0, len=element_ids.length; i + + + + + diff --git a/web_widget_x2many_2d_matrix/README.rst b/web_widget_x2many_2d_matrix/README.rst new file mode 100644 index 000000000..0b145aaf6 --- /dev/null +++ b/web_widget_x2many_2d_matrix/README.rst @@ -0,0 +1,78 @@ +2D matrix for x2many fields +=========================== + +This module allows to show an x2many field with 3-tuples +($x_value, $y_value, $value) in a table + + $x_value1 $x_value2 +========= =========== =========== +$y_value1 $value(1/1) $value(2/1) +$y_value2 $value(1/2) $value(2/2) +========= =========== =========== + +where `value(n/n)` is editable. + +An example use case would be: Select some projects and some employees so that +a manager can easily fill in the planned_hours for one task per employee. The +result could look like this: + +.. image:: /web_widget_x2many_2d_matrix/static/description/screenshot.png + :alt: Screenshot + +The beauty of this is that you have an arbitrary amount of columns with this widget, trying to get this in standard x2many lists involves some quite agly hacks. + +Usage +===== + +Use this widget by saying:: + + + +This assumes that my_field refers to a model with the fields `x`, `y` and +`value`. If your fields are named differently, pass the correct names as +attributes:: + + + +You can pass the following parameters: + +field_x_axis + The field that indicates the x value of a point +field_y_axis + The field that indicates the y value of a point +field_label_x_axis + Use another field to display in the table header +field_label_y_axis + Use another field to display in the table header +field_value + Show this field as value +show_row_totals + If field_value is a numeric field, calculate row totals +show_column_totals + If field_value is a numeric field, calculate column totals + +Known issues / Roadmap +====================== + +* it would be worth trying to instantiate the proper field widget and let it render the input + +Credits +======= + +Contributors +------------ + +* Holger Brunn + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/web_widget_x2many_2d_matrix/__init__.py b/web_widget_x2many_2d_matrix/__init__.py new file mode 100644 index 000000000..faef9dac0 --- /dev/null +++ b/web_widget_x2many_2d_matrix/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2015 Therp BV . +# +# 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 . +# +############################################################################## diff --git a/web_widget_x2many_2d_matrix/__openerp__.py b/web_widget_x2many_2d_matrix/__openerp__.py new file mode 100644 index 000000000..1cbc4aad7 --- /dev/null +++ b/web_widget_x2many_2d_matrix/__openerp__.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2015 Therp BV . +# +# 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 . +# +############################################################################## +{ + "name": "2D matrix for x2many fields", + "version": "1.0", + "author": "Therp BV", + "license": "AGPL-3", + "category": "Hidden/Dependency", + "summary": "Show list fields as a matrix", + "depends": [ + 'web', + ], + "data": [ + 'views/templates.xml', + ], + "qweb": [ + 'static/src/xml/web_widget_x2many_2d_matrix.xml', + ], + "test": [ + ], + "auto_install": False, + "installable": True, + "application": False, + "external_dependencies": { + 'python': [], + }, +} diff --git a/web_widget_x2many_2d_matrix/static/description/icon.png b/web_widget_x2many_2d_matrix/static/description/icon.png new file mode 100644 index 000000000..d7cdcec3b Binary files /dev/null and b/web_widget_x2many_2d_matrix/static/description/icon.png differ diff --git a/web_widget_x2many_2d_matrix/static/description/screenshot.png b/web_widget_x2many_2d_matrix/static/description/screenshot.png new file mode 100644 index 000000000..47c2a40d6 Binary files /dev/null and b/web_widget_x2many_2d_matrix/static/description/screenshot.png differ diff --git a/web_widget_x2many_2d_matrix/static/src/css/web_widget_x2many_2d_matrix.css b/web_widget_x2many_2d_matrix/static/src/css/web_widget_x2many_2d_matrix.css new file mode 100644 index 000000000..d33d4f21b --- /dev/null +++ b/web_widget_x2many_2d_matrix/static/src/css/web_widget_x2many_2d_matrix.css @@ -0,0 +1,8 @@ +.oe_form_field_x2many_2d_matrix th.oe_link +{ + cursor: pointer; +} +.openerp .oe_form_field_x2many_2d_matrix .oe_list_content > tbody > tr > td.oe_list_field_cell +{ + white-space: normal; +} diff --git a/web_widget_x2many_2d_matrix/static/src/js/web_widget_x2many_2d_matrix.js b/web_widget_x2many_2d_matrix/static/src/js/web_widget_x2many_2d_matrix.js new file mode 100644 index 000000000..5d4ce7854 --- /dev/null +++ b/web_widget_x2many_2d_matrix/static/src/js/web_widget_x2many_2d_matrix.js @@ -0,0 +1,380 @@ +//-*- coding: utf-8 -*- +//############################################################################ +// +// OpenERP, Open Source Management Solution +// This module copyright (C) 2015 Therp BV . +// +// 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 . +// +//############################################################################ + +openerp.web_widget_x2many_2d_matrix = function(instance) +{ + instance.web.form.widgets.add( + 'x2many_2d_matrix', + 'instance.web_widget_x2many_2d_matrix.FieldX2Many2dMatrix'); + instance.web_widget_x2many_2d_matrix.FieldX2Many2dMatrix = instance.web.form.FieldOne2Many.extend({ + template: 'FieldX2Many2dMatrix', + widget_class: 'oe_form_field_x2many_2d_matrix', + + // those will be filled with rows from the dataset + by_x_axis: {}, + by_y_axis: {}, + field_x_axis: 'x', + field_label_x_axis: 'x', + field_y_axis: 'y', + field_label_y_axis: 'y', + field_value: 'value', + // information about our datatype + is_numeric: false, + show_row_totals: true, + show_column_totals: true, + // this will be filled with the model's fields_get + fields: {}, + + // read parameters + init: function(field_manager, node) + { + this.field_x_axis = node.attrs.field_x_axis || this.field_x_axis; + this.field_y_axis = node.attrs.field_y_axis || this.field_y_axis; + this.field_label_x_axis = node.attrs.field_label_x_axis || this.field_x_axis; + this.field_label_y_axis = node.attrs.field_label_y_axis || this.field_y_axis; + this.field_value = node.attrs.field_value || this.field_value; + this.show_row_totals = node.attrs.show_row_totals || this.show_row_totals; + this.show_column_totals = node.attrs.show_column_totals || this.show_column_totals; + return this._super.apply(this, arguments); + }, + + // return a field's value, id in case it's a one2many field + get_field_value: function(row, field, many2one_as_name) + { + if(this.fields[field].type == 'many2one' && _.isArray(row[field])) + { + if(many2one_as_name) + { + return row[field][1]; + } + else + { + return row[field][0]; + } + } + return row[field]; + }, + + // setup our datastructure for simple access in the template + set_value: function() + { + var self = this, + result = this._super.apply(this, arguments); + + self.by_x_axis = {}; + self.by_y_axis = {}; + + return jQuery.when(result).then(function() + { + return self.dataset._model.call('fields_get').then(function(fields) + { + self.fields = fields; + self.is_numeric = fields[self.field_value].type == 'float'; + self.show_row_totals &= self.is_numeric; + self.show_column_totals &= self.is_numeric; + }).then(function() + { + return self.dataset.read_ids(self.dataset.ids).then(function(rows) + { + var read_many2one = {}, + many2one_fields = [ + self.field_x_axis, self.field_y_axis, + self.field_label_x_axis, self.field_label_y_axis + ]; + // prepare to read many2one names if necessary (we can get (id, name) or just id as value) + _.each(many2one_fields, function(field) + { + if(self.fields[field].type == 'many2one') + { + read_many2one[field] = {}; + } + }); + // setup data structure + _.each(rows, function(row) + { + self.add_xy_row(row); + _.each(read_many2one, function(rows, field) + { + if(!_.isArray(row[field])) + { + rows[row[field]] = rows[row[field]] || [] + rows[row[field]].push(row); + } + }); + }); + // read many2one fields if necessary + var deferrends = []; + _.each(read_many2one, function(rows, field) + { + if(_.isEmpty(rows)) + { + return; + } + var model = new instance.web.Model(self.fields[field].relation); + deferrends.push(model.call( + 'name_get', + [_.map(_.keys(rows), function(key) {return parseInt(key)})]) + .then(function(names) + { + _.each(names, function(name) + { + _.each(rows[name[0]], function(row) + { + row[field] = name; + }); + }); + })); + }) + if(self.is_started && !self.no_rerender) + { + self.renderElement(); + self.compute_totals(); + self.setup_many2one_axes(); + self.$el.find('.edit').on( + 'change', self.proxy(self.xy_value_change)); + self.effective_readonly_change(); + } + return jQuery.when.apply(jQuery, deferrends); + }); + }); + }); + }, + + // to whatever needed to setup internal data structure + add_xy_row: function(row) + { + var x = this.get_field_value(row, this.field_x_axis), + y = this.get_field_value(row, this.field_y_axis); + this.by_x_axis[x] = this.by_x_axis[x] || {}; + this.by_y_axis[y] = this.by_y_axis[y] || {}; + this.by_x_axis[x][y] = row; + this.by_y_axis[y][x] = row; + }, + + // get x axis values in the correct order + get_x_axis_values: function() + { + return _.keys(this.by_x_axis); + }, + + // get y axis values in the correct order + get_y_axis_values: function() + { + return _.keys(this.by_y_axis); + }, + + // get the label for a value on the x axis + get_x_axis_label: function(x) + { + return this.get_field_value( + _.first(_.values(this.by_x_axis[x])), + this.field_label_x_axis, true); + }, + + // get the label for a value on the y axis + get_y_axis_label: function(y) + { + return this.get_field_value( + _.first(_.values(this.by_y_axis[y])), + this.field_label_y_axis, true); + }, + + // return the class(es) the inputs should have + get_xy_value_class: function() + { + var classes = 'oe_form_field oe_form_required'; + if(this.is_numeric) + { + classes += ' oe_form_field_float'; + } + return classes; + }, + + // return row id of a coordinate + get_xy_id: function(x, y) + { + return this.by_x_axis[x][y]['id']; + }, + + // return the value of a coordinate + get_xy_value: function(x, y) + { + return this.get_field_value( + this.by_x_axis[x][y], this.field_value); + }, + + // validate a value + validate_xy_value: function(val) + { + try + { + this.parse_xy_value(val); + } + catch(e) + { + return false; + } + return true; + }, + + // parse a value from user input + parse_xy_value: function(val) + { + return instance.web.parse_value( + val, {'type': this.fields[this.field_value].type}); + }, + + // format a value from the database for display + format_xy_value: function(val) + { + return instance.web.format_value( + val, {'type': this.fields[this.field_value].type}); + }, + + // compute totals + compute_totals: function() + { + var self = this, + grand_total = 0, + totals_x = {}, + totals_y = {}; + return self.dataset.read_ids(self.dataset.ids).then(function(rows) + { + _.each(rows, function(row) + { + var key_x = self.get_field_value(row, self.field_x_axis), + key_y = self.get_field_value(row, self.field_y_axis); + totals_x[key_x] = (totals_x[key_x] || 0) + self.get_field_value(row, self.field_value); + totals_y[key_y] = (totals_y[key_y] || 0) + self.get_field_value(row, self.field_value); + grand_total += self.get_field_value(row, self.field_value); + }); + }).then(function() + { + _.each(totals_y, function(total, y) + { + self.$el.find( + _.str.sprintf('td.row_total[data-y="%s"]', y)).text( + self.format_xy_value(total)); + }); + _.each(totals_x, function(total, x) + { + self.$el.find( + _.str.sprintf('td.column_total[data-x="%s"]', x)).text( + self.format_xy_value(total)); + }); + self.$el.find('.grand_total').text( + self.format_xy_value(grand_total)) + return { + totals_x: totals_x, + totals_y: totals_y, + grand_total: grand_total, + }; + }); + }, + + setup_many2one_axes: function() + { + if(this.fields[this.field_x_axis].type == 'many2one') + { + this.$el.find('th[data-x]').addClass('oe_link') + .click(_.partial( + this.proxy(this.many2one_axis_click), + this.field_x_axis, 'x')); + } + if(this.fields[this.field_y_axis].type == 'many2one') + { + this.$el.find('tr[data-y] th').addClass('oe_link') + .click(_.partial( + this.proxy(this.many2one_axis_click), + this.field_y_axis, 'y')); + } + }, + + many2one_axis_click: function(field, id_attribute, e) + { + this.do_action({ + type: 'ir.actions.act_window', + name: this.fields[field].string, + res_model: this.fields[field].relation, + res_id: jQuery(e.currentTarget).data(id_attribute), + views: [[false, 'form']], + target: 'current', + }) + }, + + start: function() + { + var self = this; + this.$el.find('.edit').on( + 'change', self.proxy(this.xy_value_change)); + this.compute_totals(); + this.setup_many2one_axes(); + this.on("change:effective_readonly", + this, this.proxy(this.effective_readonly_change)); + this.effective_readonly_change(); + return this._super.apply(this, arguments); + }, + + xy_value_change: function(e) + { + var $this = jQuery(e.currentTarget), + val = $this.val(); + if(this.validate_xy_value(val)) + { + var data = {}, value = this.parse_xy_value(val); + data[this.field_value] = value; + + $this.siblings('.read').text(this.format_xy_value(value)); + $this.val(this.format_xy_value(value)); + + this.dataset.write($this.data('id'), data); + $this.parent().removeClass('oe_form_invalid'); + this.compute_totals(); + } + else + { + $this.parent().addClass('oe_form_invalid'); + } + + }, + + effective_readonly_change: function() + { + this.$el + .find('tbody td.oe_list_field_cell span.oe_form_field .edit') + .toggle(!this.get('effective_readonly')); + this.$el + .find('tbody td.oe_list_field_cell span.oe_form_field .read') + .toggle(this.get('effective_readonly')); + this.$el.find('.edit').first().focus(); + }, + + is_syntax_valid: function() + { + return this.$el.find('.oe_form_invalid').length == 0; + }, + + // deactivate view related functions + load_views: function() {}, + reload_current_view: function() {}, + get_active_view: function() {}, + }); +} diff --git a/web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml b/web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml new file mode 100644 index 000000000..35f1669bc --- /dev/null +++ b/web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml @@ -0,0 +1,36 @@ + + +
+ + + + + + + + + + + + + + + + + + +
+ + + Total
+ + + + + +
Total +
+
+
+
diff --git a/web_widget_x2many_2d_matrix/views/templates.xml b/web_widget_x2many_2d_matrix/views/templates.xml new file mode 100644 index 000000000..06934cc33 --- /dev/null +++ b/web_widget_x2many_2d_matrix/views/templates.xml @@ -0,0 +1,11 @@ + + + + + +