Browse Source

Expose mixin for inheritance, fix some spacing.

Related to https://github.com/OCA/web/pull/481.
pull/497/head
Jairo Llopis 8 years ago
committed by GitHub
parent
commit
c1d1f0d726
  1. 13
      web_x2many_delete_all/static/src/js/web_x2many_delete_all.js

13
web_x2many_delete_all/static/src/js/web_x2many_delete_all.js

@ -1,10 +1,9 @@
/* Copyright 2016 Onestein /* Copyright 2016 Onestein
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ * 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'),
_t = core._t;
odoo.define('web_x2many_delete_all.Mixin', function (require) {
"use strict";
var core = require('web.core');
var X2ManyListDeleteAllMixin = { var X2ManyListDeleteAllMixin = {
events: { events: {
@ -19,14 +18,14 @@ odoo.define('web_x2many_delete_all', function (require) {
return res return res
}, },
toggle_btn_delete_all: function() { toggle_btn_delete_all: function() {
if(this.get('effective_readonly')) {
if (this.get('effective_readonly')) {
this.$('th.o_list_record_delete > .fa-trash-o').addClass('hidden'); this.$('th.o_list_record_delete > .fa-trash-o').addClass('hidden');
} else { } else {
this.$('th.o_list_record_delete > .fa-trash-o').removeClass('hidden'); this.$('th.o_list_record_delete > .fa-trash-o').removeClass('hidden');
} }
}, },
btn_delete_all_clicked: function() { btn_delete_all_clicked: function() {
if(this.get('effective_readonly')) return;
if (this.get('effective_readonly')) return;
this.delete_all(); this.delete_all();
}, },
delete_all: function() { delete_all: function() {
@ -36,4 +35,6 @@ odoo.define('web_x2many_delete_all', function (require) {
core.form_widget_registry.get('many2many').include(X2ManyListDeleteAllMixin); core.form_widget_registry.get('many2many').include(X2ManyListDeleteAllMixin);
core.form_widget_registry.get('one2many').include(X2ManyListDeleteAllMixin); core.form_widget_registry.get('one2many').include(X2ManyListDeleteAllMixin);
return X2ManyListDeleteAllMixin;
}); });
Loading…
Cancel
Save