[FIX] core: allow uppercase characters in translatable fields

Identifiers (including column names) that are not double-quoted are folded to
lowercase in PostgreSQL. Before this commit, this resulted in errors when
updating translations for translatable fields, because the query did not
correctly quote all identifiers.

opw-3287428

closes odoo/odoo#125641

X-original-commit: 70ae8de223fc10f6e80dae06b0f6a6f15c198b5f
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
Signed-off-by: Tom De Caluwé (tdc) <tdc@odoo.com>
This commit is contained in:
Tom De Caluwé
2023-06-19 19:17:06 +02:00
committed by Julien Castiaux
parent 9d48733d19
commit 7f6924e8fd
+2 -2
View File
@@ -3251,8 +3251,8 @@ class BaseModel(metaclass=MetaModel):
else next((v for v in translations.values() if v is not None), None)
self.invalidate_recordset([field_name])
self._cr.execute(f'''
UPDATE {self._table}
SET {field_name} = NULLIF(
UPDATE "{self._table}"
SET "{field_name}" = NULLIF(
jsonb_strip_nulls(%s || COALESCE("{field_name}", '{{}}'::jsonb) || %s),
'{{}}'::jsonb)
WHERE id = %s