[FIX] website, test_website: prevent fuzzy search to crash with inherits
This commit ensures that when searching on a `inherits` field of a model (like `name` of `website.page`), it works properly when `pg_trgm` is activated. Indeed, `name` is a field of `website.page` record but only at the ORM level, not in SQL, due to how `inherits` works. So, when the `pg_trgm` extension is enabled, it will switch from ORM queries to raw SQL query (to use the native SQL similarity feature and not our custom python/orm one, as obviously the SQL one is better, more powerfull/accurate and faster). But this will actually make the code fail when searching on fields from a model which has `inherits` and that you search on that `inherits` model fields. Note that in 15.2, the `pg_trgm` extension is auto installed when possible thanks to [1] and [2]. [1]: https://github.com/odoo/odoo/commit/eedf37d6e286b995c47b946be1a6b66817094eff [2]: https://github.com/odoo/odoo/commit/75e6b645acdc95aece506ce0249fd0760838281c opw-3063592 closes odoo/odoo#106879 Signed-off-by:Quentin Smetz (qsm) <qsm@odoo.com>
Loading
Please register or sign in to comment