Skip to content

Commit

Permalink
Merge pull request #349 from SDIsl/12.0-fix_website_published_messages
Browse files Browse the repository at this point in the history
[FIX] Publish customer messages on website
  • Loading branch information
valentincastravete authored Jul 3, 2024
2 parents 4c8524c + b330bda commit cac6032
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion mail_private_no_published/models/mail_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,21 @@ def create(self, vals):
continue

partner_ids = rec.partner_ids.ids
user_ids = self.env['res.users'].search([
user_ids = self.env['res.users'].sudo().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

author_id = rec.author_id
user = self.env['res.users'].sudo().search([
('partner_id', '=', author_id.id),
('active', 'in', [True, False]),
])
if not user or (user and not user.has_group('base.group_user')):
continue

rec.website_published = False
return res

0 comments on commit cac6032

Please sign in to comment.