diff --git a/web_x2many_delete_all/README.rst b/web_x2many_delete_all/README.rst new file mode 100644 index 00000000..8b1d72ad --- /dev/null +++ b/web_x2many_delete_all/README.rst @@ -0,0 +1,3 @@ +**This file is going to be generated by oca-gen-addon-readme.** + +Adds a button to Many2many and One2many fields that removes all linked records. diff --git a/web_x2many_delete_all/__init__.py b/web_x2many_delete_all/__init__.py new file mode 100644 index 00000000..5d414e32 --- /dev/null +++ b/web_x2many_delete_all/__init__.py @@ -0,0 +1,2 @@ +# Copyright 2016 Onestein () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/web_x2many_delete_all/__manifest__.py b/web_x2many_delete_all/__manifest__.py new file mode 100644 index 00000000..fd966066 --- /dev/null +++ b/web_x2many_delete_all/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2016 Onestein () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'X2many Delete All Button', + 'summary': """ + Adds a button to x2many fields that removes all linked records + """, + 'version': '11.0.1.0.0', + 'category': 'Web', + 'author': 'Onestein, Meet Dholakia, Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/web', + 'license': 'AGPL-3', + 'depends': [ + 'web', + ], + 'data': [ + 'templates/assets.xml' + ], + 'qweb': [ + 'static/src/xml/web_x2many_delete_all.xml' + ], +} diff --git a/web_x2many_delete_all/i18n/de.po b/web_x2many_delete_all/i18n/de.po new file mode 100644 index 00000000..76a48ccc --- /dev/null +++ b/web_x2many_delete_all/i18n/de.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_x2many_delete_all +# +# Translators: +# Niki Waibel , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-03 01:37+0000\n" +"PO-Revision-Date: 2017-02-03 01:37+0000\n" +"Last-Translator: Niki Waibel , 2017\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_x2many_delete_all +#. openerp-web +#: code:addons/web_x2many_delete_all/static/src/xml/web_x2many_delete_all.xml:8 +#, python-format +msgid "Delete all" +msgstr "Alles löschen" diff --git a/web_x2many_delete_all/i18n/es.po b/web_x2many_delete_all/i18n/es.po new file mode 100644 index 00000000..55e3edd4 --- /dev/null +++ b/web_x2many_delete_all/i18n/es.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_x2many_delete_all +# +# Translators: +# Pedro M. Baeza , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-12-23 02:13+0000\n" +"PO-Revision-Date: 2016-12-23 02:13+0000\n" +"Last-Translator: Pedro M. Baeza , 2016\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_x2many_delete_all +#. openerp-web +#: code:addons/web_x2many_delete_all/static/src/xml/web_x2many_delete_all.xml:8 +#, python-format +msgid "Delete all" +msgstr "Borrar todo" diff --git a/web_x2many_delete_all/i18n/hr.po b/web_x2many_delete_all/i18n/hr.po new file mode 100644 index 00000000..50afa11a --- /dev/null +++ b/web_x2many_delete_all/i18n/hr.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_x2many_delete_all +# +# Translators: +# Bole , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-04-28 18:03+0000\n" +"PO-Revision-Date: 2017-04-28 18:03+0000\n" +"Last-Translator: Bole , 2017\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: hr\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: web_x2many_delete_all +#. openerp-web +#: code:addons/web_x2many_delete_all/static/src/xml/web_x2many_delete_all.xml:8 +#, python-format +msgid "Delete all" +msgstr "Briši sve" diff --git a/web_x2many_delete_all/i18n/lt.po b/web_x2many_delete_all/i18n/lt.po new file mode 100644 index 00000000..fe3b447a --- /dev/null +++ b/web_x2many_delete_all/i18n/lt.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_x2many_delete_all +# +# 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" +"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_x2many_delete_all +#. openerp-web +#: code:addons/web_x2many_delete_all/static/src/xml/web_x2many_delete_all.xml:8 +#, python-format +msgid "Delete all" +msgstr "Ištrinti viską" diff --git a/web_x2many_delete_all/i18n/nl_NL.po b/web_x2many_delete_all/i18n/nl_NL.po new file mode 100644 index 00000000..99a2c0af --- /dev/null +++ b/web_x2many_delete_all/i18n/nl_NL.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_x2many_delete_all +# +# 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" +"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_x2many_delete_all +#. openerp-web +#: code:addons/web_x2many_delete_all/static/src/xml/web_x2many_delete_all.xml:8 +#, python-format +msgid "Delete all" +msgstr "Alles verwijderen" diff --git a/web_x2many_delete_all/i18n/pt_BR.po b/web_x2many_delete_all/i18n/pt_BR.po new file mode 100644 index 00000000..f41835ac --- /dev/null +++ b/web_x2many_delete_all/i18n/pt_BR.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_x2many_delete_all +# +# 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: 2017-06-22 08:27+0000\n" +"Last-Translator: Rodrigo de Almeida Sottomaior Macedo , 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_x2many_delete_all +#. openerp-web +#: code:addons/web_x2many_delete_all/static/src/xml/web_x2many_delete_all.xml:8 +#, python-format +msgid "Delete all" +msgstr "Apagar todos" diff --git a/web_x2many_delete_all/readme/CONTRIBUTORS.rst b/web_x2many_delete_all/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..9439d427 --- /dev/null +++ b/web_x2many_delete_all/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Dennis Sluijk +* Meet Dholakia diff --git a/web_x2many_delete_all/readme/DESCRIPTION.rst b/web_x2many_delete_all/readme/DESCRIPTION.rst new file mode 100644 index 00000000..f50a2309 --- /dev/null +++ b/web_x2many_delete_all/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module extends the functionality of the list view and adds a button to Many2many and One2many fields that removes all linked records. diff --git a/web_x2many_delete_all/readme/USAGE.rst b/web_x2many_delete_all/readme/USAGE.rst new file mode 100644 index 00000000..69055806 --- /dev/null +++ b/web_x2many_delete_all/readme/USAGE.rst @@ -0,0 +1,5 @@ +To use this module, you need to: + +#. Go to any Many2many or One2many field; +#. click 'Edit'; +#. click the top most trash can button. diff --git a/web_x2many_delete_all/static/src/js/web_x2many_delete_all.js b/web_x2many_delete_all/static/src/js/web_x2many_delete_all.js new file mode 100644 index 00000000..d5c08b9f --- /dev/null +++ b/web_x2many_delete_all/static/src/js/web_x2many_delete_all.js @@ -0,0 +1,39 @@ +/* Copyright 2016 Onestein + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ + +odoo.define('web_x2many_delete_all.Mixin', function (require) { + "use strict"; + var core = require('web.core'); + var _t = core._t; + var ListRenderer = require('web.ListRenderer'); + + ListRenderer.include({ + events: _.extend({}, ListRenderer.prototype.events, { + 'click thead .o_list_record_delete_all': '_onTrashAllIconClick', + }), + _renderHeader: function () { + var $header = this._super.apply(this, arguments); + if (this.addTrashIcon) { + $header.find('tr').append(this._renderDeleteAll('th')); + } + return $header; + }, + _renderDeleteAll: function (tag) { + var $icon = $('