portal_rating/controllers/portal_chatter.py

22 lines
855 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import http
from odoo.http import request
from odoo.addons.portal.controllers import mail
class PortalChatter(mail.PortalChatter):
def _portal_post_filter_params(self):
fields = super(PortalChatter, self)._portal_post_filter_params()
fields += ['rating_value', 'rating_feedback']
return fields
@http.route()
def portal_chatter_post(self, res_model, res_id, message, attachment_ids='', attachment_tokens='', **kwargs):
if kwargs.get('rating_value'):
kwargs['rating_feedback'] = kwargs.pop('rating_feedback', message)
return super(PortalChatter, self).portal_chatter_post(res_model, res_id, message, attachment_ids=attachment_ids, attachment_tokens=attachment_tokens, **kwargs)