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

closes #46604

X-original-commit: ceee2c0
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
  • Loading branch information
seb-odoo committed Feb 28, 2020
1 parent 47605eb commit cce1c7f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion addons/mail/models/mail_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,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 cce1c7f

Please sign in to comment.