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.

15 lines
911 B

  1. from openerp import api, models, fields, SUPERUSER_ID
  2. class mail_message(models.Model):
  3. _inherit = 'mail.message'
  4. @api.cr_uid_context
  5. def message_read(self, cr, uid, ids=None, domain=None, message_unload_ids=None,
  6. thread_level=0, context=None, parent_id=False, limit=None):
  7. if context and context.get('default_model') == 'res.partner':
  8. partner = self.pool['res.partner'].browse(cr, uid, context.get('default_res_id'))
  9. domain_by_id = domain and len(domain) == 1 and domain[0][0] == 'id' and domain[0][1] == '='
  10. if partner.is_company and not domain_by_id:
  11. ids = None
  12. domain = [('model', '=', 'res.partner'), ('res_id', 'in', [partner.id]+partner.child_ids.ids)]
  13. return super(mail_message, self).message_read(cr, uid, ids, domain, message_unload_ids, thread_level, context, parent_id, limit)