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.

36 lines
1.1 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 x620 <https://github.com/x620>
  3. # Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
  4. # License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html)
  5. from openerp import api, models
  6. class MailMessage(models.Model):
  7. _inherit = "mail.message"
  8. @api.multi
  9. def write(self, values):
  10. if values.get("needaction_partner_ids"):
  11. if not values.get("partner_ids"):
  12. values["partner_ids"] = []
  13. for triplet in values.get("needaction_partner_ids"):
  14. if triplet[0] == 6:
  15. for i in triplet[2]:
  16. values["partner_ids"].append((4, i, False))
  17. return super(MailMessage, self).write(values)
  18. class MailComposer(models.TransientModel):
  19. _inherit = "mail.compose.message"
  20. @api.multi
  21. def send_mail(self, auto_commit=False):
  22. res = super(MailComposer, self).send_mail(auto_commit=auto_commit)
  23. notification = {}
  24. self.env["bus.bus"].sendone(
  25. (self._cr.dbname, "mail_base.mail_sent"), notification
  26. )
  27. return res