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.

19 lines
744 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from openerp import models, api
  5. class MailMessage(models.Model):
  6. _inherit = 'mail.message'
  7. @api.model
  8. def create(self, values):
  9. ctx = self.env.context.copy()
  10. if not ctx.get('notify_followers') and values.get('partner_ids'):
  11. partner_list = self.resolve_2many_commands(
  12. 'partner_ids', values.get('partner_ids'), fields=['id'])
  13. force_partners_to_notify = [d['id'] for d in partner_list]
  14. ctx['force_partners_to_notify'] = force_partners_to_notify
  15. return super(MailMessage, self.with_context(ctx)).create(values)