Skip to content

Commit

Permalink
[FIX] mail: allow to create channel with user in another company
Browse files Browse the repository at this point in the history
When there is no intersection between the allowed companies of the current user
and the target user, the `with_user` would lead to the company check always
failing.

opw-2197955
  • Loading branch information
seb-odoo committed Feb 28, 2020
1 parent ae78e9c commit 555b425
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion addons/mail/models/mail_channel.py
Expand Up @@ -470,7 +470,10 @@ def _channel_channel_notifications(self, partner_ids):
for partner in self.env['res.partner'].browse(partner_ids):
user_id = partner.user_ids and partner.user_ids[0] or False
if user_id:
for channel_info in self.with_user(user_id).channel_info():
user_channels = self.with_user(user_id).with_context(
allowed_company_ids=user_id.company_ids.ids
)
for channel_info in user_channels.channel_info():
notifications.append([(self._cr.dbname, 'res.partner', partner.id), channel_info])
return notifications

Expand Down

0 comments on commit 555b425

Please sign in to comment.