You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
904 B

  1. from openerp import api, models
  2. class MailMessage(models.Model):
  3. _inherit = 'mail.message'
  4. @api.multi
  5. def write(self, values):
  6. if values.get('needaction_partner_ids'):
  7. if not values.get('partner_ids'):
  8. values['partner_ids'] = []
  9. for triplet in values.get('needaction_partner_ids'):
  10. if triplet[0] == 6:
  11. for id in triplet[2]:
  12. values['partner_ids'].append((4, id, False))
  13. return super(MailMessage, self).write(values)
  14. class MailComposer(models.TransientModel):
  15. _inherit = 'mail.compose.message'
  16. @api.multi
  17. def send_mail(self, auto_commit=False):
  18. res = super(MailComposer, self).send_mail(auto_commit=auto_commit)
  19. notification = {}
  20. self.env['bus.bus'].sendone((self._cr.dbname, 'mail_base.mail_sent'), notification)
  21. return res