Jalpesh Patel(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-1052417-pja into 
lp:openobject-addons.

Requested reviews:
  Atul Patel(OpenERP) (atp-openerp)
Related bugs:
  Bug #1052417 in OpenERP Addons: "Reply of posted comment display wrong 
comment."
  https://bugs.launchpad.net/openobject-addons/+bug/1052417

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1052417-pja/+merge/125093

Hello,

    i have improve code for comment's reply in mail.js file.

Thanks!
pja
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1052417-pja/+merge/125093
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-1052417-pja.
=== modified file 'mail/static/src/js/mail.js'
--- mail/static/src/js/mail.js	2012-09-18 15:05:44 +0000
+++ mail/static/src/js/mail.js	2012-09-19 04:44:20 +0000
@@ -330,7 +330,7 @@
             this.$el.find('textarea.oe_mail_compose_textarea').keyup(function (event) {
                 var charCode = (event.which) ? event.which : window.event.keyCode;
                 if (event.shiftKey && charCode == 13) { this.value = this.value+"\n"; }
-                else if (charCode == 13) { return self.message_post(); }
+                else if (charCode == 13) {console.log('charcodee',charCode); return self.message_post(this.value); }
             });
             // event: click on 'Reply' in msg
             this.$el.on('click', 'a.oe_mail_msg_reply', function (event) {
@@ -447,6 +447,7 @@
             message_ids = initial_mode && this.options.message_ids != null && this.options.message_ids || false;
             return this.ds_message.call('message_read', [message_ids, fetch_domain, this.options.thread_level, undefined, fetch_context]
                 ).then(this.proxy('message_display'));
+            
         },
 
         /* Display a list of records
@@ -553,14 +554,12 @@
         
         message_post: function (body) {
             var self = this;
-            if (! body) {
-                var comment_node = this.$el.find('textarea');
-                var body = comment_node.val();
-                comment_node.val('');
-            }
             return this.ds_thread.call('message_post', [
-                [this.context.default_res_id], body, false, 'comment', this.context.default_parent_id, undefined]
-                ).then(self.message_fetch());
+                [this.context.default_res_id], body, false, 'comment', this.context.default_parent_id, undefined]).then(function(result){
+                	self.ds_message.call('message_read', [[result]]
+                    ).then(self.proxy('message_display'));
+                	self.$el.find('textarea').val('');
+                });
         },
 
         /** Action: 'shows more' to fetch new messages */

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to