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

12.0 #203164 website published messages #344

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
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
14 changes: 12 additions & 2 deletions mail_private_no_published/models/mail_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ def _check_archive(self):
def create(self, vals):
res = super().create(vals)
for rec in res:
if rec.subtype_id == self.env.ref('mail.mt_note'):
rec.website_published = False
if rec.subtype_id != self.env.ref('mail.mt_note'):
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
Loading