Browse Source

[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
pull/36/head
x620 9 years ago
parent
commit
269e07244c
  1. 2
      mail_move_message/__openerp__.py
  2. 15
      mail_move_message/mail_move_message_models.py

2
mail_move_message/__openerp__.py

@ -7,7 +7,7 @@
'website' : 'https://twitter.com/yelizariev', 'website' : 'https://twitter.com/yelizariev',
'price': 9.00, 'price': 9.00,
'currency': 'EUR', 'currency': 'EUR',
'depends' : ['mail_base', 'web_polymorphic_field'],
'depends' : ['mail_all', 'web_polymorphic_field'],
'images': ['images/inbox.png'], 'images': ['images/inbox.png'],
'data':[ 'data':[
'mail_move_message_views.xml', 'mail_move_message_views.xml',

15
mail_move_message/mail_move_message_models.py

@ -177,12 +177,11 @@ class wizard(models.TransientModel):
r.message_id.move(r.parent_id.id, r.res_id, r.model, r.move_back, r.move_followers) 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): 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]
r.message_id.needaction = False
return { return {
'type': 'ir.actions.client', 'type': 'ir.actions.client',
'name' : 'Archive',
'name': 'All messages',
'tag': 'reload', 'tag': 'reload',
'params' : {'menu_id': obj},
} }
return { return {
'name': _('Record'), 'name': _('Record'),
@ -328,6 +327,16 @@ class mail_message(models.Model):
res['is_moved'] = message.is_moved res['is_moved'] = message.is_moved
return res 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): class mail_move_message_configuration(models.TransientModel):
_name = 'mail_move_message.config.settings' _name = 'mail_move_message.config.settings'

Loading…
Cancel
Save