Repository: OCA/search-engine (language: python)

Issue:
[16.0] search_engine_image_thumbnail: New config param
* [ ] includes #174 

Add new config parameter on the search engine backend to allow the user to specify if the serialization of a record should fail if thumbnails are requested but no thumbnail sizes are defined for the model and field for which it' requested. Defaults to False (i.e. don't fail).


Discussion / hints:
@qgroulard @sbejaoui @sebastienbeau 
/ocabot merge patch
What a great day to merge this nice PR. Let's do it!
Prepared branch [16.0-ocabot-merge-pr-176-by-lmignon-bump-patch](https://github.com/OCA/search-engine/commits/16.0-ocabot-merge-pr-176-by-lmignon-bump-patch), awaiting test results.
@lmignon The merge process could not be finalized, because command `oca-gen-addon-readme --if-source-changed --org-name OCA --repo-name search-engine --branch 16.0 --addons-dir /tmp/tmpl8tgn5yz --commit` failed with output:
```
Both .md and .rst fragments found in /tmp/tmpl8tgn5yz/search_engine_image_thumbnail/readme. Please ensure the same format is used for all fragments.

```

Fix patch:
diff --git a/search_engine_image_thumbnail/models/se_image_field_thumbnail_size.py b/search_engine_image_thumbnail/models/se_image_field_thumbnail_size.py
index a7e5c216..1a23ef4e 100644
--- a/search_engine_image_thumbnail/models/se_image_field_thumbnail_size.py
+++ b/search_engine_image_thumbnail/models/se_image_field_thumbnail_size.py
@@ -5,8 +5,6 @@
 from odoo import api, fields, models, tools
 from odoo.osv.expression import FALSE_DOMAIN
 
-from odoo.addons.base_sparse_field.models.fields import Serialized
-
 
 class SeImageFieldThumbnailSize(models.Model):
 
@@ -46,7 +44,7 @@ class SeImageFieldThumbnailSize(models.Model):
         readonly=True,
         store=True,
     )
-    field_id_domain = Serialized(
+    field_id_domain = fields.Binary(
         string="Domain to select images field",
         compute="_compute_field_id_domain",
         readonly=True,


Test patch:
diff --git a/search_engine_image_thumbnail/tests/test_se_multi_image_thumbnail.py b/search_engine_image_thumbnail/tests/test_se_multi_image_thumbnail.py
index f616e448..c3c4a706 100644
--- a/search_engine_image_thumbnail/tests/test_se_multi_image_thumbnail.py
+++ b/search_engine_image_thumbnail/tests/test_se_multi_image_thumbnail.py
@@ -24,7 +24,7 @@ def test_thumbnail_zise_field_domain(self):
         field_id_domain = se_thumbnail_size.field_id_domain
         self.assertEqual(
             field_id_domain,
-            [["name", "in", ["image_ids"]], ["model_id", "=", model_id]],
+            f'[["name", "in", ["image_ids"]], ["model_id", "=", {model_id}]]'.encode(),
         )
 
     def test_multi_image_record_create_thumbnail(self):