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 00000000..9dbcd362 --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/README.rst @@ -0,0 +1,79 @@ +======================= +Tags multiple selection +======================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/12.0/web_widget_many2many_tags_multi_selection + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_widget_many2many_tags_multi_selection + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/162/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +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. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Akretion +* Jamin Shah + +Contributors +~~~~~~~~~~~~ + +* Sylvain Calador +* Jamin Shah +* Maxence Groine +* Anand Kansagra + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. 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 00000000..ef5ae358 --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/__init__.py @@ -0,0 +1 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). diff --git a/web_widget_many2many_tags_multi_selection/__manifest__.py b/web_widget_many2many_tags_multi_selection/__manifest__.py new file mode 100644 index 00000000..efc796a5 --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/__manifest__.py @@ -0,0 +1,16 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + 'name': 'Tags multiple selection', + 'version': '12.0.1.0.0', + 'author': 'Akretion, Odoo Community Association (OCA), Jamin Shah', + 'depends': [ + 'web', + ], + 'website': 'https://github.com/OCA/web', + 'data': [ + 'views/web_widget_many2many_tags_multi_selection.xml', + ], + 'license': 'AGPL-3', + 'installable': True, +} diff --git a/web_widget_many2many_tags_multi_selection/i18n/lt.po b/web_widget_many2many_tags_multi_selection/i18n/lt.po new file mode 100644 index 00000000..ac5b027a --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/i18n/lt.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_many2many_tags_multi_selection +# +# Translators: +# Viktoras Norkus , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-25 01:58+0000\n" +"PO-Revision-Date: 2018-01-25 01:58+0000\n" +"Last-Translator: Viktoras Norkus , 2018\n" +"Language-Team: Lithuanian (https://www.transifex.com/oca/teams/23907/lt/)\n" +"Language: lt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n" +"%100<10 || n%100>=20) ? 1 : 2);\n" + +#. module: web_widget_many2many_tags_multi_selection +#. openerp-web +#: code:addons/web_widget_many2many_tags_multi_selection/static/src/js/view_form.js:26 +#, python-format +msgid "Create: " +msgstr "Sukurti:" + +#. module: web_widget_many2many_tags_multi_selection +#. openerp-web +#: code:addons/web_widget_many2many_tags_multi_selection/static/src/js/view_form.js:26 +#, python-format +msgid "Search: " +msgstr "Ieškoti:" diff --git a/web_widget_many2many_tags_multi_selection/i18n/nl_NL.po b/web_widget_many2many_tags_multi_selection/i18n/nl_NL.po new file mode 100644 index 00000000..c0400098 --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/i18n/nl_NL.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_many2many_tags_multi_selection +# +# Translators: +# Peter Hageman , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: Peter Hageman , 2017\n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/" +"teams/23907/nl_NL/)\n" +"Language: nl_NL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_widget_many2many_tags_multi_selection +#. openerp-web +#: code:addons/web_widget_many2many_tags_multi_selection/static/src/js/view_form.js:26 +#, python-format +msgid "Create: " +msgstr "Aanmaken:" + +#. module: web_widget_many2many_tags_multi_selection +#. openerp-web +#: code:addons/web_widget_many2many_tags_multi_selection/static/src/js/view_form.js:26 +#, python-format +msgid "Search: " +msgstr "Zoeken:" diff --git a/web_widget_many2many_tags_multi_selection/i18n/pt_BR.po b/web_widget_many2many_tags_multi_selection/i18n/pt_BR.po new file mode 100644 index 00000000..7ff3b0a8 --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/i18n/pt_BR.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_many2many_tags_multi_selection +# +# Translators: +# Rodrigo de Almeida Sottomaior Macedo , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-22 08:27+0000\n" +"PO-Revision-Date: 2018-08-04 13:35+0000\n" +"Last-Translator: Rodrigo Macedo \n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/" +"23907/pt_BR/)\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.1.1\n" + +#. module: web_widget_many2many_tags_multi_selection +#. openerp-web +#: code:addons/web_widget_many2many_tags_multi_selection/static/src/js/view_form.js:26 +#, python-format +msgid "Create: " +msgstr "Criado: " + +#. module: web_widget_many2many_tags_multi_selection +#. openerp-web +#: code:addons/web_widget_many2many_tags_multi_selection/static/src/js/view_form.js:26 +#, python-format +msgid "Search: " +msgstr "Pesquisa: " diff --git a/web_widget_many2many_tags_multi_selection/i18n/web_widget_many2many_tags_multi_selection.pot b/web_widget_many2many_tags_multi_selection/i18n/web_widget_many2many_tags_multi_selection.pot new file mode 100644 index 00000000..508e7f44 --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/i18n/web_widget_many2many_tags_multi_selection.pot @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_many2many_tags_multi_selection +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \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_widget_many2many_tags_multi_selection +#. openerp-web +#: code:addons/web_widget_many2many_tags_multi_selection/static/src/js/view_form.js:26 +#, python-format +msgid "Create: " +msgstr "" + +#. module: web_widget_many2many_tags_multi_selection +#. openerp-web +#: code:addons/web_widget_many2many_tags_multi_selection/static/src/js/view_form.js:26 +#, python-format +msgid "Search: " +msgstr "" + diff --git a/web_widget_many2many_tags_multi_selection/readme/CONFIGURATION.rst b/web_widget_many2many_tags_multi_selection/readme/CONFIGURATION.rst new file mode 100644 index 00000000..812a942f --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/readme/CONFIGURATION.rst @@ -0,0 +1 @@ +After installation, the behavior of all fields using the 'many2many_tags' widget will be changed automatically. diff --git a/web_widget_many2many_tags_multi_selection/readme/CONTRIBUTORS.rst b/web_widget_many2many_tags_multi_selection/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..2ea4b2d7 --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Sylvain Calador +* Jamin Shah +* Maxence Groine +* Anand Kansagra diff --git a/web_widget_many2many_tags_multi_selection/readme/DESCRIPTION.rst b/web_widget_many2many_tags_multi_selection/readme/DESCRIPTION.rst new file mode 100644 index 00000000..8f4f69f8 --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +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. diff --git a/web_widget_many2many_tags_multi_selection/static/description/icon.png b/web_widget_many2many_tags_multi_selection/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/web_widget_many2many_tags_multi_selection/static/description/icon.png differ diff --git a/web_widget_many2many_tags_multi_selection/static/description/index.html b/web_widget_many2many_tags_multi_selection/static/description/index.html new file mode 100644 index 00000000..fd9a57da --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/static/description/index.html @@ -0,0 +1,424 @@ + + + + + + +Tags multiple selection + + + +
+

