-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] shopinvader_search_engine_update*: Trigger update of SE indexes…
… on record update
- Loading branch information
Showing
90 changed files
with
1,076 additions
and
194 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/shopinvader_search_engine_update/odoo/addons/shopinvader_search_engine_update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../shopinvader_search_engine_update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
1 change: 1 addition & 0 deletions
1
...shopinvader_search_engine_update_image/odoo/addons/shopinvader_search_engine_update_image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../shopinvader_search_engine_update_image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
1 change: 1 addition & 0 deletions
1
...ch_engine_update_product_brand/odoo/addons/shopinvader_search_engine_update_product_brand
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../shopinvader_search_engine_update_product_brand |
6 changes: 6 additions & 0 deletions
6
setup/shopinvader_search_engine_update_product_brand/setup.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
1 change: 1 addition & 0 deletions
1
...date_product_brand_image/odoo/addons/shopinvader_search_engine_update_product_brand_image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../shopinvader_search_engine_update_product_brand_image |
6 changes: 6 additions & 0 deletions
6
setup/shopinvader_search_engine_update_product_brand_image/setup.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
1 change: 1 addition & 0 deletions
1
...e_update_product_brand_tag/odoo/addons/shopinvader_search_engine_update_product_brand_tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../shopinvader_search_engine_update_product_brand_tag |
6 changes: 6 additions & 0 deletions
6
setup/shopinvader_search_engine_update_product_brand_tag/setup.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
1 change: 1 addition & 0 deletions
1
...ch_engine_update_product_media/odoo/addons/shopinvader_search_engine_update_product_media
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../shopinvader_search_engine_update_product_media |
6 changes: 6 additions & 0 deletions
6
setup/shopinvader_search_engine_update_product_media/setup.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
shopinvader_search_engine_product_brand_image/tests/common.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Copyright 2023 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
import base64 | ||
|
||
from odoo.addons.shopinvader_search_engine_image.tests.common import ( | ||
TestSeMultiImageThumbnailCase, | ||
) | ||
|
||
|
||
class ProductBrandImageCase(TestSeMultiImageThumbnailCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.backend.image_data_url_strategy = "odoo" | ||
# create index for brands | ||
cls.brand_index = cls.env["se.index"].create( | ||
{ | ||
"name": "brand", | ||
"backend_id": cls.backend.id, | ||
"model_id": cls.env.ref("product_brand.model_product_brand").id, | ||
"serializer_type": "shopinvader_brand_exports", | ||
} | ||
) | ||
# create sizes for brands | ||
cls.env["se.image.field.thumbnail.size"].create( | ||
{ | ||
"model_id": cls.env.ref("product_brand.model_product_brand").id, | ||
"field_id": cls.env.ref( | ||
"fs_product_brand_multi_image.field_product_brand__image_ids" | ||
).id, | ||
"backend_id": cls.backend.id, | ||
"size_ids": [(6, 0, [cls.size_small.id, cls.size_medium.id])], | ||
} | ||
) | ||
cls.brand = cls.env["product.brand"].create( | ||
{ | ||
"name": "Test Brand", | ||
} | ||
) | ||
cls.brand_white_image = cls.env["fs.product.brand.image"].create( | ||
{ | ||
"sequence": 1, | ||
"brand_id": cls.brand.id, | ||
"specific_image": { | ||
"filename": "white.png", | ||
"content": base64.b64encode(cls.white_image), | ||
}, | ||
"tag_id": cls.tag1.id, | ||
} | ||
) | ||
cls.brand_black_image = cls.env["fs.product.brand.image"].create( | ||
{ | ||
"sequence": 2, | ||
"brand_id": cls.brand.id, | ||
"specific_image": { | ||
"filename": "black.png", | ||
"content": base64.b64encode(cls.black_image), | ||
}, | ||
"tag_id": cls.tag2.id, | ||
} | ||
) | ||
cls.brand_binding = cls.brand._add_to_index(cls.brand_index) | ||
|
||
def setUp(self): | ||
super().setUp() | ||
self.fs_storage = self.env["fs.storage"].create( | ||
{ | ||
"name": "Temp FS Storage", | ||
"protocol": "memory", | ||
"code": "mem_dir_brand", | ||
"directory_path": "/tmp/", | ||
"model_xmlids": "fs_product_brand_multi_image.model_fs_product_brand_image", | ||
"base_url": "https://media.alcyonbelux.be/", | ||
"is_directory_path_in_url": False, | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,81 +2,10 @@ | |
# @author Sébastien BEAU <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
import base64 | ||
from .common import ProductBrandImageCase | ||
|
||
from odoo.addons.shopinvader_search_engine_image.tests.common import ( | ||
TestSeMultiImageThumbnailCase, | ||
) | ||
|
||
|
||
class ProductBrandCase(TestSeMultiImageThumbnailCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.backend.image_data_url_strategy = "odoo" | ||
# create index for brands | ||
cls.brand_index = cls.env["se.index"].create( | ||
{ | ||
"name": "brand", | ||
"backend_id": cls.backend.id, | ||
"model_id": cls.env.ref("product_brand.model_product_brand").id, | ||
"serializer_type": "shopinvader_brand_exports", | ||
} | ||
) | ||
# create sizes for brands | ||
cls.env["se.image.field.thumbnail.size"].create( | ||
{ | ||
"model_id": cls.env.ref("product_brand.model_product_brand").id, | ||
"field_id": cls.env.ref( | ||
"fs_product_brand_multi_image.field_product_brand__image_ids" | ||
).id, | ||
"backend_id": cls.backend.id, | ||
"size_ids": [(6, 0, [cls.size_small.id, cls.size_medium.id])], | ||
} | ||
) | ||
cls.brand = cls.env["product.brand"].create( | ||
{ | ||
"name": "Test Brand", | ||
} | ||
) | ||
cls.brand_white_image = cls.env["fs.product.brand.image"].create( | ||
{ | ||
"sequence": 1, | ||
"brand_id": cls.brand.id, | ||
"specific_image": { | ||
"filename": "white.png", | ||
"content": base64.b64encode(cls.white_image), | ||
}, | ||
"tag_id": cls.tag1.id, | ||
} | ||
) | ||
cls.brand_black_image = cls.env["fs.product.brand.image"].create( | ||
{ | ||
"sequence": 2, | ||
"brand_id": cls.brand.id, | ||
"specific_image": { | ||
"filename": "black.png", | ||
"content": base64.b64encode(cls.black_image), | ||
}, | ||
"tag_id": cls.tag2.id, | ||
} | ||
) | ||
cls.brand_binding = cls.brand._add_to_index(cls.brand_index) | ||
|
||
def setUp(self): | ||
super().setUp() | ||
self.fs_storage = self.env["fs.storage"].create( | ||
{ | ||
"name": "Temp FS Storage", | ||
"protocol": "memory", | ||
"code": "mem_dir_brand", | ||
"directory_path": "/tmp/", | ||
"model_xmlids": "fs_product_brand_multi_image.model_fs_product_brand_image", | ||
"base_url": "https://media.alcyonbelux.be/", | ||
"is_directory_path_in_url": False, | ||
} | ||
) | ||
|
||
class TestBrand(ProductBrandImageCase): | ||
def test_basic_images_compute(self): | ||
brand = self.brand_binding._contextualize(self.brand_binding) | ||
data = self.brand_index.model_serializer.serialize(brand.record) | ||
|
Oops, something went wrong.