diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py
index a999c6df111..93785c81b9a 100644
--- a/addons/mail/mail_thread.py
+++ b/addons/mail/mail_thread.py
@@ -647,7 +647,7 @@ class mail_thread(osv.osv):
def message_append_note(self, cr, uid, ids, subject, body, parent_id=False, type='notification', context=None):
return self.message_append(cr, uid, ids, subject, body_text=body, parent_id=parent_id, type=type, context=context)
-
+
#------------------------------------------------------
# Subscription mechanism
#------------------------------------------------------
diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js
index 9d117565715..cffce1b5f0a 100644
--- a/addons/mail/static/src/js/mail.js
+++ b/addons/mail/static/src/js/mail.js
@@ -50,6 +50,7 @@ openerp.mail = function(session) {
/* DataSets and internal vars */
this.ds = new session.web.DataSet(this, this.params.res_model);
this.ds_users = new session.web.DataSet(this, 'res.users');
+ this.ds_msg = new session.web.DataSet(this, 'mail.message');
this.name = 'Unknown record'
this.sorted_comments = {'root_ids': [], 'root_id_msg_list': {}};
/* Display vars */
@@ -76,10 +77,10 @@ openerp.mail = function(session) {
if (event.shiftKey && charCode == 13) { this.value = this.value+"\n"; }
else if (charCode == 13) { self.do_comment(); }
});
- this.$element.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_reply', 'click', function (event) {
- var act_dom = $(this).parents('div.oe_mail_thread_display').find('div.oe_mail_thread_act:first');
- act_dom.toggle();
- });
+
+ // add event
+ this.add_events();
+
this.$element.find('div.oe_mail_thread_display').delegate('a.intlink', 'click', function (event) {
// lazy implementation: fetch data and try to redirect
if (! event.srcElement.dataset.resModel) return false;
@@ -109,6 +110,23 @@ openerp.mail = function(session) {
return display_done
},
+ add_events: function() {
+ var self = this;
+ // event: click on 'reply'
+ this.$element.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_reply', 'click', function (event) {
+ var act_dom = $(this).parents('div.oe_mail_thread_display').find('div.oe_mail_thread_act:first');
+ act_dom.toggle();
+ });
+ // event: click on 'delete'
+ this.$element.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_delete', 'click', function (event) {
+ console.log('deleting');
+ var msg_id = event.srcElement.dataset.id;
+ if (! msg_id) return false;
+ self.ds_msg.unlink([parseInt(msg_id)]).then();
+ return false;
+ });
+ },
+
stop: function () {
//this._super.apply(this, arguments);
},
diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml
index c2eef5499f7..c9ab259ddf8 100644
--- a/addons/mail/static/src/xml/mail.xml
+++ b/addons/mail/static/src/xml/mail.xml
@@ -77,8 +77,8 @@
on
Reply
- Delete
- Hide
+ Delete
+ Hide