Browse Source

[FIX] add condition in base.js when model and/or res_id empty then call method send_mail_action()

pull/33/head
x620 9 years ago
parent
commit
e40667aa7d
  1. 10
      mail_base/static/src/js/base.js

10
mail_base/static/src/js/base.js

@ -786,6 +786,7 @@ chat_manager.post_message = function (data, options) {
subtype_id: data.subtype_id subtype_id: data.subtype_id
}); });
if (options.model && options.res_id){
var model = new Model(options.model); var model = new Model(options.model);
return model.call('message_post', [options.res_id], msg).then(function (msg_id) { return model.call('message_post', [options.res_id], msg).then(function (msg_id) {
return MessageModel.call('message_format', [msg_id]).then(function (msgs) { return MessageModel.call('message_format', [msg_id]).then(function (msgs) {
@ -794,6 +795,15 @@ chat_manager.post_message = function (data, options) {
chat_manager.mail_tools.add_message(msgs[0]); chat_manager.mail_tools.add_message(msgs[0]);
}); });
}); });
} else {
options.model = 'mail.compose.message';
options.res_id = msg.id;
var compose_model = new Model(options.model);
return compose_model.call('send_mail_action', [options.res_id], {
res_model: options.model,
res_id: options.res_id
});
}
} }
}; };
chat_manager.get_message = function (id) { chat_manager.get_message = function (id) {

Loading…
Cancel
Save