Skip to content

Commit

Permalink
[FIX] search_engine_image_thumbnail: fix the domain type for image fi…
Browse files Browse the repository at this point in the history
…elds filter
  • Loading branch information
kobros-tech committed Oct 8, 2024
1 parent 3f452b8 commit c44fb08
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions search_engine_image_thumbnail/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ Contributors
------------

- Laurent Mignon [email protected] (https://www.acsone.eu/)
- Mohamed Alkobrosli [email protected]
(https://www.kobros-tech.com/)

Other credits
-------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import json

from odoo import api, fields, models, tools
from odoo.osv.expression import FALSE_DOMAIN
Expand Down Expand Up @@ -107,7 +106,7 @@ def _compute_field_id_domain(self):
for field in domain_fields:
if self._is_field_valid_for_thumbnail(field):
names.append(field.name)
record.field_id_domain = json.dumps(
record.field_id_domain = (
[("name", "in", names), ("model_id", "=", record.model_id.id)]
if names
else FALSE_DOMAIN
Expand Down
1 change: 1 addition & 0 deletions search_engine_image_thumbnail/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- Laurent Mignon <[email protected]> (https://www.acsone.eu/)
- Mohamed Alkobrosli <[email protected]> (https://www.kobros-tech.com/)
13 changes: 9 additions & 4 deletions search_engine_image_thumbnail/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -597,6 +598,8 @@ <h2><a class="toc-backref" href="#toc-entry-11">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-12">Contributors</a></h2>
<ul class="simple">
<li>Laurent Mignon <a class="reference external" href="mailto:laurent.mignon&#64;acsone.eu">laurent.mignon&#64;acsone.eu</a> (<a class="reference external" href="https://www.acsone.eu/">https://www.acsone.eu/</a>)</li>
<li>Mohamed Alkobrosli <a class="reference external" href="mailto:alkobroslymohamed&#64;gmail.com">alkobroslymohamed&#64;gmail.com</a>
(<a class="reference external" href="https://www.kobros-tech.com/">https://www.kobros-tech.com/</a>)</li>
</ul>
</div>
<div class="section" id="other-credits">
Expand All @@ -607,7 +610,9 @@ <h2><a class="toc-backref" href="#toc-entry-13">Other credits</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-14">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def test_thumbnail_zise_field_domain(self):
)
field_id_domain = se_thumbnail_size.field_id_domain
self.assertEqual(
field_id_domain,
f'[["name", "in", ["image_ids"]], ["model_id", "=", {model_id}]]'.encode(),
f"{field_id_domain}",
f"[('name', 'in', ['image_ids']), ('model_id', '=', {model_id})]",
)

def test_multi_image_record_create_thumbnail(self):
Expand Down

0 comments on commit c44fb08

Please sign in to comment.