[FIX] fields: convert selection value to int

When a string value is assigned to a selection field expecting integers, the
value simply rejected.  In such a case, convert the value to an integer before
validating it.
This commit is contained in:
Raphael Collet
2018-05-14 12:08:59 +02:00
parent 8adb11a529
commit 7f27992998
+2
View File
@@ -1798,6 +1798,8 @@ class Selection(Field):
def convert_to_cache(self, value, record, validate=True):
if not validate:
return value or False
if value and self.column_type[0] == 'int4':
value = int(value)
if value in self.get_values(record.env):
return value
elif not value: