From 269e07244c5b14f6834943ab9de6d960f80e7e46 Mon Sep 17 00:00:00 2001 From: x620 Date: Fri, 3 Jun 2016 16:34:49 +0500 Subject: [PATCH] [PORT] if not model and res_id move to All messages channel and add mail_all depends to __openerp__.py [FIX] override message_format for add "is_moved" value --- mail_move_message/__openerp__.py | 2 +- mail_move_message/mail_move_message_models.py | 21 +++++++++++++------ .../static/src/xml/mail_move_message_main.xml | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/mail_move_message/__openerp__.py b/mail_move_message/__openerp__.py index be5b31e..40fe2a6 100644 --- a/mail_move_message/__openerp__.py +++ b/mail_move_message/__openerp__.py @@ -7,7 +7,7 @@ 'website' : 'https://twitter.com/yelizariev', 'price': 9.00, 'currency': 'EUR', - 'depends' : ['mail_base', 'web_polymorphic_field'], + 'depends' : ['mail_all', 'web_polymorphic_field'], 'images': ['images/inbox.png'], 'data':[ 'mail_move_message_views.xml', diff --git a/mail_move_message/mail_move_message_models.py b/mail_move_message/mail_move_message_models.py index 3beda86..7193771 100644 --- a/mail_move_message/mail_move_message_models.py +++ b/mail_move_message/mail_move_message_models.py @@ -176,13 +176,12 @@ class wizard(models.TransientModel): r.message_id.move(r.parent_id.id, r.res_id, r.model, r.move_back, r.move_followers) - if not ( r.model and r.res_id ): - obj = self.pool.get('ir.model.data').get_object_reference(self._cr, SUPERUSER_ID, 'mail', 'mail_archivesfeeds')[1] + if not (r.model and r.res_id): + r.message_id.needaction = False return { - 'type' : 'ir.actions.client', - 'name' : 'Archive', - 'tag' : 'reload', - 'params' : {'menu_id': obj}, + 'type': 'ir.actions.client', + 'name': 'All messages', + 'tag': 'reload', } return { 'name': _('Record'), @@ -328,6 +327,16 @@ class mail_message(models.Model): res['is_moved'] = message.is_moved return res + @api.multi + def message_format(self): + message_values = super(mail_message, self).message_format() + message_index = {message['id']: message for message in message_values} + for item in self: + msg = message_index.get(item.id) + if msg: + msg['is_moved'] = item.is_moved + return message_values + class mail_move_message_configuration(models.TransientModel): _name = 'mail_move_message.config.settings' diff --git a/mail_move_message/static/src/xml/mail_move_message_main.xml b/mail_move_message/static/src/xml/mail_move_message_main.xml index 86fd4bc..88fffd3 100644 --- a/mail_move_message/static/src/xml/mail_move_message_main.xml +++ b/mail_move_message/static/src/xml/mail_move_message_main.xml @@ -12,7 +12,7 @@