Browse Source
⚡ mail_private New: internal users are flagged automatically
pull/192/head
ommo73
6 years ago
No known key found for this signature in database
GPG Key ID: E7E1F5C23505AFF8
3 changed files with
12 additions and
2 deletions
-
mail_private/__manifest__.py
-
mail_private/doc/changelog.rst
-
mail_private/models.py
|
|
@ -3,7 +3,7 @@ |
|
|
|
"summary": """Send private messages to specified recipients, regardless of who are in followers list.""", |
|
|
|
"category": "Discuss", |
|
|
|
"images": ['images/mail_private_image.png'], |
|
|
|
"version": "11.0.1.0.2", |
|
|
|
"version": "11.0.1.1.0", |
|
|
|
"application": False, |
|
|
|
|
|
|
|
"author": "IT-Projects LLC, Pavel Romanchenko", |
|
|
|
|
|
@ -1,3 +1,8 @@ |
|
|
|
`1.1.0` |
|
|
|
------- |
|
|
|
|
|
|
|
- **New**: internal users are flagged automatically. |
|
|
|
|
|
|
|
`1.0.2` |
|
|
|
------- |
|
|
|
|
|
|
|
|
|
@ -16,13 +16,14 @@ class MailMessage(models.Model): |
|
|
|
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': len(recipient.user_ids) > 0, |
|
|
|
'checked': recipient.user_ids.id in internal_ids, |
|
|
|
'partner_id': recipient.id, |
|
|
|
'full_name': recipient.name, |
|
|
|
'name': recipient.name, |
|
|
@ -106,3 +107,7 @@ class MailMessage(models.Model): |
|
|
|
self.parent_id.invalidate_cache() |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
def get_internal_users_ids(self): |
|
|
|
internal_users_ids = self.env['res.users'].search([('share', '=', False)]).ids |
|
|
|
return internal_users_ids |