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.

25 lines
850 B

  1. # -*- coding: utf-8 -*-
  2. from openerp.osv import osv
  3. class mail_message(osv.Model):
  4. _inherit = 'mail.message'
  5. def check_access_rule(self, cr, uid, ids, operation, context=None):
  6. group_all_emails = self.pool.get('ir.model.data').xmlid_to_object(cr, uid, 'mail_outgoing.group_all_emails', context=context)
  7. user = self.pool['res.users'].browse(cr, uid, uid, context)
  8. user_groups = set(user.groups_id)
  9. if user_groups.issuperset(group_all_emails):
  10. return
  11. return super(mail_message, self).check_access_rule(cr, uid, ids, operation, context)
  12. class mail_mail(osv.Model):
  13. _name = 'mail.mail'
  14. _inherit = ['mail.mail', 'ir.needaction_mixin']
  15. _needaction = True
  16. def _needaction_domain_get(self, cr, uid, context=None):
  17. return [('state', 'in', ['outgoing', 'exception'])]