Tags multiple selection

+ + +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runbot

+

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.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
  • Jamin Shah
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + 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 00000000..65c1db5d --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/static/src/js/view_form.js @@ -0,0 +1,41 @@ +odoo.define('web_widget_many2many_tags_multi_selection.multiple_tags', function (require) { + "use strict"; + + var rel_fields = require('web.relational_fields'); + var dialogs = require('web.view_dialogs'); + var core = require('web.core'); + var _t = core._t; + + rel_fields.FieldMany2One.include({ + _searchCreatePopup: function(view, ids, context) { + var self = this; + + // Don't include already selected instances in the search domain + var domain = self.record.getDomain({fieldName: self.name}); + if (self.field.type === 'many2many') { + var selected_ids = self._getSearchBlacklist(); + if (selected_ids.length > 0) { + domain.push(['id', 'not in', selected_ids]); + } + } + + return new dialogs.SelectCreateDialog(self, _.extend({}, self.nodeOptions, { + res_model: self.field.relation, + domain: domain, + context: _.extend({}, self.record.getContext(self.recordParams), context || {}), + title: (view === 'search' ? _t("Search: ") : _t("Create: ")) + self.string, + initial_ids: ids ? _.map(ids, function(x) {return x[0];}) : undefined, + initial_view: view, + disable_multiple_selection: self.field.type !== 'many2many', + on_selected: function(records) { + if (self.field.type !== 'many2many') { + self.reinitialize(records[0]); + } else { + self.reinitialize(records); + } + self.activate(); + } + })).open(); + }, + }); +}); diff --git a/web_widget_many2many_tags_multi_selection/views/web_widget_many2many_tags_multi_selection.xml b/web_widget_many2many_tags_multi_selection/views/web_widget_many2many_tags_multi_selection.xml new file mode 100644 index 00000000..b542560e --- /dev/null +++ b/web_widget_many2many_tags_multi_selection/views/web_widget_many2many_tags_multi_selection.xml @@ -0,0 +1,8 @@ + + + +