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.

31 lines
928 B

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