Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚡ mail_private New: internal users are flagged automatically #193

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions mail_private/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ def send_recepients_for_internal_message(self, model, domain):
result = []
default_resource = self.env[model].search(domain)
follower_ids = default_resource.message_follower_ids
internal_ids = self.get_internal_users_ids()

recipient_ids = [r.partner_id for r in follower_ids if r.partner_id]
# channel_ids = [c.channel_id for c in follower_ids if c.channel_id]

for recipient in recipient_ids:
result.append({
'checked': recipient.user_ids.id in internal_ids,
'checked': recipient.user_ids.id and not any(recipient.user_ids.mapped('share')),
'partner_id': recipient.id,
'full_name': recipient.name,
'name': recipient.name,
Expand Down Expand Up @@ -62,7 +61,3 @@ def _notify_compute_internal_recipients(self, record, msg_vals):
pids = [x[1] for x in msg_vals.get('partner_ids')] if 'partner_ids' in msg_vals else self.sudo().partner_ids.ids
recipient_data['partners'] = [i for i in recipient_data['partners'] if i['id'] in pids]
return recipient_data

def get_internal_users_ids(self):
internal_users_ids = self.env['res.users'].search([('share', '=', False)]).ids
return internal_users_ids