Skip to content

Commit

Permalink
Merge pull request #347 from SDIsl/12.0-#203164_website_published_mes…
Browse files Browse the repository at this point in the history
…sages

12.0 #203164 website published messages
  • Loading branch information
valentincastravete authored Jul 3, 2024
2 parents 5e71181 + fcbc0a2 commit 4c8524c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mail_private_no_published/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{
'name': 'Mail Private No Published',
'summary': 'All messages from the private channel will not be published.',
'author': 'Oscar Soto, SDi Soluciones Informáticas',
'author': 'Oscar Soto, Valentín Georgian Castravete, Sidoo',
'website': 'https://www.sdi.es/odoo-cloud/',
'license': 'AGPL-3',
'category': 'Portal',
Expand Down
11 changes: 11 additions & 0 deletions mail_private_no_published/models/mail_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,15 @@ def create(self, vals):
for rec in res:
if rec.subtype_id == self.env.ref('mail.mt_note'):
rec.website_published = False
continue

partner_ids = rec.partner_ids.ids
user_ids = self.env['res.users'].search([
('partner_id', 'in', partner_ids),
('active', 'in', [True, False]),
])
customer_users = user_ids.filtered(lambda user: user.has_group('base.group_portal'))
if customer_users or (partner_ids and not user_ids):
continue
rec.website_published = False
return res

0 comments on commit 4c8524c

Please sign in to comment.