[FIX] portal, website_mail: Wrong dependance
The field website_published is not ensured when module portal is installed because the module portal doesn't depend on module website_mail. PS:The module website_mail depends on the module portal because website_mail depends on website and website depends on portal. opw:1997478 closes odoo/odoo#33452 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
@@ -112,7 +112,7 @@ class PortalChatter(http.Controller):
|
||||
raise Forbidden()
|
||||
# Non-employee see only messages with not internal subtype (aka, no internal logs)
|
||||
if not request.env['res.users'].has_group('base.group_user'):
|
||||
domain = expression.AND([['&', '&', ('subtype_id', '!=', False), ('subtype_id.internal', '=', False), ('website_published', '=', True)], domain])
|
||||
domain = expression.AND([Message._non_employee_message_domain(), domain])
|
||||
Message = request.env['mail.message'].sudo()
|
||||
return {
|
||||
'messages': Message.search(domain, limit=limit, offset=offset).portal_message_format(),
|
||||
|
||||
@@ -21,3 +21,7 @@ class MailMessage(models.Model):
|
||||
message_tree = dict((m.id, m) for m in self.sudo())
|
||||
self._message_read_dict_postprocess(message_values, message_tree)
|
||||
return message_values
|
||||
|
||||
@api.model
|
||||
def _non_employee_message_domain(self):
|
||||
return ['&', ('subtype_id', '!=', False), ('subtype_id.internal', '=', False)]
|
||||
|
||||
@@ -26,6 +26,11 @@ class MailMessage(models.Model):
|
||||
description = fields.Char(compute="_compute_description", help='Message description: either the subject, or the beginning of the body')
|
||||
website_published = fields.Boolean(string='Published', help="Visible on the website as a comment", copy=False)
|
||||
|
||||
@api.model
|
||||
def _non_employee_message_domain(self):
|
||||
domain = super(MailMessage, self)._non_employee_message_domain()
|
||||
return expression.AND([domain, [('website_published', '=', True)]])
|
||||
|
||||
@api.multi
|
||||
def _compute_description(self):
|
||||
for message in self:
|
||||
|
||||
Reference in New Issue
Block a user