diff options
| author | Christophe Matthieu <chm@openerp.com> | 2013-02-14 12:37:02 +0100 |
|---|---|---|
| committer | Christophe Matthieu <chm@openerp.com> | 2013-02-14 12:37:02 +0100 |
| commit | 6f1f3f8a03ab4edc3dddd874786bc167b834f229 (patch) | |
| tree | 607acd7f76cd46bb79825c5782f6378c92bdc5dd /addons/mail/static/src | |
| parent | ca76cb8d32a12217cffd50a445565312e4beb0c1 (diff) | |
[IMP] mail: add 'Log a note' button right after 'Send to followers' button
bzr revid: chm@openerp.com-20130214113702-ste98tekdcj4kt4w
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/css/mail.css | 3 | ||||
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 17 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 1 |
3 files changed, 17 insertions, 4 deletions
diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 5c0817b3ff0..72ecb5d4d07 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -439,7 +439,8 @@ line-height: 12px; vertical-align: middle; } -.openerp .oe_mail .oe_msg_footer button.oe_post{ +.openerp .oe_mail .oe_msg_footer button.oe_post, +.openerp .oe_mail .oe_msg_footer button.oe_log{ position: relative; z-index: 2; } diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 2c5b8d77dd1..5c36c32c15a 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -495,6 +495,7 @@ openerp.mail = function (session) { this.$('.oe_cancel').on('click', _.bind( this.on_cancel, this) ); this.$('.oe_post').on('click', _.bind( this.on_message_post, this) ); + this.$('.oe_log').on('click', _.bind( this.on_message_log, this) ); this.$('.oe_full').on('click', _.bind( this.on_compose_fullmail, this, this.id ? 'reply' : 'comment') ); /* stack for don't close the compose form if the user click on a button */ this.$('.oe_msg_left, .oe_msg_center').on('mousedown', _.bind( function () { this.stay_open = true; }, this)); @@ -632,17 +633,27 @@ openerp.mail = function (session) { } }, + on_message_log: function (event) { + if (this.do_check_attachment_upload() && (this.attachment_ids.length || this.$('textarea').val().match(/\S+/))) { + this.do_send_message_post([], true); + } + }, + /*do post a message and fetch the message*/ - do_send_message_post: function (partner_ids) { + do_send_message_post: function (partner_ids, log) { var self = this; - this.parent_thread.ds_thread._model.call('message_post_user_api', [this.context.default_res_id], { + var values = { 'body': this.$('textarea').val(), 'subject': false, 'parent_id': this.context.default_parent_id, 'attachment_ids': _.map(this.attachment_ids, function (file) {return file.id;}), 'partner_ids': partner_ids, 'context': this.parent_thread.context, - }).done(function (message_id) { + }; + if (log) { + values['subtype'] = false; + } + this.parent_thread.ds_thread._model.call('message_post_user_api', [this.context.default_res_id], values).done(function (message_id) { var thread = self.parent_thread; var root = thread == self.options.root_thread; if (self.options.display_indented_thread < self.thread_level && thread.parent_message) { diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 4a5473981d5..bc8a8dc30ed 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -33,6 +33,7 @@ <div class="oe_msg_footer"> <div class="oe_msg_attachment_list"></div> <button class="oe_post">Send to followers</button> + or <button class="oe_log">Log a note</button> <t t-call="mail.compose_message.add_attachment"/> <!--<a class="oe_cancel oe_e">X</a>--> </div> |
