Files
odoo_source/addons/website_livechat/models/im_livechat.py
T
qsm-odoo 7aa9f23955 [FIX] *: use html_translate for non-sanitized html fields
Commit c21568e14f deactivated the sanitization of frontend html fields so
that their modification through the editor worked again. However,
this broke the possibility to display their traduction and to modify
them.

The problem is that the translate option of html fields should not
equal "True" but instead be the html_translate function defined in
openerp.tool.translate. The translate=True option is automatically
change in html_translate though but there is a condition: the field
should be sanitized, which is why this broke since the sanitization
is disabled.

This commit sets the translate option of non-sanitized html fields
to html_translate. Maybe we should investigate for this to be automatic
for non-sanitized html fields as well.

Thanks to @rco-odoo.
2016-07-19 17:02:02 +02:00

21 lines
899 B
Python

# -*- coding: utf-8 -*-
from openerp import api, models, fields
from openerp.addons.website.models.website import slug
from openerp.tools.translate import html_translate
class ImLivechatChannel(models.Model):
_name = 'im_livechat.channel'
_inherit = ['im_livechat.channel', 'website.published.mixin']
@api.v7
# TODO : when mixin in new api.v8, change this !
def _website_url(self, cr, uid, ids, field_name, arg, context=None):
res = super(ImLivechatChannel, self)._website_url(cr, uid, ids, field_name, arg, context=context)
for channel in self.browse(cr, uid, ids, context=context):
res[channel.id] = "/livechat/channel/%s" % (slug(channel),)
return res
website_description = fields.Html("Website description", default=False, help="Description of the channel displayed on the website page", sanitize=False, translate=html_translate)