Browse Source

mail_private New: internal users are flagged automatically

pull/192/head
ommo73 6 years ago
parent
commit
71086ec744
No known key found for this signature in database GPG Key ID: E7E1F5C23505AFF8
  1. 2
      mail_private/__manifest__.py
  2. 5
      mail_private/doc/changelog.rst
  3. 7
      mail_private/models.py

2
mail_private/__manifest__.py

@ -3,7 +3,7 @@
"summary": """Send private messages to specified recipients, regardless of who are in followers list.""", "summary": """Send private messages to specified recipients, regardless of who are in followers list.""",
"category": "Discuss", "category": "Discuss",
"images": ['images/mail_private_image.png'], "images": ['images/mail_private_image.png'],
"version": "11.0.1.0.2",
"version": "11.0.1.1.0",
"application": False, "application": False,
"author": "IT-Projects LLC, Pavel Romanchenko", "author": "IT-Projects LLC, Pavel Romanchenko",

5
mail_private/doc/changelog.rst

@ -1,3 +1,8 @@
`1.1.0`
-------
- **New**: internal users are flagged automatically.
`1.0.2` `1.0.2`
------- -------

7
mail_private/models.py

@ -16,13 +16,14 @@ class MailMessage(models.Model):
result = [] result = []
default_resource = self.env[model].search(domain) default_resource = self.env[model].search(domain)
follower_ids = default_resource.message_follower_ids 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] 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] # channel_ids = [c.channel_id for c in follower_ids if c.channel_id]
for recipient in recipient_ids: for recipient in recipient_ids:
result.append({ result.append({
'checked': len(recipient.user_ids) > 0,
'checked': recipient.user_ids.id in internal_ids,
'partner_id': recipient.id, 'partner_id': recipient.id,
'full_name': recipient.name, 'full_name': recipient.name,
'name': recipient.name, 'name': recipient.name,
@ -106,3 +107,7 @@ class MailMessage(models.Model):
self.parent_id.invalidate_cache() self.parent_id.invalidate_cache()
return True return True
def get_internal_users_ids(self):
internal_users_ids = self.env['res.users'].search([('share', '=', False)]).ids
return internal_users_ids
Loading…
Cancel
Save