OCA / search-engine

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

[FIX] connector_algolia: Cast incoming objectID to int #120

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.