Skip to content
Snippets Groups Projects
Commit 8886d789 authored by Simon Goffaux (sigo)'s avatar Simon Goffaux (sigo)
Browse files

[FIX] website_form: fix translation issue in saas


In a SaaS server, the _meta_data variable will be translated when the
HTTP worker is spawned and it will be translated into whichever language
is set on the DB that spawns said worker. This causes issues when other
DBs use this worker as the variable may be translated into a language that is
not present in that DB. To rectify this issue, we use lazy translate so
the translation lookup is executed at rendering.

opw-3385997

closes odoo/odoo#132115

X-original-commit: a453a2d1
Signed-off-by: default avatarRomain Derie (rde) <rde@odoo.com>
Signed-off-by: default avatarSimon Goffaux (sigo) <sigo@odoo.com>
parent e3eb140f
Branches
Tags
No related merge requests found
......@@ -7,7 +7,7 @@ import json
from psycopg2 import IntegrityError
from werkzeug.exceptions import BadRequest
from odoo import http, SUPERUSER_ID, _
from odoo import http, SUPERUSER_ID, _, _lt
from odoo.http import request
from odoo.tools import plaintext2html
from odoo.exceptions import ValidationError, UserError
......@@ -87,7 +87,7 @@ class WebsiteForm(http.Controller):
# Constants string to make metadata readable on a text field
_meta_label = "%s\n________\n\n" % _("Metadata") # Title for meta data
_meta_label = _lt("Metadata") # Title for meta data
# Dict of dynamically called filters following type of field to be fault tolerent
......@@ -229,7 +229,7 @@ class WebsiteForm(http.Controller):
default_field_data = values.get(default_field.name, '')
custom_content = (default_field_data + "\n\n" if default_field_data else '') \
+ (_custom_label + custom + "\n\n" if custom else '') \
+ (self._meta_label + meta if meta else '')
+ (self._meta_label + "\n________\n\n" + meta if meta else '')
# If there is a default field configured for this model, use it.
# If there isn't, put the custom data in a message instead
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment