Browse Source

[FIX] Update record_name for each mail_message record

pull/36/head
x620 9 years ago
parent
commit
ce79089806
  1. 9
      mail_move_message/mail_move_message_models.py

9
mail_move_message/mail_move_message_models.py

@ -292,6 +292,9 @@ class mail_message(models.Model):
vals['moved_by_user_id'] = self.env.user.id vals['moved_by_user_id'] = self.env.user.id
vals['moved_by_message_id'] = self.id vals['moved_by_message_id'] = self.id
# Update record_name in message
vals['record_name'] = self._get_record_name(vals)
for r in self.all_child_ids: for r in self.all_child_ids:
r_vals = vals.copy() r_vals = vals.copy()
if not r.is_moved: if not r.is_moved:
@ -313,17 +316,13 @@ class mail_message(models.Model):
'res_model': r_vals.get('model') 'res_model': r_vals.get('model')
}) })
# Update record_name in message
record_name = self._get_record_name(vals)
for item in self:
item.record_name = record_name
# Send notification # Send notification
notification = { notification = {
'id': self.id, 'id': self.id,
'res_id': vals.get('res_id'), 'res_id': vals.get('res_id'),
'model': vals.get('model'), 'model': vals.get('model'),
'is_moved': vals['is_moved'], 'is_moved': vals['is_moved'],
'record_name': record_name
'record_name': vals['record_name']
} }
self.env['bus.bus'].sendone((self._cr.dbname, 'mail_move_message'), notification) self.env['bus.bus'].sendone((self._cr.dbname, 'mail_move_message'), notification)

Loading…
Cancel
Save