Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tarteo committed Nov 10, 2016
1 parent 1f92cd2 commit 33dc884
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
Empty file.
Empty file.
17 changes: 17 additions & 0 deletions web_x2many_delete_all/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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,
}
29 changes: 29 additions & 0 deletions web_x2many_delete_all/static/src/js/web_x2many_delete_all.js
Original file line number Diff line number Diff line change
@@ -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);
});
9 changes: 9 additions & 0 deletions web_x2many_delete_all/templates/assets.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr=".">
<script type="text/javascript"
src="/web_x2many_delete_all/static/src/js/web_x2many_delete_all.js"/>
</xpath>
</template>
</odoo>

0 comments on commit 33dc884

Please sign in to comment.