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.

33 lines
1.1 KiB

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