Browse Source

Merge pull request #892 from MaxyMoos/many2many_tags_multi-selection

[11.0][MIG] `web_widget_many2many_tags_multi_selection`
pull/899/head
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
163a9ea265
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 58
      web_widget_many2many_tags_multi_selection/README.rst
  2. 1
      web_widget_many2many_tags_multi_selection/__init__.py
  3. 18
      web_widget_many2many_tags_multi_selection/__manifest__.py
  4. 33
      web_widget_many2many_tags_multi_selection/i18n/lt.po
  5. 33
      web_widget_many2many_tags_multi_selection/i18n/nl_NL.po
  6. 33
      web_widget_many2many_tags_multi_selection/i18n/pt_BR.po
  7. BIN
      web_widget_many2many_tags_multi_selection/static/description/icon.png
  8. 41
      web_widget_many2many_tags_multi_selection/static/src/js/view_form.js
  9. 8
      web_widget_many2many_tags_multi_selection/views/web_widget_many2many_tags_multi_selection.xml

58
web_widget_many2many_tags_multi_selection/README.rst

@ -0,0 +1,58 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3
==================================================
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.
Configuration
=============
After installation, the behavior of all fields using the 'many2many_tags' widget will be changed automatically.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/web/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Images
------
* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.
Contributors
------------
* Sylvain Calador <sylvain.calador@akretion.com>
* Jamin Shah <jaiminshah2009@gmail.com>
* Maxence Groine <mgroine@fiefmanage.ch>
Do not contact contributors directly about support or help with technical issues.
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://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 https://odoo-community.org.

1
web_widget_many2many_tags_multi_selection/__init__.py

@ -0,0 +1 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

18
web_widget_many2many_tags_multi_selection/__manifest__.py

@ -0,0 +1,18 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
'name': 'Tags multiple selection',
'version': '11.0.1.0.0',
'author': 'Akretion, Odoo Community Association (OCA), Jamin Shah',
'depends': [
'web',
],
'demo': [],
'website': 'https://www.akretion.com',
'data': [
'views/web_widget_many2many_tags_multi_selection.xml',
],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
}

33
web_widget_many2many_tags_multi_selection/i18n/lt.po

@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_many2many_tags_multi_selection
#
# Translators:
# Viktoras Norkus <viktoras@bmx.lt>, 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 <viktoras@bmx.lt>, 2018\n"
"Language-Team: Lithuanian (https://www.transifex.com/oca/teams/23907/lt/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: lt\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:15
#, 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:15
#, python-format
msgid "Search: "
msgstr "Ieškoti:"

33
web_widget_many2many_tags_multi_selection/i18n/nl_NL.po

@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_many2many_tags_multi_selection
#
# Translators:
# Peter Hageman <hageman.p@gmail.com>, 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 <hageman.p@gmail.com>, 2017\n"
"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/teams/23907/nl_NL/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: nl_NL\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:15
#, 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:15
#, python-format
msgid "Search: "
msgstr "Zoeken:"

33
web_widget_many2many_tags_multi_selection/i18n/pt_BR.po

@ -0,0 +1,33 @@
# 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 <rmsolucoeseminformatic4@gmail.com>, 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: 2017-06-22 08:27+0000\n"
"Last-Translator: Rodrigo de Almeida Sottomaior Macedo <rmsolucoeseminformatic4@gmail.com>, 2017\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\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:15
#, 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:15
#, python-format
msgid "Search: "
msgstr "Pesquisa:"

BIN
web_widget_many2many_tags_multi_selection/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

41
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]);
}
}
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();
},
});
});

8
web_widget_many2many_tags_multi_selection/views/web_widget_many2many_tags_multi_selection.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_backend" name="web_widget_many2many_tags_multi_selection" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_widget_many2many_tags_multi_selection/static/src/js/view_form.js"></script>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save