OCA / search-engine

GNU Affero General Public License v3.0
46 stars 61 forks source link

[14.0][FIX] connector_algolia: Cast incoming objectID to int #121

Closed mmequignon closed 2 years ago

mmequignon commented 2 years ago

Algolia accepts both int and string as objectID, but will convert them to a string anyway as mentionned here. When retrieving algolia records, we were trying to browse odoo records from this objectID, which led to this kind of error:

Odoo Server Error
Traceback (most recent call last):
[...]
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
 File "/odoo/src/odoo/http.py", line 641, in _handle_exception
 return super(JsonRequest, self)._handle_exception(exception)
 File "/odoo/src/odoo/http.py", line 317, in _handle_exception
 raise exception.with_traceback(None) from new_cause
psycopg2.DataError: value "7960745000" is out of range for type integer
LINE 1: ...vader_variant" WHERE "shopinvader_variant".id IN ('796074500...
 ^

This PR ensures that this objectID is casted to an integer.

simahawk commented 2 years ago

pls rewrite the commit as this does not affect connector_algolia and then check the build :pray:

simahawk commented 2 years ago

@lmignon @hparfr should be fine for elastic search too, no?

lmignon commented 2 years ago

/ocabot merge minor

OCA-git-bot commented 2 years ago

On my way to merge this fine PR! Prepared branch 14.0-ocabot-merge-pr-121-by-lmignon-bump-minor, awaiting test results.

OCA-git-bot commented 2 years ago

@lmignon your merge command was aborted due to failed check(s), which you can inspect on this commit of 14.0-ocabot-merge-pr-121-by-lmignon-bump-minor.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

simahawk commented 2 years ago

/ocabot merge patch

OCA-git-bot commented 2 years ago

What a great day to merge this nice PR. Let's do it! Prepared branch 14.0-ocabot-merge-pr-121-by-simahawk-bump-patch, awaiting test results.

OCA-git-bot commented 2 years ago

Congratulations, your PR was merged at 9008a9ad1f47a457f59c6a3160309bb6ada3ade0. Thanks a lot for contributing to OCA. ❤️