diff --git a/web_x2many_delete_all/README.rst b/web_x2many_delete_all/README.rst index e69de29b..5bba589b 100644 --- a/web_x2many_delete_all/README.rst +++ b/web_x2many_delete_all/README.rst @@ -0,0 +1,58 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +======================== +X2many Delete All Button +======================== + +Adds a button to Many2many and One2many fields that removes all linked records. + +Configuration +============= + +No configuration is needed. + +Usage +===== + +To use this module, you need to: + +#. Go to any Many2many or One2many field; +#. click 'Edit'; +#. click the top most trash can button. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/162/10.0 + +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. + +Credits +======= + +Contributors +------------ + +* Dennis Sluijk + +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. \ No newline at end of file diff --git a/web_x2many_delete_all/__init__.py b/web_x2many_delete_all/__init__.py index e69de29b..3bf7ea73 100644 --- a/web_x2many_delete_all/__init__.py +++ b/web_x2many_delete_all/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +# © 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 index f9adab11..2e211ae9 100644 --- a/web_x2many_delete_all/__manifest__.py +++ b/web_x2many_delete_all/__manifest__.py @@ -1,10 +1,14 @@ +# -*- coding: utf-8 -*- +# © 2016 Onestein () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + { - 'name': 'Many2many and Many2one Delete All Button', - 'summary': 'Adds a button to', + 'name': 'X2many Delete All Button', + 'summary': 'Adds a button to x2many fields that removes all linked records', 'version': '10.0.1.0.0', 'category': 'Web', 'author': 'Onestein,Odoo Community Association (OCA)', - 'website': 'http://www.onestein.nl', + 'website': 'http://www.onestein.eu', 'license': 'AGPL-3', 'depends': [ 'web', diff --git a/web_x2many_delete_all/static/src/css/web_x2many_delete_all.css b/web_x2many_delete_all/static/src/css/web_x2many_delete_all.css new file mode 100644 index 00000000..f4ae25bd --- /dev/null +++ b/web_x2many_delete_all/static/src/css/web_x2many_delete_all.css @@ -0,0 +1,7 @@ +/* Copyright 2016 Onestein + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ + +table.o_list_view th.o_list_record_delete, +table.o_list_view th.o_list_record_delete span { + cursor: pointer; +} 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 index 1ac83f54..50e83cc4 100644 --- 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 @@ -1,3 +1,6 @@ +/* Copyright 2016 Onestein + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ + odoo.define('web_x2many_delete_all', function (require) { "use strict"; var core = require('web.core'), @@ -8,8 +11,8 @@ odoo.define('web_x2many_delete_all', function (require) { 'click th.o_list_record_delete': 'btn_delete_all_clicked' }, reload_current_view: function() { - var res = this._super.apply(this, arguments); var self = this; + var res = this._super.apply(this, arguments); res.then(function() { self.toggle_btn_delete_all(); }); @@ -23,9 +26,8 @@ odoo.define('web_x2many_delete_all', function (require) { } }, btn_delete_all_clicked: function() { - if(!this.get('effective_readonly')) { - this.delete_all(); - } + if(this.get('effective_readonly')) return; + this.delete_all(); }, delete_all: function() { this.viewmanager.views.list.controller.do_delete(this.dataset.ids); @@ -34,4 +36,4 @@ odoo.define('web_x2many_delete_all', function (require) { core.form_widget_registry.get('many2many').include(X2ManyListDeleteAllMixin); core.form_widget_registry.get('one2many').include(X2ManyListDeleteAllMixin); -}); \ No newline at end of file +}); diff --git a/web_x2many_delete_all/static/src/xml/web_x2many_delete_all.xml b/web_x2many_delete_all/static/src/xml/web_x2many_delete_all.xml index 20c43156..ccca822d 100644 --- a/web_x2many_delete_all/static/src/xml/web_x2many_delete_all.xml +++ b/web_x2many_delete_all/static/src/xml/web_x2many_delete_all.xml @@ -1,4 +1,7 @@ + + diff --git a/web_x2many_delete_all/templates/assets.xml b/web_x2many_delete_all/templates/assets.xml index ccc63fdd..64c269ca 100644 --- a/web_x2many_delete_all/templates/assets.xml +++ b/web_x2many_delete_all/templates/assets.xml @@ -1,9 +1,14 @@ - + +