Skip to content

Commit a07f409

Browse files
committed
[IMP] base: store explicit field.translate to database
before this commit: | field.translate in orm | ir_model_fields.translate in database | | ---------------------- | ------------------------------------- | | False | False | | True | True | | html_translate | True | | xml_translate | True | after this commit: | field.translate in orm | ir_model_fields.translate in database | | ---------------------- | ------------------------------------- | | False | NULL | | True | 'standard' | | html_translate | 'html_translate' | | xml_translate | 'xml_translate' | Related PRs: odoo/odoo#219406 odoo/enterprise#90413 odoo/upgrade#8085
1 parent 5d6a22e commit a07f409

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/util/records.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,8 +1219,12 @@ def add_ref(ref):
12191219
fields_with_values_from_xml |= {"arch_db", "name"}
12201220
else:
12211221
fields_with_values_from_xml = fields
1222+
if version_gte("saas~18.5"): # translate is varchar
1223+
sql_code = "SELECT name FROM ir_model_fields WHERE model = %s AND translate IS NOT NULL AND name IN %s"
1224+
else: # translate is boolean
1225+
sql_code = "SELECT name FROM ir_model_fields WHERE model = %s AND translate = true AND name IN %s"
12221226
cr.execute(
1223-
"SELECT name FROM ir_model_fields WHERE model = %s AND translate = true AND name IN %s",
1227+
sql_code,
12241228
[model, tuple(fields_with_values_from_xml)],
12251229
)
12261230
reset_translations = [fname for [fname] in cr.fetchall()]

0 commit comments

Comments
 (0)