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. 21
      mail_move_message/mail_move_message_models.py
  3. 2
      mail_move_message/static/src/xml/mail_move_message_main.xml

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',

21
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) 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 { return {
'type' : 'ir.actions.client',
'name' : 'Archive',
'tag' : 'reload',
'params' : {'menu_id': obj},
'type': 'ir.actions.client',
'name': 'All messages',
'tag': 'reload',
} }
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'

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

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

Loading…
Cancel
Save