Skip to content
Snippets Groups Projects
Commit 532b1a50 authored by Thibault Delavallée's avatar Thibault Delavallée
Browse files

[FIX] portal, website_rating: re-allow rating from frontend

PURPOSE

Fix frontend rating and clean a bit module organization

SPECIFICATIONS

Broken since 3620cb68

LINKS

Task 2057301
PR #35870
parent 26b7b0e2
Branches
Tags
No related merge requests found
......@@ -85,6 +85,9 @@ def _message_post_helper(res_model, res_id, message, token='', _hash=False, pid=
class PortalChatter(http.Controller):
def _portal_post_filter_params(self):
return ['token', 'hash', 'pid']
@http.route(['/mail/chatter_post'], type='http', methods=['POST'], auth='public', website=True)
def portal_chatter_post(self, res_model, res_id, message, redirect=None, attachment_ids='', attachment_tokens='', **kw):
"""Create a new `mail.message` with the given `message` and/or
......@@ -112,16 +115,15 @@ class PortalChatter(http.Controller):
# message is received in plaintext and saved in html
if message:
message = plaintext2html(message)
message = _message_post_helper(
res_model=res_model,
res_id=res_id,
token=kw.get('token'),
_hash=kw.get('hash'),
pid=kw.get('pid'),
message=message,
send_after_commit=False,
attachment_ids=attachment_ids
)
post_values = {
'res_model': res_model,
'res_id': res_id,
'message': message,
'send_after_commit': False,
'attachment_ids': attachment_ids,
}
post_values.update((fname, kw.get(fname)) for fname in self._portal_post_filter_params())
message = _message_post_helper(**post_values)
return request.redirect(url)
......
......@@ -9,6 +9,11 @@ from odoo.addons.portal.controllers.mail import PortalChatter
class PortalChatter(PortalChatter):
def _portal_post_filter_params(self):
fields = super(PortalChatter, self)._portal_post_filter_params()
fields.append('rating_value')
return fields
@http.route()
def portal_chatter_init(self, res_model, res_id, domain=False, limit=False, **kwargs):
result = super(PortalChatter, self).portal_chatter_init(res_model, res_id, domain=domain, limit=limit, **kwargs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment