From 11b9767b3e594e490ffb925482df96c24f4cd9a5 Mon Sep 17 00:00:00 2001 From: "Simon Goffaux (sigo)" Date: Fri, 14 Jul 2023 14:42:56 +0000 Subject: [PATCH] [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#132691 X-original-commit: b7a538998cfbb2428e6575bbac892a9aff26f0c5 Signed-off-by: Simon Goffaux (sigo) Signed-off-by: Romain Derie (rde) --- addons/website/controllers/form.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/website/controllers/form.py b/addons/website/controllers/form.py index acdaf41d02d..085bef5c771 100644 --- a/addons/website/controllers/form.py +++ b/addons/website/controllers/form.py @@ -8,7 +8,7 @@ from markupsafe import Markup from psycopg2 import IntegrityError from werkzeug.exceptions import BadRequest -from odoo import http, SUPERUSER_ID, _ +from odoo import http, SUPERUSER_ID, _, _lt from odoo.addons.base.models.ir_qweb_fields import nl2br, nl2br_enclose from odoo.http import request from odoo.tools import plaintext2html @@ -88,7 +88,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 @@ -230,7 +230,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