[FIX] base: properly quote fields

Fields created with Studio are case-sensitive, so we need to properly
quote the query.

opw-2083852

closes odoo/odoo#38544

X-original-commit: 2c50b663c7656b49e06804f30c5dc6d0dcff1af4
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-10-11 21:47:53 +00:00
committed by fw-bot
parent 493f26bef9
commit 6677ea104a
+2 -2
View File
@@ -1119,7 +1119,7 @@ class IrModelSelection(models.Model):
continue
if selection.field_id.store:
# replace the value by the new one in the field's corresponding column
query = "UPDATE {table} SET {field}=%s WHERE {field}=%s".format(
query = 'UPDATE "{table}" SET "{field}"=%s WHERE "{field}"=%s'.format(
table=self.env[selection.field_id.model]._table,
field=selection.field_id.name,
)
@@ -1146,7 +1146,7 @@ class IrModelSelection(models.Model):
for selection in self:
if selection.field_id.store:
# replace the value by NULL in the field's corresponding column
query = "UPDATE {table} SET {field}=NULL WHERE {field}=%s".format(
query = 'UPDATE "{table}" SET "{field}"=NULL WHERE "{field}"=%s'.format(
table=self.env[selection.field_id.model]._table,
field=selection.field_id.name,
)