Skip to content
Permalink
Browse files

[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
  • Loading branch information...
simongoffin committed May 15, 2019
1 parent 9fe9715 commit f4768dbc3c2f49b17fab8bbc40859fffd2746092
@@ -137,7 +137,7 @@ def portal_message_fetch(self, res_model, res_id, domain=False, limit=10, offset
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 @@ def _portal_message_format(self, fields_list):
message_tree = dict((m.id, m) for m in self.sudo())
self._message_read_dict_postprocess(message_values, message_tree)
return message_values

@api.multi
def non_employee_message_domain(self):
return ['&', ('subtype_id', '!=', False), ('subtype_id.internal', '=', False)]
@@ -26,6 +26,10 @@ def default_get(self, fields_list):
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.multi
def non_employee_message_domain(self):
return ['&', '&', ('subtype_id', '!=', False), ('subtype_id.internal', '=', False), ('website_published', '=', True)]

@api.multi
def _compute_description(self):
for message in self:

0 comments on commit f4768db

Please sign in to comment.
You can’t perform that action at this time.