From 3821e12812d86d6acecf0b70c2565c15f126bf3e Mon Sep 17 00:00:00 2001 From: x620 Date: Wed, 15 Jun 2016 19:00:52 +0500 Subject: [PATCH] [FIX] Fix error when show task.project records haven't record_name --- mail_move_message/mail_move_message_models.py | 4 ++++ mail_move_message/static/src/js/mail_move_message.js | 1 + 2 files changed, 5 insertions(+) diff --git a/mail_move_message/mail_move_message_models.py b/mail_move_message/mail_move_message_models.py index 797b11a..565e62d 100644 --- a/mail_move_message/mail_move_message_models.py +++ b/mail_move_message/mail_move_message_models.py @@ -320,6 +320,10 @@ class mail_message(models.Model): 'model': vals.get('model'), 'is_moved': vals['is_moved'] } + if vals.get('model') and vals.get('res_id'): + record = self.env[vals.get('model')].browse(vals.get('res_id')) + if record: + notification['record_name'] = record.name self.env['bus.bus'].sendone((self._cr.dbname, 'mail_move_message'), notification) def name_get(self, cr, uid, ids, context=None): diff --git a/mail_move_message/static/src/js/mail_move_message.js b/mail_move_message/static/src/js/mail_move_message.js index 85869e8..f8fca02 100644 --- a/mail_move_message/static/src/js/mail_move_message.js +++ b/mail_move_message/static/src/js/mail_move_message.js @@ -77,6 +77,7 @@ odoo.define('mail_move_message.relocate', function (require) { if (model === 'mail_move_message' && message) { message.res_id = notification[1].res_id; message.model = notification[1].model; + message.record_name = notification[1].record_name; // Mark message as moved after move message.is_moved = notification[1].is_moved; // Update cache and accordingly message in the thread