Fix a bug affecting validations of enum attributes

This fixes a bug where any enum attribute of a model
would be evaluated always as 0 when calling the
database on validations.

This fix overrides the read_attribute_for_validation
method for enum attributes to make it return the
integer representing the value rather than the
value itself.
Fixes #14172