Browse Source

[IMP] mail_move_message: Move message from inbox and link with first message of record

pull/1/head
Veronika 9 years ago
parent
commit
f29da0171a
  1. 11
      mail_move_message_models.py

11
mail_move_message_models.py

@ -154,14 +154,17 @@ class wizard(models.TransientModel):
'target': 'new', 'target': 'new',
'context': {'default_message_id': message_id}, 'context': {'default_message_id': message_id},
} }
@api.multi @api.multi
def move(self): def move(self):
for r in self: for r in self:
r.check_access() r.check_access()
if r.parent_id:
if not (r.parent_id.model == r.model and
r.parent_id.res_id == r.res_id):
r.parent_id = None
if not r.parent_id or not (r.parent_id.model == r.model and
r.parent_id.res_id == r.res_id):
#link with the first message of record
parent = self.env['mail.message'].search([('model','=',r.model), ('res_id','=',r.res_id)], order='id', limit=1)
r.parent_id = parent.id or None
r.message_id.move(r.parent_id.id, r.res_id, r.model, r.move_back) r.message_id.move(r.parent_id.id, r.res_id, r.model, r.move_back)
if not ( r.model and r.res_id ): if not ( r.model and r.res_id ):

Loading…
Cancel
Save