Browse Source

Merge pull request #193 from Ommo73/12.0-mail_private-internal_users_checked

commit is created by 👷‍♂️ Merge Bot: https://odoo-devops.readthedocs.io/en/latest/git/github-merge-bot.html
pull/241/head
Mitchell Admin 5 years ago
committed by GitHub
parent
commit
3678cd3752
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      mail_multi_website/README.rst
  2. 2
      mail_multi_website/__manifest__.py
  3. 6
      mail_multi_website/doc/index.rst
  4. 3
      mail_multi_website/static/description/index.html
  5. 2
      mail_private/__manifest__.py
  6. 5
      mail_private/doc/changelog.rst
  7. 7
      mail_private/models.py
  8. 2
      mail_private/static/src/xml/mail_private.xml

6
mail_multi_website/README.rst

@ -2,9 +2,9 @@
:target: https://www.gnu.org/licenses/lgpl
:alt: License: LGPL-3
===========================================
Email Addresses and Templates per Website
===========================================
=====================
Multi-Brand Mailing
=====================
Mail-related stuff for multi-website support

2
mail_multi_website/__manifest__.py

@ -2,7 +2,7 @@
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": """Email Addresses and Templates per Website""",
"name": """Multi-Brand Mailing""",
"summary": """Use single Backend to manage several Websites""",
"category": "Discuss",
# "live_test_url": "http://apps.it-projects.info/shop/product/website-multi-company?version=11.0",

6
mail_multi_website/doc/index.rst

@ -1,6 +1,6 @@
===========================================
Email Addresses and Templates per Website
===========================================
=====================
Multi-Brand Mailing
=====================
Installation
============

3
mail_multi_website/static/description/index.html

@ -1,8 +1,7 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan" style="color:#875A7B;">Email Addresses and Templates per Website
</h2>
<h2 class="oe_slogan" style="color:#875A7B;">Multi-Brand Mailing</h2>
<h3 class="oe_slogan">Use single Backend to manage several Websites</h3>
</div>
</div>

2
mail_private/__manifest__.py

@ -7,7 +7,7 @@
"category": "Discuss",
# "live_test_url": "http://apps.it-projects.info/shop/product/DEMO-URL?version=12.0",
"images": [],
"version": "12.0.1.1.0",
"version": "12.0.1.1.1",
"application": False,
"author": "IT-Projects LLC, Pavel Romanchenko",

5
mail_private/doc/changelog.rst

@ -1,3 +1,8 @@
`1.1.1`
-------
- **Improvement:** refactoring code
`1.1.0`
-------

7
mail_private/models.py

@ -21,14 +21,13 @@ 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': 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,
@ -62,7 +61,3 @@ class MailMessage(models.Model):
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

2
mail_private/static/src/xml/mail_private.xml

@ -6,7 +6,7 @@
<t t-extend="mail.chatter.Buttons">
<t t-jquery="button[title='Send a message']" t-operation="after">
<button class="btn btn-link oe_compose_post_private" title="Send a message to specified recipients only">Send internal message</button>
<button t-if="newMessageButton" class="btn btn-link oe_compose_post_private" title="Send a message to specified recipients only">Send internal message</button>
</t>
</t>

Loading…
Cancel
Save