From 33dc884c588e0bc733666b476da85530001921a5 Mon Sep 17 00:00:00 2001 From: tarteo Date: Thu, 10 Nov 2016 21:11:50 +0100 Subject: [PATCH 1/7] Initial commit --- web_x2many_delete_all/README.rst | 0 web_x2many_delete_all/__init__.py | 0 web_x2many_delete_all/__manifest__.py | 17 +++++++++++ .../static/src/js/web_x2many_delete_all.js | 29 +++++++++++++++++++ web_x2many_delete_all/templates/assets.xml | 9 ++++++ 5 files changed, 55 insertions(+) create mode 100644 web_x2many_delete_all/README.rst create mode 100644 web_x2many_delete_all/__init__.py create mode 100644 web_x2many_delete_all/__manifest__.py create mode 100644 web_x2many_delete_all/static/src/js/web_x2many_delete_all.js create mode 100644 web_x2many_delete_all/templates/assets.xml diff --git a/web_x2many_delete_all/README.rst b/web_x2many_delete_all/README.rst new file mode 100644 index 00000000..e69de29b diff --git a/web_x2many_delete_all/__init__.py b/web_x2many_delete_all/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/web_x2many_delete_all/__manifest__.py b/web_x2many_delete_all/__manifest__.py new file mode 100644 index 00000000..cd41dbef --- /dev/null +++ b/web_x2many_delete_all/__manifest__.py @@ -0,0 +1,17 @@ +{ + 'name': 'Many2many and Many2one Delete All Button', + 'summary': 'Adds a button to', + 'version': '10.0.1.0.0', + 'category': 'Web', + 'author': 'Onestein,Odoo Community Association (OCA)', + 'website': 'http://www.onestein.nl', + 'license': 'AGPL-3', + 'depends': [ + 'web', + ], + 'data': [ + 'templates/assets.xml' + ], + 'installable': True, + 'application': False, +} 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..d5818564 --- /dev/null +++ b/web_x2many_delete_all/static/src/js/web_x2many_delete_all.js @@ -0,0 +1,29 @@ +odoo.define('web_x2many_delete_all', function (require) { +"use strict"; + var core = require('web.core'); + var _t = core._t; + + + var DeleteAllMixin = { + events: { + 'click th.o_list_record_delete': 'btn_delete_all_clicked' + }, + start: function() { + return this._super.apply(this, arguments); + }, + btn_delete_all_clicked: function() { + if(!this.get('effective_readonly')) { + this.delete_all(); + } + }, + delete_all: function() { + this.viewmanager.views.list.controller.do_delete(this.dataset.ids); + } + } + + var many2many = core.form_widget_registry.get('many2many'); + var one2many = core.form_widget_registry.get('one2many'); + + many2many.include(DeleteAllMixin); + one2many.include(DeleteAllMixin); +}); \ No newline at end of file diff --git a/web_x2many_delete_all/templates/assets.xml b/web_x2many_delete_all/templates/assets.xml new file mode 100644 index 00000000..ccc63fdd --- /dev/null +++ b/web_x2many_delete_all/templates/assets.xml @@ -0,0 +1,9 @@ + + +