[FIX] fields: add convert_to_cache method in id class in fields #162978
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This traceback occurs when the user tries to give a string as the default value through Studio.
To reproduce this issue:
studio
andinventory
modulestudio
modeshow invisible elements
fromviews
in the studio sidebarid
in form view and set the default value with anystring
Error:-
Because when the user gives a string as the default value
it tries to parse the field with the
convert_to_cache
method.But in our case the
ID
class does not have the methodconvert_to_cache
so it gives the parse value as it is.
This leads to the above traceback when the default value (string) tries to compare with integers.
odoo/odoo/addons/base/models/ir_default.py
Lines 73 to 82 in 871121a
sentry-5193548638