forked from OCA/web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
tarteo
committed
Nov 10, 2016
1 parent
1f92cd2
commit 33dc884
Showing
5 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
29
web_x2many_delete_all/static/src/js/web_x2many_delete_all.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |