diff options
| author | Jeremy Kersten <jke@odoo.com> | 2019-05-02 12:41:56 +0000 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2019-05-02 12:46:13 +0000 |
| commit | 9c1ad3604e2cc508f9c8fbda9aaf77b9a8fcb82c (patch) | |
| tree | b24b229581d4f1155fd01a9bc86ee729072f2931 | |
| parent | f0bc5e0b52710784e0aa49de15ced5e91a4a7145 (diff) | |
[FIX] website_forum: fix translation from faq
Since the refactoring of forum, faq sanitize is set to False.
The editor of the faq can make what he want...
But disable sanitize will break the translation since fields.py has code:
```python
def _setup_attrs(self, model, name):
super(Html, self)._setup_attrs(model, name)
# Translated sanitized html fields must use html_translate or a callable.
if self.translate is True and self.sanitize:
self.translate = html_translate
```
Now we don't become html_translate magically, but we need to specify it
in the field definition direclty.
Courtesy of @mart-e
This commit closes opw-1978662
closes odoo/odoo#33112
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
| -rw-r--r-- | addons/website_forum/models/forum.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py index ee9098dd614..26cf278bb80 100644 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@ -12,6 +12,7 @@ from werkzeug.exceptions import Forbidden from odoo import api, fields, models, tools, SUPERUSER_ID, _ from odoo.exceptions import UserError, ValidationError from odoo.tools import misc +from odoo.tools.translate import html_translate _logger = logging.getLogger(__name__) @@ -43,7 +44,7 @@ class Forum(models.Model): # description and use name = fields.Char('Forum Name', required=True, translate=True) active = fields.Boolean(default=True) - faq = fields.Html('Guidelines', default=_get_default_faq, translate=True, sanitize=False) + faq = fields.Html('Guidelines', default=_get_default_faq, translate=html_translate, sanitize=False) description = fields.Text( 'Description', translate=True, |
