Browse Source

[FIX] added notification

pull/36/head
x620 9 years ago
parent
commit
e98e988c0e
  1. 4
      mail_move_message/mail_move_message_models.py
  2. 2
      mail_move_message/static/src/css/mail_move_message.css
  3. 13
      mail_move_message/static/src/js/mail_move_message.js
  4. 2
      mail_move_message/static/src/xml/mail_move_message_main.xml

4
mail_move_message/mail_move_message_models.py

@ -307,6 +307,10 @@ class mail_message(models.Model):
'res_model': r_vals.get('model')
})
# Send notification
notification = {'message_ids': [self.id], 'values': vals}
self.env['bus.bus'].sendone((self._cr.dbname, 'res.partner', self.env.user.partner_id.id), notification)
def name_get(self, cr, uid, ids, context=None):
if not (context or {}).get('extended_name'):
return super(mail_message, self).name_get(cr, uid, ids, context=context)

2
mail_move_message/static/src/css/mail_move_message.css

@ -1,4 +1,4 @@
i.fa.fa-arrows-alt.oe_move.oe_moved {
i.oe_moved {
color: #ED6F6A;
text-shadow: 0px 1px #961b1b,0px -1px #961b1b, -1px 0px #961b1b, 1px 0px #961b1b, 0px 3px 3px rgba(0,0,0,0.1);
}

13
mail_move_message/static/src/js/mail_move_message.js

@ -1,6 +1,7 @@
odoo.define('mail_move_message.relocate', function (require) {
"use strict";
var bus = require('bus.bus').bus;
var chat_manager = require('mail.chat_manager');
var base_obj = require('mail_base.base');
var thread = require('mail.ChatThread');
@ -48,14 +49,20 @@ odoo.define('mail_move_message.relocate', function (require) {
'on_close': function(){
var message = base_obj.chat_manager.get_message(self.message_id);
chat_manager.bus.trigger('update_message', message);
}
}).then(function(){
self.fetch_and_render_thread();
bus.on('notification', null, self.on_notification);
}
});
},
on_notification: function(notification){
var model = notification[0][1];
if (model === 'ir.needaction') {
// new message in the inbox
chat_manager.mail_tools.on_needaction_notification(notification[1]);
}
}
});
// TODO: icon show that message was moved after reload thread. How reload thread?
base_obj.MailTools.include({
make_message: function(data){
var msg = this._super(data);

2
mail_move_message/static/src/xml/mail_move_message_main.xml

@ -12,7 +12,7 @@
<template>
<t t-extend="mail.ChatThread.Message">
<t t-jquery='p.o_mail_info>span>i:first-child' t-operation="before">
<i t-att-class="'fa fa-arrows-alt oe_move' + (message.is_moved ? ' oe_moved' : '')"
<i t-att-class="'fa fa-exchange oe_move' + (message.is_moved ? ' oe_moved' : '')"
t-att-data-message-id="message.id" title="Move to thread"/>
</t>
</t>

Loading…
Cancel
Save