-
Notifications
You must be signed in to change notification settings - Fork 31.1k
[FW][FIX] core : _name_search on fields with inconsistent types #190596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
fw-bot
wants to merge
1
commit into
odoo:18.0
from
odoo-dev:18.0-16.0-base_fix_currency_rate_name_search-lole-Wj6V-fw
Closed
[FW][FIX] core : _name_search on fields with inconsistent types #190596
fw-bot
wants to merge
1
commit into
odoo:18.0
from
odoo-dev:18.0-16.0-base_fix_currency_rate_name_search-lole-Wj6V-fw
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Contributor
Author
|
@loleloup @rco-odoo cherrypicking of pull request #187838 failed. stdout: Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?). In the former case, you may want to edit this PR message as well. |
fd595fd to
a38a743
Compare
Steps to reproduce the issue: - go to currencies; - search for a rate with something else than a date; - it crashes. This happens because the currency rate model is searched with two fields, a date field (name) and a float field (rate). This crashes when converting the value to match against, because the value cannot be serialized in SQL both as a date and a float. What we do in such a case is to explicitly convert the value to the field's type. If the conversion fails, we simply ignore that part of the domain. opw-4278234 X-original-commit: e1b02bb
a38a743 to
bae1ba9
Compare
Member
|
@robodoo r+ |
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Jan 24, 2025
Steps to reproduce the issue: - go to currencies; - search for a rate with something else than a date; - it crashes. This happens because the currency rate model is searched with two fields, a date field (name) and a float field (rate). This crashes when converting the value to match against, because the value cannot be serialized in SQL both as a date and a float. What we do in such a case is to explicitly convert the value to the field's type. If the conversion fails, we simply ignore that part of the domain. opw-4278234 closes odoo/odoo#190596 X-original-commit: e1b02bb2864b9a14bdc80b72aa6c2397047d6830 Signed-off-by: Raphael Collet <[email protected]>
d-fence
added a commit
to odoo-dev/odoo
that referenced
this pull request
Apr 11, 2025
Since babel 2.11 `babel.parse_date` handle ISO dates first. So before 2.11 the date "1971-01-01" was raising a `ValueError` which was ignored in the base model `_search_display_name`. It seems that the intention of odoo#190596 was to catch the value error when an invalid string is casted to float. The upcoming Debian Trixie provides Babel 2.17.0 which parses the date correctly and thus returns a `datetime.date` leading to a TypeError when trying the float conversion. See python-babel/babel#842. In order to have a coherent test in both versions, in this commit, the test is modified to use a valid date to parsable by both versions. Finally, a naive fix is done to catch the TypeError as well. It seems that the whole feature should be rewritten in master.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
conflict
There was an error while creating this forward-port PR
forwardport
This PR was created by @fw-bot
OE
the report is linked to a support ticket (opw-...)
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.

Steps to reproduce the issue:
This happens because the currency rate model is searched with two fields, a date field (
name) and a float field (rate). This crashes when converting the value to match against, because the value cannot be serialized in SQL both as a date and a float.What we do in such a case is to explicitly convert the value to the field's type. If the conversion fails, we simply ignore that part of the domain.
opw-4278234
Forward-Port-Of: #190495
Forward-Port-Of: #187838