From 44c5935332de991925c3004fe20c85cf9e27cd15 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Mon, 16 Oct 2023 16:21:30 +0200 Subject: [PATCH] [ADD] shopinvader_search_engine_update*: Trigger update of SE indexes on record update --- .../addons/shopinvader_search_engine_update | 1 + .../shopinvader_search_engine_update/setup.py | 6 ++ .../shopinvader_search_engine_update_image | 1 + .../setup.py | 6 ++ ...invader_search_engine_update_product_brand | 1 + .../setup.py | 6 ++ ...r_search_engine_update_product_brand_image | 1 + .../setup.py | 6 ++ ...der_search_engine_update_product_brand_tag | 1 + .../setup.py | 6 ++ ...invader_search_engine_update_product_media | 1 + .../setup.py | 6 ++ shopinvader_search_engine/tests/common.py | 68 ++++++++++++++++ .../tests/test_category_binding.py | 43 ++-------- .../tests/test_product_binding.py | 34 +------- .../tests/common.py | 76 ++++++++++++++++++ .../tests/test_brand.py | 75 +---------------- .../tests/common.py | 55 +++++++++++++ .../test_shopinvader_search_engine_media.py | 56 +------------ shopinvader_search_engine_update/README.rst | 35 ++++++++ shopinvader_search_engine_update/__init__.py | 1 + .../__manifest__.py | 18 +++++ .../models/__init__.py | 4 + .../models/product_product.py | 13 +++ .../models/product_template.py | 16 ++++ .../models/se_indexable_record.py | 15 ++++ .../models/se_product_update_mixin.py | 37 +++++++++ .../readme/CONTEXT.md | 2 + .../readme/CONTRIBUTORS.md | 1 + .../readme/DESCRIPTION.md | 3 + .../static/description/icon.png | Bin 0 -> 9455 bytes .../tests/__init__.py | 1 + .../tests/common.py | 11 +++ .../tests/test_update.py | 14 ++++ .../README.rst | 35 ++++++++ .../__init__.py | 1 + .../__manifest__.py | 20 +++++ .../models/__init__.py | 1 + .../models/fs_product_image.py | 12 +++ .../readme/CONTEXT.md | 3 + .../readme/CONTRIBUTORS.md | 1 + .../readme/DESCRIPTION.md | 3 + .../static/description/icon.png | Bin 0 -> 9455 bytes .../tests/__init__.py | 1 + .../tests/test_update.py | 40 +++++++++ .../README.rst | 35 ++++++++ .../__init__.py | 1 + .../__manifest__.py | 19 +++++ .../models/__init__.py | 1 + .../models/product_brand.py | 21 +++++ .../readme/CONTEXT.md | 3 + .../readme/CONTRIBUTORS.md | 1 + .../readme/DESCRIPTION.md | 3 + .../static/description/icon.png | Bin 0 -> 9455 bytes .../tests/__init__.py | 1 + .../tests/common.py | 27 +++++++ .../tests/test_update.py | 20 +++++ .../README.rst | 35 ++++++++ .../__init__.py | 1 + .../__manifest__.py | 19 +++++ .../models/__init__.py | 1 + .../models/fs_product_brand_image.py | 35 ++++++++ .../readme/CONTEXT.md | 3 + .../readme/CONTRIBUTORS.md | 1 + .../readme/DESCRIPTION.md | 3 + .../static/description/icon.png | Bin 0 -> 9455 bytes .../tests/__init__.py | 1 + .../tests/test_update.py | 47 +++++++++++ .../README.rst | 35 ++++++++ .../__init__.py | 1 + .../__manifest__.py | 19 +++++ .../models/__init__.py | 1 + .../models/product_brand_tag.py | 24 ++++++ .../readme/CONTEXT.md | 3 + .../readme/CONTRIBUTORS.md | 1 + .../readme/DESCRIPTION.md | 4 + .../static/description/icon.png | Bin 0 -> 9455 bytes .../tests/__init__.py | 1 + .../tests/test_update.py | 45 +++++++++++ .../README.rst | 35 ++++++++ .../__init__.py | 1 + .../__manifest__.py | 19 +++++ .../models/__init__.py | 1 + .../models/fs_product_media.py | 12 +++ .../readme/CONTEXT.md | 3 + .../readme/CONTRIBUTORS.md | 1 + .../readme/DESCRIPTION.md | 3 + .../static/description/icon.png | Bin 0 -> 9455 bytes .../tests/__init__.py | 1 + .../tests/test_update.py | 45 +++++++++++ 90 files changed, 1076 insertions(+), 194 deletions(-) create mode 120000 setup/shopinvader_search_engine_update/odoo/addons/shopinvader_search_engine_update create mode 100644 setup/shopinvader_search_engine_update/setup.py create mode 120000 setup/shopinvader_search_engine_update_image/odoo/addons/shopinvader_search_engine_update_image create mode 100644 setup/shopinvader_search_engine_update_image/setup.py create mode 120000 setup/shopinvader_search_engine_update_product_brand/odoo/addons/shopinvader_search_engine_update_product_brand create mode 100644 setup/shopinvader_search_engine_update_product_brand/setup.py create mode 120000 setup/shopinvader_search_engine_update_product_brand_image/odoo/addons/shopinvader_search_engine_update_product_brand_image create mode 100644 setup/shopinvader_search_engine_update_product_brand_image/setup.py create mode 120000 setup/shopinvader_search_engine_update_product_brand_tag/odoo/addons/shopinvader_search_engine_update_product_brand_tag create mode 100644 setup/shopinvader_search_engine_update_product_brand_tag/setup.py create mode 120000 setup/shopinvader_search_engine_update_product_media/odoo/addons/shopinvader_search_engine_update_product_media create mode 100644 setup/shopinvader_search_engine_update_product_media/setup.py create mode 100644 shopinvader_search_engine_product_brand_image/tests/common.py create mode 100644 shopinvader_search_engine_product_media/tests/common.py create mode 100644 shopinvader_search_engine_update/README.rst create mode 100644 shopinvader_search_engine_update/__init__.py create mode 100644 shopinvader_search_engine_update/__manifest__.py create mode 100644 shopinvader_search_engine_update/models/__init__.py create mode 100644 shopinvader_search_engine_update/models/product_product.py create mode 100644 shopinvader_search_engine_update/models/product_template.py create mode 100644 shopinvader_search_engine_update/models/se_indexable_record.py create mode 100644 shopinvader_search_engine_update/models/se_product_update_mixin.py create mode 100644 shopinvader_search_engine_update/readme/CONTEXT.md create mode 100644 shopinvader_search_engine_update/readme/CONTRIBUTORS.md create mode 100644 shopinvader_search_engine_update/readme/DESCRIPTION.md create mode 100644 shopinvader_search_engine_update/static/description/icon.png create mode 100644 shopinvader_search_engine_update/tests/__init__.py create mode 100644 shopinvader_search_engine_update/tests/common.py create mode 100644 shopinvader_search_engine_update/tests/test_update.py create mode 100644 shopinvader_search_engine_update_image/README.rst create mode 100644 shopinvader_search_engine_update_image/__init__.py create mode 100644 shopinvader_search_engine_update_image/__manifest__.py create mode 100644 shopinvader_search_engine_update_image/models/__init__.py create mode 100644 shopinvader_search_engine_update_image/models/fs_product_image.py create mode 100644 shopinvader_search_engine_update_image/readme/CONTEXT.md create mode 100644 shopinvader_search_engine_update_image/readme/CONTRIBUTORS.md create mode 100644 shopinvader_search_engine_update_image/readme/DESCRIPTION.md create mode 100644 shopinvader_search_engine_update_image/static/description/icon.png create mode 100644 shopinvader_search_engine_update_image/tests/__init__.py create mode 100644 shopinvader_search_engine_update_image/tests/test_update.py create mode 100644 shopinvader_search_engine_update_product_brand/README.rst create mode 100644 shopinvader_search_engine_update_product_brand/__init__.py create mode 100644 shopinvader_search_engine_update_product_brand/__manifest__.py create mode 100644 shopinvader_search_engine_update_product_brand/models/__init__.py create mode 100644 shopinvader_search_engine_update_product_brand/models/product_brand.py create mode 100644 shopinvader_search_engine_update_product_brand/readme/CONTEXT.md create mode 100644 shopinvader_search_engine_update_product_brand/readme/CONTRIBUTORS.md create mode 100644 shopinvader_search_engine_update_product_brand/readme/DESCRIPTION.md create mode 100644 shopinvader_search_engine_update_product_brand/static/description/icon.png create mode 100644 shopinvader_search_engine_update_product_brand/tests/__init__.py create mode 100644 shopinvader_search_engine_update_product_brand/tests/common.py create mode 100644 shopinvader_search_engine_update_product_brand/tests/test_update.py create mode 100644 shopinvader_search_engine_update_product_brand_image/README.rst create mode 100644 shopinvader_search_engine_update_product_brand_image/__init__.py create mode 100644 shopinvader_search_engine_update_product_brand_image/__manifest__.py create mode 100644 shopinvader_search_engine_update_product_brand_image/models/__init__.py create mode 100644 shopinvader_search_engine_update_product_brand_image/models/fs_product_brand_image.py create mode 100644 shopinvader_search_engine_update_product_brand_image/readme/CONTEXT.md create mode 100644 shopinvader_search_engine_update_product_brand_image/readme/CONTRIBUTORS.md create mode 100644 shopinvader_search_engine_update_product_brand_image/readme/DESCRIPTION.md create mode 100644 shopinvader_search_engine_update_product_brand_image/static/description/icon.png create mode 100644 shopinvader_search_engine_update_product_brand_image/tests/__init__.py create mode 100644 shopinvader_search_engine_update_product_brand_image/tests/test_update.py create mode 100644 shopinvader_search_engine_update_product_brand_tag/README.rst create mode 100644 shopinvader_search_engine_update_product_brand_tag/__init__.py create mode 100644 shopinvader_search_engine_update_product_brand_tag/__manifest__.py create mode 100644 shopinvader_search_engine_update_product_brand_tag/models/__init__.py create mode 100644 shopinvader_search_engine_update_product_brand_tag/models/product_brand_tag.py create mode 100644 shopinvader_search_engine_update_product_brand_tag/readme/CONTEXT.md create mode 100644 shopinvader_search_engine_update_product_brand_tag/readme/CONTRIBUTORS.md create mode 100644 shopinvader_search_engine_update_product_brand_tag/readme/DESCRIPTION.md create mode 100644 shopinvader_search_engine_update_product_brand_tag/static/description/icon.png create mode 100644 shopinvader_search_engine_update_product_brand_tag/tests/__init__.py create mode 100644 shopinvader_search_engine_update_product_brand_tag/tests/test_update.py create mode 100644 shopinvader_search_engine_update_product_media/README.rst create mode 100644 shopinvader_search_engine_update_product_media/__init__.py create mode 100644 shopinvader_search_engine_update_product_media/__manifest__.py create mode 100644 shopinvader_search_engine_update_product_media/models/__init__.py create mode 100644 shopinvader_search_engine_update_product_media/models/fs_product_media.py create mode 100644 shopinvader_search_engine_update_product_media/readme/CONTEXT.md create mode 100644 shopinvader_search_engine_update_product_media/readme/CONTRIBUTORS.md create mode 100644 shopinvader_search_engine_update_product_media/readme/DESCRIPTION.md create mode 100644 shopinvader_search_engine_update_product_media/static/description/icon.png create mode 100644 shopinvader_search_engine_update_product_media/tests/__init__.py create mode 100644 shopinvader_search_engine_update_product_media/tests/test_update.py diff --git a/setup/shopinvader_search_engine_update/odoo/addons/shopinvader_search_engine_update b/setup/shopinvader_search_engine_update/odoo/addons/shopinvader_search_engine_update new file mode 120000 index 0000000000..bd774115c5 --- /dev/null +++ b/setup/shopinvader_search_engine_update/odoo/addons/shopinvader_search_engine_update @@ -0,0 +1 @@ +../../../../shopinvader_search_engine_update \ No newline at end of file diff --git a/setup/shopinvader_search_engine_update/setup.py b/setup/shopinvader_search_engine_update/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/shopinvader_search_engine_update/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/shopinvader_search_engine_update_image/odoo/addons/shopinvader_search_engine_update_image b/setup/shopinvader_search_engine_update_image/odoo/addons/shopinvader_search_engine_update_image new file mode 120000 index 0000000000..e823e710c6 --- /dev/null +++ b/setup/shopinvader_search_engine_update_image/odoo/addons/shopinvader_search_engine_update_image @@ -0,0 +1 @@ +../../../../shopinvader_search_engine_update_image \ No newline at end of file diff --git a/setup/shopinvader_search_engine_update_image/setup.py b/setup/shopinvader_search_engine_update_image/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/shopinvader_search_engine_update_image/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/shopinvader_search_engine_update_product_brand/odoo/addons/shopinvader_search_engine_update_product_brand b/setup/shopinvader_search_engine_update_product_brand/odoo/addons/shopinvader_search_engine_update_product_brand new file mode 120000 index 0000000000..fa1fd3d4f5 --- /dev/null +++ b/setup/shopinvader_search_engine_update_product_brand/odoo/addons/shopinvader_search_engine_update_product_brand @@ -0,0 +1 @@ +../../../../shopinvader_search_engine_update_product_brand \ No newline at end of file diff --git a/setup/shopinvader_search_engine_update_product_brand/setup.py b/setup/shopinvader_search_engine_update_product_brand/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/shopinvader_search_engine_update_product_brand/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/shopinvader_search_engine_update_product_brand_image/odoo/addons/shopinvader_search_engine_update_product_brand_image b/setup/shopinvader_search_engine_update_product_brand_image/odoo/addons/shopinvader_search_engine_update_product_brand_image new file mode 120000 index 0000000000..93ae7fdcd3 --- /dev/null +++ b/setup/shopinvader_search_engine_update_product_brand_image/odoo/addons/shopinvader_search_engine_update_product_brand_image @@ -0,0 +1 @@ +../../../../shopinvader_search_engine_update_product_brand_image \ No newline at end of file diff --git a/setup/shopinvader_search_engine_update_product_brand_image/setup.py b/setup/shopinvader_search_engine_update_product_brand_image/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/shopinvader_search_engine_update_product_brand_image/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/shopinvader_search_engine_update_product_brand_tag/odoo/addons/shopinvader_search_engine_update_product_brand_tag b/setup/shopinvader_search_engine_update_product_brand_tag/odoo/addons/shopinvader_search_engine_update_product_brand_tag new file mode 120000 index 0000000000..21ec028012 --- /dev/null +++ b/setup/shopinvader_search_engine_update_product_brand_tag/odoo/addons/shopinvader_search_engine_update_product_brand_tag @@ -0,0 +1 @@ +../../../../shopinvader_search_engine_update_product_brand_tag \ No newline at end of file diff --git a/setup/shopinvader_search_engine_update_product_brand_tag/setup.py b/setup/shopinvader_search_engine_update_product_brand_tag/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/shopinvader_search_engine_update_product_brand_tag/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/shopinvader_search_engine_update_product_media/odoo/addons/shopinvader_search_engine_update_product_media b/setup/shopinvader_search_engine_update_product_media/odoo/addons/shopinvader_search_engine_update_product_media new file mode 120000 index 0000000000..4076734c7c --- /dev/null +++ b/setup/shopinvader_search_engine_update_product_media/odoo/addons/shopinvader_search_engine_update_product_media @@ -0,0 +1 @@ +../../../../shopinvader_search_engine_update_product_media \ No newline at end of file diff --git a/setup/shopinvader_search_engine_update_product_media/setup.py b/setup/shopinvader_search_engine_update_product_media/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/shopinvader_search_engine_update_product_media/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/shopinvader_search_engine/tests/common.py b/shopinvader_search_engine/tests/common.py index f32b600549..c09bda6738 100644 --- a/shopinvader_search_engine/tests/common.py +++ b/shopinvader_search_engine/tests/common.py @@ -36,3 +36,71 @@ def tearDownClass(cls): cls.loader.restore_registry() cls.reset_extendable_registry() super().tearDownClass() + + +class TestCategoryBindingBase(TestBindingIndexBase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.setup_records() + + @classmethod + def _prepare_index_values(cls, backend=None): + backend = backend or cls.backend + return { + "name": "Category Index", + "backend_id": backend.id, + "model_id": cls.env["ir.model"] + .search([("model", "=", "product.category")], limit=1) + .id, + "lang_id": cls.env.ref("base.lang_en").id, + "serializer_type": "shopinvader_category_exports", + } + + @classmethod + def setup_records(cls, backend=None): + backend = backend or cls.backend + # create an index for category model + cls.se_index = cls.se_index_model.create(cls._prepare_index_values(backend)) + # create a binding + category alltogether + cls.category = cls.env["product.category"].create({"name": "Test category"}) + cls.category_binding = cls.category._add_to_index(cls.se_index) + + +class TestProductBindingMixin: + @classmethod + def _prepare_index_values(cls, tst_cls, backend=None): + backend = backend or tst_cls.backend + return { + "name": "Product Index", + "backend_id": backend.id, + "model_id": tst_cls.env["ir.model"] + .search([("model", "=", "product.product")], limit=1) + .id, + "lang_id": tst_cls.env.ref("base.lang_en").id, + "serializer_type": "shopinvader_product_exports", + } + + @classmethod + def setup_records(cls, tst_cls, backend=None): + backend = backend or tst_cls.backend + # create an index for product model + tst_cls.se_index = tst_cls.env["se.index"].create( + cls._prepare_index_values(tst_cls, backend) + ) + # create a binding + product alltogether + tst_cls.product = tst_cls.env.ref( + "shopinvader_product.product_product_chair_vortex_white" + ) + tst_cls.product_binding = tst_cls.product._add_to_index(tst_cls.se_index) + tst_cls.product_expected = { + "id": tst_cls.product.id, + "name": tst_cls.product.name, + } + + +class TestProductBindingBase(TestBindingIndexBase, TestProductBindingMixin): + @classmethod + def setUpClass(cls): + super().setUpClass() + TestProductBindingMixin.setup_records(cls) diff --git a/shopinvader_search_engine/tests/test_category_binding.py b/shopinvader_search_engine/tests/test_category_binding.py index a92fb89567..f8d2d9870b 100644 --- a/shopinvader_search_engine/tests/test_category_binding.py +++ b/shopinvader_search_engine/tests/test_category_binding.py @@ -1,36 +1,16 @@ # Copyright 2023 ACSONE SA/NV # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from .common import TestBindingIndexBase +from .common import TestCategoryBindingBase -class TestCategoryBinding(TestBindingIndexBase): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.setup_records() - - @classmethod - def _prepare_index_values(cls, backend=None): - backend = backend or cls.backend - return { - "name": "Category Index", - "backend_id": backend.id, - "model_id": cls.env["ir.model"] - .search([("model", "=", "product.category")], limit=1) - .id, - "lang_id": cls.env.ref("base.lang_en").id, - "serializer_type": "shopinvader_category_exports", - } - - @classmethod - def setup_records(cls, backend=None): - backend = backend or cls.backend - # create an index for category model - cls.se_index = cls.se_index_model.create(cls._prepare_index_values(backend)) - # create a binding + category alltogether - cls.category = cls.env["product.category"].create({"name": "Test category"}) - cls.category_binding = cls.category._add_to_index(cls.se_index) +class TestCategoryBinding(TestCategoryBindingBase): + def _create_parent_category(self): + parent_category = self.env["product.category"].create( + {"name": "Parent category"} + ) + self.category.parent_id = parent_category + return parent_category def test_serialize(self): self.category_binding.recompute_json() @@ -39,13 +19,6 @@ def test_serialize(self): self.assertEqual(data["name"], self.category.name) self.assertEqual(data["level"], 0) - def _create_parent_category(self): - parent_category = self.env["product.category"].create( - {"name": "Parent category"} - ) - self.category.parent_id = parent_category - return parent_category - def test_serialize_hierarchy_parent_not_in_index(self): self._create_parent_category() self.category_binding.with_context(index=self.se_index).recompute_json() diff --git a/shopinvader_search_engine/tests/test_product_binding.py b/shopinvader_search_engine/tests/test_product_binding.py index 92949c213b..17d3246ad5 100644 --- a/shopinvader_search_engine/tests/test_product_binding.py +++ b/shopinvader_search_engine/tests/test_product_binding.py @@ -1,40 +1,10 @@ # Copyright 2023 ACSONE SA/NV # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from .common import TestBindingIndexBase +from .common import TestProductBindingBase -class TestProductBinding(TestBindingIndexBase): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.setup_records() - - @classmethod - def _prepare_index_values(cls, backend=None): - backend = backend or cls.backend - return { - "name": "Product Index", - "backend_id": backend.id, - "model_id": cls.env["ir.model"] - .search([("model", "=", "product.product")], limit=1) - .id, - "lang_id": cls.env.ref("base.lang_en").id, - "serializer_type": "shopinvader_product_exports", - } - - @classmethod - def setup_records(cls, backend=None): - backend = backend or cls.backend - # create an index for product model - cls.se_index = cls.se_index_model.create(cls._prepare_index_values(backend)) - # create a binding + product alltogether - cls.product = cls.env.ref( - "shopinvader_product.product_product_chair_vortex_white" - ) - cls.product_binding = cls.product._add_to_index(cls.se_index) - cls.product_expected = {"id": cls.product.id, "name": cls.product.name} - +class TestProductBinding(TestProductBindingBase): def test_serialize(self): self.product_binding.recompute_json() data = self.product_binding.data diff --git a/shopinvader_search_engine_product_brand_image/tests/common.py b/shopinvader_search_engine_product_brand_image/tests/common.py new file mode 100644 index 0000000000..613211b185 --- /dev/null +++ b/shopinvader_search_engine_product_brand_image/tests/common.py @@ -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, + } + ) diff --git a/shopinvader_search_engine_product_brand_image/tests/test_brand.py b/shopinvader_search_engine_product_brand_image/tests/test_brand.py index 4c3e969d90..93ef1d0010 100644 --- a/shopinvader_search_engine_product_brand_image/tests/test_brand.py +++ b/shopinvader_search_engine_product_brand_image/tests/test_brand.py @@ -2,81 +2,10 @@ # @author Sébastien BEAU # 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) diff --git a/shopinvader_search_engine_product_media/tests/common.py b/shopinvader_search_engine_product_media/tests/common.py new file mode 100644 index 0000000000..0c2a18573e --- /dev/null +++ b/shopinvader_search_engine_product_media/tests/common.py @@ -0,0 +1,55 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo_test_helper import FakeModelLoader + +from odoo.addons.connector_search_engine.tests.common import TestSeBackendCaseBase +from odoo.addons.extendable.tests.common import ExtendableMixin +from odoo.addons.fs_product_multi_media.tests.test_fs_product_multi_media import ( + TestFsProductMultiMedia, +) + + +class ProductMediaCase(TestFsProductMultiMedia, TestSeBackendCaseBase, ExtendableMixin): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.init_extendable_registry() + cls.loader = FakeModelLoader(cls.env, cls.__module__) + cls.loader.backup_registry() + from odoo.addons.connector_search_engine.tests.models import SeBackend, SeIndex + + cls.loader.update_registry( + ( + SeIndex, + SeBackend, + ) + ) + cls.backend = cls.env["se.backend"].create( + {"name": "Fake SE", "tech_name": "fake_se", "backend_type": "fake"} + ) + cls.product_index = cls.env["se.index"].create( + { + "name": "product", + "backend_id": cls.backend.id, + "model_id": cls.env.ref("product.model_product_product").id, + "serializer_type": "shopinvader_product_exports", + } + ) + cls.product_binding = cls.product_a._add_to_index(cls.product_index) + + @classmethod + def tearDownClass(cls): + cls.loader.restore_registry() + cls.reset_extendable_registry() + super().tearDownClass() + + def _default_media(self, media): + return { + "name": media.media_id.name, + "url": media.media_id.file.internal_url, + "type": { + "name": media.media_id.media_type_id.name, + "code": media.media_id.media_type_id.code, + }, + "sequence": media.sequence, + } diff --git a/shopinvader_search_engine_product_media/tests/test_shopinvader_search_engine_media.py b/shopinvader_search_engine_product_media/tests/test_shopinvader_search_engine_media.py index 4c3639b946..09590acbde 100644 --- a/shopinvader_search_engine_product_media/tests/test_shopinvader_search_engine_media.py +++ b/shopinvader_search_engine_product_media/tests/test_shopinvader_search_engine_media.py @@ -1,61 +1,9 @@ # Copyright 2023 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo_test_helper import FakeModelLoader +from .common import ProductMediaCase -from odoo.addons.connector_search_engine.tests.common import TestSeBackendCaseBase -from odoo.addons.extendable.tests.common import ExtendableMixin -from odoo.addons.fs_product_multi_media.tests.test_fs_product_multi_media import ( - TestFsProductMultiMedia, -) - - -class TestShopinvaderSearchEngineMedia( - TestFsProductMultiMedia, TestSeBackendCaseBase, ExtendableMixin -): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.init_extendable_registry() - cls.loader = FakeModelLoader(cls.env, cls.__module__) - cls.loader.backup_registry() - from odoo.addons.connector_search_engine.tests.models import SeBackend, SeIndex - - cls.loader.update_registry( - ( - SeIndex, - SeBackend, - ) - ) - cls.backend = cls.env["se.backend"].create( - {"name": "Fake SE", "tech_name": "fake_se", "backend_type": "fake"} - ) - cls.product_index = cls.env["se.index"].create( - { - "name": "product", - "backend_id": cls.backend.id, - "model_id": cls.env.ref("product.model_product_product").id, - "serializer_type": "shopinvader_product_exports", - } - ) - cls.product_binding = cls.product_a._add_to_index(cls.product_index) - - @classmethod - def tearDownClass(cls): - cls.loader.restore_registry() - cls.reset_extendable_registry() - super().tearDownClass() - - def _default_media(self, media): - return { - "name": media.media_id.name, - "url": media.media_id.file.internal_url, - "type": { - "name": media.media_id.media_type_id.name, - "code": media.media_id.media_type_id.code, - }, - "sequence": media.sequence, - } +class TestShopinvaderSearchEngineMedia(ProductMediaCase): def test_product_media(self): self.backend.media_data_url_strategy = "odoo" product = self.product_binding._contextualize(self.product_binding) diff --git a/shopinvader_search_engine_update/README.rst b/shopinvader_search_engine_update/README.rst new file mode 100644 index 0000000000..38929e8775 --- /dev/null +++ b/shopinvader_search_engine_update/README.rst @@ -0,0 +1,35 @@ +**This file is going to be generated by oca-gen-addon-readme.** + +*Manual changes will be overwritten.* + +Please provide content in the ``readme`` directory: + +* **DESCRIPTION.rst** (required) +* INSTALL.rst (optional) +* CONFIGURE.rst (optional) +* **USAGE.rst** (optional, highly recommended) +* DEVELOP.rst (optional) +* ROADMAP.rst (optional) +* HISTORY.rst (optional, recommended) +* **CONTRIBUTORS.rst** (optional, highly recommended) +* CREDITS.rst (optional) + +Content of this README will also be drawn from the addon manifest, +from keys such as name, authors, maintainers, development_status, +and license. + +A good, one sentence summary in the manifest is also highly recommended. + + +Automatic changelog generation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`HISTORY.rst` can be auto generated using `towncrier `_. + +Just put towncrier compatible changelog fragments into `readme/newsfragments` +and the changelog file will be automatically generated and updated when a new fragment is added. + +Please refer to `towncrier` documentation to know more. + +NOTE: the changelog will be automatically generated when using `/ocabot merge $option`. +If you need to run it manually, refer to `OCA/maintainer-tools README `_. diff --git a/shopinvader_search_engine_update/__init__.py b/shopinvader_search_engine_update/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/shopinvader_search_engine_update/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/shopinvader_search_engine_update/__manifest__.py b/shopinvader_search_engine_update/__manifest__.py new file mode 100644 index 0000000000..5502b9e4f3 --- /dev/null +++ b/shopinvader_search_engine_update/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Shopinvader Search Engine Update", + "summary": """ + Shopinvader: Mark product binding to export on product update""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/shopinvader/odoo-shopinvader", + "depends": [ + "shopinvader_search_engine", + ], + "data": [], + "demo": [], + "development_status": "Alpha", +} diff --git a/shopinvader_search_engine_update/models/__init__.py b/shopinvader_search_engine_update/models/__init__.py new file mode 100644 index 0000000000..8b215bebbc --- /dev/null +++ b/shopinvader_search_engine_update/models/__init__.py @@ -0,0 +1,4 @@ +from . import product_product +from . import product_template +from . import se_indexable_record +from . import se_product_update_mixin diff --git a/shopinvader_search_engine_update/models/product_product.py b/shopinvader_search_engine_update/models/product_product.py new file mode 100644 index 0000000000..fb54854f82 --- /dev/null +++ b/shopinvader_search_engine_update/models/product_product.py @@ -0,0 +1,13 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class ProductProduct(models.Model): + _inherit = "product.product" + + def write(self, vals): + res = super(ProductProduct, self).write(vals) + self.shopinvader_mark_to_update() + return res diff --git a/shopinvader_search_engine_update/models/product_template.py b/shopinvader_search_engine_update/models/product_template.py new file mode 100644 index 0000000000..0d9b1fe7a8 --- /dev/null +++ b/shopinvader_search_engine_update/models/product_template.py @@ -0,0 +1,16 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + def write(self, vals): + res = super(ProductTemplate, self).write(vals) + self.mapped("product_variant_ids").shopinvader_mark_to_update() + return res + + def shopinvader_mark_to_update(self): + self.mapped("product_variant_ids").shopinvader_mark_to_update() diff --git a/shopinvader_search_engine_update/models/se_indexable_record.py b/shopinvader_search_engine_update/models/se_indexable_record.py new file mode 100644 index 0000000000..9f1867919c --- /dev/null +++ b/shopinvader_search_engine_update/models/se_indexable_record.py @@ -0,0 +1,15 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import models + + +class SeIndexableRecord(models.AbstractModel): + + _inherit = "se.indexable.record" + + def shopinvader_mark_to_update(self): + """This method is called in the context of shopinvader to mark a binding + linked to this record to be updated in the search engine. + + """ + self.sudo()._se_mark_to_update() diff --git a/shopinvader_search_engine_update/models/se_product_update_mixin.py b/shopinvader_search_engine_update/models/se_product_update_mixin.py new file mode 100644 index 0000000000..5990f3b25a --- /dev/null +++ b/shopinvader_search_engine_update/models/se_product_update_mixin.py @@ -0,0 +1,37 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import api, models + + +class SEProductUpdateMixin(models.AbstractModel): + _name = "se.product.update.mixin" + _description = "Search Engine Product Update Mixin" + + @api.model_create_multi + def create(self, vals_list): + res = super(SEProductUpdateMixin, self).create(vals_list) + res.get_products().shopinvader_mark_to_update() + return res + + def write(self, vals): + needs_update = self.needs_product_update(vals) + if needs_update: + products = self.get_products() + res = super(SEProductUpdateMixin, self).write(vals) + if needs_update: + (products | self.get_products()).shopinvader_mark_to_update() + return res + + def unlink(self): + products = self.get_products() + res = super(SEProductUpdateMixin, self).unlink() + products.shopinvader_mark_to_update() + return res + + def get_products(self): + raise NotImplementedError + + def needs_product_update(self, vals): + return True diff --git a/shopinvader_search_engine_update/readme/CONTEXT.md b/shopinvader_search_engine_update/readme/CONTEXT.md new file mode 100644 index 0000000000..16a365dc96 --- /dev/null +++ b/shopinvader_search_engine_update/readme/CONTEXT.md @@ -0,0 +1,2 @@ +When you update your product data and this information is exposed by the search engine, +you expect to see your changes applied into the search engine as soon as possible. diff --git a/shopinvader_search_engine_update/readme/CONTRIBUTORS.md b/shopinvader_search_engine_update/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..a15e3ef244 --- /dev/null +++ b/shopinvader_search_engine_update/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Laurent Mignon (https://www.acsone.eu) diff --git a/shopinvader_search_engine_update/readme/DESCRIPTION.md b/shopinvader_search_engine_update/readme/DESCRIPTION.md new file mode 100644 index 0000000000..3fbc0c4e00 --- /dev/null +++ b/shopinvader_search_engine_update/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module extends the functionality of the `shopinvader_search_engine` to mark the +information exported to the search engine as to be recomputed when the product data are +updated. diff --git a/shopinvader_search_engine_update/static/description/icon.png b/shopinvader_search_engine_update/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkB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c4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/shopinvader_search_engine_update/tests/__init__.py b/shopinvader_search_engine_update/tests/__init__.py new file mode 100644 index 0000000000..1693032ed6 --- /dev/null +++ b/shopinvader_search_engine_update/tests/__init__.py @@ -0,0 +1 @@ +from . import test_update diff --git a/shopinvader_search_engine_update/tests/common.py b/shopinvader_search_engine_update/tests/common.py new file mode 100644 index 0000000000..f4d99becfe --- /dev/null +++ b/shopinvader_search_engine_update/tests/common.py @@ -0,0 +1,11 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.addons.shopinvader_search_engine.tests.common import TestProductBindingBase + + +class TestProductBindingUpdateBase(TestProductBindingBase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.product_binding.state = "done" diff --git a/shopinvader_search_engine_update/tests/test_update.py b/shopinvader_search_engine_update/tests/test_update.py new file mode 100644 index 0000000000..03e103e5e4 --- /dev/null +++ b/shopinvader_search_engine_update/tests/test_update.py @@ -0,0 +1,14 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from .common import TestProductBindingUpdateBase + + +class TestUpdate(TestProductBindingUpdateBase): + def test_simple_update(self): + self.product.name = "new name" + self.assertEqual(self.product_binding.state, "to_recompute") + + def test_update_template(self): + self.product.product_tmpl_id.name = "new name" + self.assertEqual(self.product_binding.state, "to_recompute") diff --git a/shopinvader_search_engine_update_image/README.rst b/shopinvader_search_engine_update_image/README.rst new file mode 100644 index 0000000000..38929e8775 --- /dev/null +++ b/shopinvader_search_engine_update_image/README.rst @@ -0,0 +1,35 @@ +**This file is going to be generated by oca-gen-addon-readme.** + +*Manual changes will be overwritten.* + +Please provide content in the ``readme`` directory: + +* **DESCRIPTION.rst** (required) +* INSTALL.rst (optional) +* CONFIGURE.rst (optional) +* **USAGE.rst** (optional, highly recommended) +* DEVELOP.rst (optional) +* ROADMAP.rst (optional) +* HISTORY.rst (optional, recommended) +* **CONTRIBUTORS.rst** (optional, highly recommended) +* CREDITS.rst (optional) + +Content of this README will also be drawn from the addon manifest, +from keys such as name, authors, maintainers, development_status, +and license. + +A good, one sentence summary in the manifest is also highly recommended. + + +Automatic changelog generation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`HISTORY.rst` can be auto generated using `towncrier `_. + +Just put towncrier compatible changelog fragments into `readme/newsfragments` +and the changelog file will be automatically generated and updated when a new fragment is added. + +Please refer to `towncrier` documentation to know more. + +NOTE: the changelog will be automatically generated when using `/ocabot merge $option`. +If you need to run it manually, refer to `OCA/maintainer-tools README `_. diff --git a/shopinvader_search_engine_update_image/__init__.py b/shopinvader_search_engine_update_image/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/shopinvader_search_engine_update_image/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/shopinvader_search_engine_update_image/__manifest__.py b/shopinvader_search_engine_update_image/__manifest__.py new file mode 100644 index 0000000000..93656cafbb --- /dev/null +++ b/shopinvader_search_engine_update_image/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Shopinvader Search Engine Update Image", + "summary": """ + Shopinvader: Mark products linked to an image to be updated when the + image change""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV", + "website": "https://github.com/shopinvader/odoo-shopinvader", + "depends": [ + "shopinvader_search_engine_image", + "shopinvader_search_engine_update", + ], + "data": [], + "demo": [], + "development_status": "Alpha", +} diff --git a/shopinvader_search_engine_update_image/models/__init__.py b/shopinvader_search_engine_update_image/models/__init__.py new file mode 100644 index 0000000000..bb7c4093a5 --- /dev/null +++ b/shopinvader_search_engine_update_image/models/__init__.py @@ -0,0 +1 @@ +from . import fs_product_image diff --git a/shopinvader_search_engine_update_image/models/fs_product_image.py b/shopinvader_search_engine_update_image/models/fs_product_image.py new file mode 100644 index 0000000000..755e05efb8 --- /dev/null +++ b/shopinvader_search_engine_update_image/models/fs_product_image.py @@ -0,0 +1,12 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models + + +class FsProductImage(models.Model): + _name = "fs.product.image" + _inherit = ["fs.product.image", "se.product.update.mixin"] + + def get_products(self): + return self.mapped("product_tmpl_id") diff --git a/shopinvader_search_engine_update_image/readme/CONTEXT.md b/shopinvader_search_engine_update_image/readme/CONTEXT.md new file mode 100644 index 0000000000..08ad903fb7 --- /dev/null +++ b/shopinvader_search_engine_update_image/readme/CONTEXT.md @@ -0,0 +1,3 @@ +When you update the images associated to a product and this information is exposed by +the search engine, you expect to see your changes applied into the search engine as soon +as possible. diff --git a/shopinvader_search_engine_update_image/readme/CONTRIBUTORS.md b/shopinvader_search_engine_update_image/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..a15e3ef244 --- /dev/null +++ b/shopinvader_search_engine_update_image/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Laurent Mignon (https://www.acsone.eu) diff --git a/shopinvader_search_engine_update_image/readme/DESCRIPTION.md b/shopinvader_search_engine_update_image/readme/DESCRIPTION.md new file mode 100644 index 0000000000..3095908066 --- /dev/null +++ b/shopinvader_search_engine_update_image/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module extends the functionality of the `shopinvader_search_engine_update` and +`shopinvader_search_engine_image` modules to mark the information exported to the search +engine as to be recomputed when the images of a product are updated. diff --git a/shopinvader_search_engine_update_image/static/description/icon.png b/shopinvader_search_engine_update_image/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(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Ll^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/shopinvader_search_engine_update_image/tests/__init__.py b/shopinvader_search_engine_update_image/tests/__init__.py new file mode 100644 index 0000000000..1693032ed6 --- /dev/null +++ b/shopinvader_search_engine_update_image/tests/__init__.py @@ -0,0 +1 @@ +from . import test_update diff --git a/shopinvader_search_engine_update_image/tests/test_update.py b/shopinvader_search_engine_update_image/tests/test_update.py new file mode 100644 index 0000000000..b71f3d2182 --- /dev/null +++ b/shopinvader_search_engine_update_image/tests/test_update.py @@ -0,0 +1,40 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import base64 + +from odoo.addons.shopinvader_search_engine_image.tests.common import ( + TestSeMultiImageThumbnailCase, +) + + +class TestUpdate(TestSeMultiImageThumbnailCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.product_binding.state = "done" + cls.new_tag = cls.env["image.tag"].create( + { + "name": "new_tag", + } + ) + + def test_unlink_image(self): + self.product.variant_image_ids.unlink() + self.assertEqual(self.product_binding.state, "to_recompute") + + def test_add_image(self): + self.env["fs.product.image"].create( + { + "sequence": 1, + "product_tmpl_id": self.product.product_tmpl_id.id, + "specific_image": { + "filename": "white2.png", + "content": base64.b64encode(self.white_image), + }, + } + ) + self.assertEqual(self.product_binding.state, "to_recompute") + + def test_update_image(self): + self.product.variant_image_ids[0].tag_id = self.new_tag + self.assertEqual(self.product_binding.state, "to_recompute") diff --git a/shopinvader_search_engine_update_product_brand/README.rst b/shopinvader_search_engine_update_product_brand/README.rst new file mode 100644 index 0000000000..38929e8775 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand/README.rst @@ -0,0 +1,35 @@ +**This file is going to be generated by oca-gen-addon-readme.** + +*Manual changes will be overwritten.* + +Please provide content in the ``readme`` directory: + +* **DESCRIPTION.rst** (required) +* INSTALL.rst (optional) +* CONFIGURE.rst (optional) +* **USAGE.rst** (optional, highly recommended) +* DEVELOP.rst (optional) +* ROADMAP.rst (optional) +* HISTORY.rst (optional, recommended) +* **CONTRIBUTORS.rst** (optional, highly recommended) +* CREDITS.rst (optional) + +Content of this README will also be drawn from the addon manifest, +from keys such as name, authors, maintainers, development_status, +and license. + +A good, one sentence summary in the manifest is also highly recommended. + + +Automatic changelog generation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`HISTORY.rst` can be auto generated using `towncrier `_. + +Just put towncrier compatible changelog fragments into `readme/newsfragments` +and the changelog file will be automatically generated and updated when a new fragment is added. + +Please refer to `towncrier` documentation to know more. + +NOTE: the changelog will be automatically generated when using `/ocabot merge $option`. +If you need to run it manually, refer to `OCA/maintainer-tools README `_. diff --git a/shopinvader_search_engine_update_product_brand/__init__.py b/shopinvader_search_engine_update_product_brand/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/shopinvader_search_engine_update_product_brand/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/shopinvader_search_engine_update_product_brand/__manifest__.py b/shopinvader_search_engine_update_product_brand/__manifest__.py new file mode 100644 index 0000000000..0c328a7eaf --- /dev/null +++ b/shopinvader_search_engine_update_product_brand/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Shopinvader Search Engine Update Product Brand", + "summary": """ + Shopinvader: Mark brand and product bindings to export on product brand update""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/shopinvader/odoo-shopinvader", + "depends": [ + "shopinvader_search_engine_update", + "shopinvader_search_engine_product_brand", + ], + "data": [], + "demo": [], + "development_status": "Alpha", +} diff --git a/shopinvader_search_engine_update_product_brand/models/__init__.py b/shopinvader_search_engine_update_product_brand/models/__init__.py new file mode 100644 index 0000000000..6cb55ac7f7 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand/models/__init__.py @@ -0,0 +1 @@ +from . import product_brand diff --git a/shopinvader_search_engine_update_product_brand/models/product_brand.py b/shopinvader_search_engine_update_product_brand/models/product_brand.py new file mode 100644 index 0000000000..abbcf7f27c --- /dev/null +++ b/shopinvader_search_engine_update_product_brand/models/product_brand.py @@ -0,0 +1,21 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class ProductBrand(models.Model): + _inherit = "product.brand" + + def write(self, vals): + res = super(ProductBrand, self).write(vals) + self.shopinvader_mark_to_update() + return res + + def shopinvader_mark_to_update(self): + res = super(ProductBrand, self).shopinvader_mark_to_update() + self._shopinvader_mark_to_update_associated_products() + return res + + def _shopinvader_mark_to_update_associated_products(self): + self.product_ids.shopinvader_mark_to_update() diff --git a/shopinvader_search_engine_update_product_brand/readme/CONTEXT.md b/shopinvader_search_engine_update_product_brand/readme/CONTEXT.md new file mode 100644 index 0000000000..b26a9952bf --- /dev/null +++ b/shopinvader_search_engine_update_product_brand/readme/CONTEXT.md @@ -0,0 +1,3 @@ +When you update the product brand associated to a product and this information is +exposed by the search engine, you expect to see your changes applied into the search +engine as soon as possible. diff --git a/shopinvader_search_engine_update_product_brand/readme/CONTRIBUTORS.md b/shopinvader_search_engine_update_product_brand/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..a15e3ef244 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Laurent Mignon (https://www.acsone.eu) diff --git a/shopinvader_search_engine_update_product_brand/readme/DESCRIPTION.md b/shopinvader_search_engine_update_product_brand/readme/DESCRIPTION.md new file mode 100644 index 0000000000..e40b055a12 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module extends the functionality of the `shopinvader_search_engine_update` and +`shopinvader_search_engine_product_brand` modules to mark the information exported to +the search engine as to be recomputed when the brand of a product are updated. diff --git a/shopinvader_search_engine_update_product_brand/static/description/icon.png b/shopinvader_search_engine_update_product_brand/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bMSSOauW>o;*=kO8ojw91VX!qoOQb)zHJ!odWB}d+*K?#sY_jqPdg{Sm2HdYzdEx zOGVPhV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G{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/shopinvader_search_engine_update_product_brand/tests/__init__.py b/shopinvader_search_engine_update_product_brand/tests/__init__.py new file mode 100644 index 0000000000..1693032ed6 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand/tests/__init__.py @@ -0,0 +1 @@ +from . import test_update diff --git a/shopinvader_search_engine_update_product_brand/tests/common.py b/shopinvader_search_engine_update_product_brand/tests/common.py new file mode 100644 index 0000000000..634f1fb7c3 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand/tests/common.py @@ -0,0 +1,27 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.addons.shopinvader_search_engine_update.tests.common import ( + TestProductBindingUpdateBase, +) + + +class TestProductBrandUpdateBase(TestProductBindingUpdateBase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.brand = cls.env["product.brand"].create({"name": "brand"}) + 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", + } + ) + cls.product.product_brand_id = cls.brand + cls.brand_binding = cls.brand._add_to_index(cls.brand_index) + cls.brand_binding.state = "done" + cls.new_brand = cls.env["product.brand"].create({"name": "new brand"}) + cls.new_brand_binding = cls.new_brand._add_to_index(cls.brand_index) + cls.new_brand_binding.state = "done" diff --git a/shopinvader_search_engine_update_product_brand/tests/test_update.py b/shopinvader_search_engine_update_product_brand/tests/test_update.py new file mode 100644 index 0000000000..b6bda6b064 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand/tests/test_update.py @@ -0,0 +1,20 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from .common import TestProductBrandUpdateBase + + +class TestUpdate(TestProductBrandUpdateBase): + def test_update_brand_update_product(self): + self.product.product_brand_id.name = "new brand name" + self.assertEqual(self.product_binding.state, "to_recompute") + + def test_update_brand_update_brand_binding(self): + self.brand.name = "new brand name" + self.assertEqual(self.brand_binding.state, "to_recompute") + # the product is also marked to recompute + self.assertEqual(self.product_binding.state, "to_recompute") + + def test_update_brand_field_on_product_update_product(self): + self.product.product_brand_id = self.new_brand + self.assertEqual(self.product_binding.state, "to_recompute") diff --git a/shopinvader_search_engine_update_product_brand_image/README.rst b/shopinvader_search_engine_update_product_brand_image/README.rst new file mode 100644 index 0000000000..38929e8775 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_image/README.rst @@ -0,0 +1,35 @@ +**This file is going to be generated by oca-gen-addon-readme.** + +*Manual changes will be overwritten.* + +Please provide content in the ``readme`` directory: + +* **DESCRIPTION.rst** (required) +* INSTALL.rst (optional) +* CONFIGURE.rst (optional) +* **USAGE.rst** (optional, highly recommended) +* DEVELOP.rst (optional) +* ROADMAP.rst (optional) +* HISTORY.rst (optional, recommended) +* **CONTRIBUTORS.rst** (optional, highly recommended) +* CREDITS.rst (optional) + +Content of this README will also be drawn from the addon manifest, +from keys such as name, authors, maintainers, development_status, +and license. + +A good, one sentence summary in the manifest is also highly recommended. + + +Automatic changelog generation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`HISTORY.rst` can be auto generated using `towncrier `_. + +Just put towncrier compatible changelog fragments into `readme/newsfragments` +and the changelog file will be automatically generated and updated when a new fragment is added. + +Please refer to `towncrier` documentation to know more. + +NOTE: the changelog will be automatically generated when using `/ocabot merge $option`. +If you need to run it manually, refer to `OCA/maintainer-tools README `_. diff --git a/shopinvader_search_engine_update_product_brand_image/__init__.py b/shopinvader_search_engine_update_product_brand_image/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_image/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/shopinvader_search_engine_update_product_brand_image/__manifest__.py b/shopinvader_search_engine_update_product_brand_image/__manifest__.py new file mode 100644 index 0000000000..0c0b323e80 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_image/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Shopinvader Search Engine Update Product Brand Image", + "summary": """ + Mark brand and product bindings to export on product image brand update""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/shopinvader/odoo-shopinvader", + "depends": [ + "shopinvader_search_engine_update", + "shopinvader_search_engine_product_brand_image", + ], + "data": [], + "demo": [], + "development_status": "Alpha", +} diff --git a/shopinvader_search_engine_update_product_brand_image/models/__init__.py b/shopinvader_search_engine_update_product_brand_image/models/__init__.py new file mode 100644 index 0000000000..d119b1d4b1 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_image/models/__init__.py @@ -0,0 +1 @@ +from . import fs_product_brand_image diff --git a/shopinvader_search_engine_update_product_brand_image/models/fs_product_brand_image.py b/shopinvader_search_engine_update_product_brand_image/models/fs_product_brand_image.py new file mode 100644 index 0000000000..508e37c7e1 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_image/models/fs_product_brand_image.py @@ -0,0 +1,35 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class FsProductBrandImage(models.Model): + _inherit = "fs.product.brand.image" + + def get_brands(self): + return self.mapped("brand_id") + + @api.model_create_multi + def create(self, vals_list): + res = super(FsProductBrandImage, self).create(vals_list) + res.get_brands().shopinvader_mark_to_update() + return res + + def write(self, vals): + needs_update = self.needs_brand_update(vals) + if needs_update: + products = self.get_brands() + res = super(FsProductBrandImage, self).write(vals) + if needs_update: + (products | self.get_brands()).shopinvader_mark_to_update() + return res + + def unlink(self): + products = self.get_brands() + res = super(FsProductBrandImage, self).unlink() + products.shopinvader_mark_to_update() + return res + + def needs_brand_update(self, vals): + return True diff --git a/shopinvader_search_engine_update_product_brand_image/readme/CONTEXT.md b/shopinvader_search_engine_update_product_brand_image/readme/CONTEXT.md new file mode 100644 index 0000000000..0e49a1b5e2 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_image/readme/CONTEXT.md @@ -0,0 +1,3 @@ +When you update the image associated to a product brand and this information is exposed +by the search engine on the product and or on a product brand index, you expect to see +your changes applied into the search engine as soon as possible. diff --git a/shopinvader_search_engine_update_product_brand_image/readme/CONTRIBUTORS.md b/shopinvader_search_engine_update_product_brand_image/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..a15e3ef244 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_image/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Laurent Mignon (https://www.acsone.eu) diff --git a/shopinvader_search_engine_update_product_brand_image/readme/DESCRIPTION.md b/shopinvader_search_engine_update_product_brand_image/readme/DESCRIPTION.md new file mode 100644 index 0000000000..8595b4e143 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_image/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module extends the functionality of the `shopinvader_search_engine_update` and +`shopinvader_search_engine_product_brand_image` modules to mark the information exported +to the search engine as to be recomputed when the images of a product brand are updated. diff --git a/shopinvader_search_engine_update_product_brand_image/static/description/icon.png b/shopinvader_search_engine_update_product_brand_image/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzI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hT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/shopinvader_search_engine_update_product_brand_image/tests/__init__.py b/shopinvader_search_engine_update_product_brand_image/tests/__init__.py new file mode 100644 index 0000000000..1693032ed6 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_image/tests/__init__.py @@ -0,0 +1 @@ +from . import test_update diff --git a/shopinvader_search_engine_update_product_brand_image/tests/test_update.py b/shopinvader_search_engine_update_product_brand_image/tests/test_update.py new file mode 100644 index 0000000000..003f51ec10 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_image/tests/test_update.py @@ -0,0 +1,47 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import base64 + +from odoo.addons.shopinvader_search_engine.tests.common import TestProductBindingMixin +from odoo.addons.shopinvader_search_engine_product_brand_image.tests.common import ( + ProductBrandImageCase, +) + + +class TestUpdate(ProductBrandImageCase, TestProductBindingMixin): + @classmethod + def setUpClass(cls): + super().setUpClass() + TestProductBindingMixin.setup_records(cls) + cls.product.product_brand_id = cls.brand + cls.product_binding.state = "done" + cls.brand_binding.state = "done" + cls.new_tag = cls.env["image.tag"].create( + { + "name": "new_tag", + } + ) + + def test_unlink_image(self): + self.brand.image_ids.unlink() + self.assertEqual(self.brand_binding.state, "to_recompute") + self.assertEqual(self.product_binding.state, "to_recompute") + + def test_add_image(self): + self.env["fs.product.brand.image"].create( + { + "sequence": 3, + "brand_id": self.brand.id, + "specific_image": { + "filename": "white2.png", + "content": base64.b64encode(self.white_image), + }, + } + ) + self.assertEqual(self.brand_binding.state, "to_recompute") + self.assertEqual(self.product_binding.state, "to_recompute") + + def test_update_image(self): + self.brand.image_ids[0].tag_id = self.new_tag + self.assertEqual(self.brand_binding.state, "to_recompute") + self.assertEqual(self.product_binding.state, "to_recompute") diff --git a/shopinvader_search_engine_update_product_brand_tag/README.rst b/shopinvader_search_engine_update_product_brand_tag/README.rst new file mode 100644 index 0000000000..38929e8775 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_tag/README.rst @@ -0,0 +1,35 @@ +**This file is going to be generated by oca-gen-addon-readme.** + +*Manual changes will be overwritten.* + +Please provide content in the ``readme`` directory: + +* **DESCRIPTION.rst** (required) +* INSTALL.rst (optional) +* CONFIGURE.rst (optional) +* **USAGE.rst** (optional, highly recommended) +* DEVELOP.rst (optional) +* ROADMAP.rst (optional) +* HISTORY.rst (optional, recommended) +* **CONTRIBUTORS.rst** (optional, highly recommended) +* CREDITS.rst (optional) + +Content of this README will also be drawn from the addon manifest, +from keys such as name, authors, maintainers, development_status, +and license. + +A good, one sentence summary in the manifest is also highly recommended. + + +Automatic changelog generation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`HISTORY.rst` can be auto generated using `towncrier `_. + +Just put towncrier compatible changelog fragments into `readme/newsfragments` +and the changelog file will be automatically generated and updated when a new fragment is added. + +Please refer to `towncrier` documentation to know more. + +NOTE: the changelog will be automatically generated when using `/ocabot merge $option`. +If you need to run it manually, refer to `OCA/maintainer-tools README `_. diff --git a/shopinvader_search_engine_update_product_brand_tag/__init__.py b/shopinvader_search_engine_update_product_brand_tag/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_tag/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/shopinvader_search_engine_update_product_brand_tag/__manifest__.py b/shopinvader_search_engine_update_product_brand_tag/__manifest__.py new file mode 100644 index 0000000000..dcb415b41d --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_tag/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Shopinvader Seach Engine Product Brand Tag", + "summary": """ + Mark brand and product bindings to export on product image tag update""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV", + "website": "https://github.com/shopinvader/odoo-shopinvader", + "depends": [ + "shopinvader_search_engine_update_product_brand", + "shopinvader_product_brand_tag", + ], + "data": [], + "demo": [], + "development_status": "Alpha", +} diff --git a/shopinvader_search_engine_update_product_brand_tag/models/__init__.py b/shopinvader_search_engine_update_product_brand_tag/models/__init__.py new file mode 100644 index 0000000000..1f1898fda1 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_tag/models/__init__.py @@ -0,0 +1 @@ +from . import product_brand_tag diff --git a/shopinvader_search_engine_update_product_brand_tag/models/product_brand_tag.py b/shopinvader_search_engine_update_product_brand_tag/models/product_brand_tag.py new file mode 100644 index 0000000000..d526bbff38 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_tag/models/product_brand_tag.py @@ -0,0 +1,24 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class ProductBrandTag(models.Model): + _inherit = "product.brand.tag" + + @api.model_create_multi + def create(self, vals_list): + res = super(ProductBrandTag, self).create(vals_list) + res.product_brand_ids.shopinvader_mark_to_update() + return res + + def write(self, vals): + res = super(ProductBrandTag, self).write(vals) + if "name" in vals or "product_brand_ids" in vals: + self.product_brand_ids.shopinvader_mark_to_update() + return res + + def unlink(self): + self.product_brand_ids.shopinvader_mark_to_update() + return super(ProductBrandTag, self).unlink() diff --git a/shopinvader_search_engine_update_product_brand_tag/readme/CONTEXT.md b/shopinvader_search_engine_update_product_brand_tag/readme/CONTEXT.md new file mode 100644 index 0000000000..d1cf175b8f --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_tag/readme/CONTEXT.md @@ -0,0 +1,3 @@ +When you update the tag associated to a product brand and this information is exposed by +the search engine on the product and or on a product brand index, you expect to see your +changes applied into the search engine as soon as possible. diff --git a/shopinvader_search_engine_update_product_brand_tag/readme/CONTRIBUTORS.md b/shopinvader_search_engine_update_product_brand_tag/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..a15e3ef244 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_tag/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Laurent Mignon (https://www.acsone.eu) diff --git a/shopinvader_search_engine_update_product_brand_tag/readme/DESCRIPTION.md b/shopinvader_search_engine_update_product_brand_tag/readme/DESCRIPTION.md new file mode 100644 index 0000000000..6eae3d67ae --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_tag/readme/DESCRIPTION.md @@ -0,0 +1,4 @@ +This module extends the functionality of the `shopinvader_product_brand_tag` and +`shopinvader_search_engine_update_product_brand` modules to mark the information +exported to the search engine as to be recomputed when the tag of a product brand is +updated. diff --git a/shopinvader_search_engine_update_product_brand_tag/static/description/icon.png b/shopinvader_search_engine_update_product_brand_tag/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c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u_qprZ=>Ig-$ zbW26Ws~IgY>}^5w`vTB(G`PTZaDiGBo5o(tp)qli|NeV( z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/shopinvader_search_engine_update_product_brand_tag/tests/__init__.py b/shopinvader_search_engine_update_product_brand_tag/tests/__init__.py new file mode 100644 index 0000000000..1693032ed6 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_tag/tests/__init__.py @@ -0,0 +1 @@ +from . import test_update diff --git a/shopinvader_search_engine_update_product_brand_tag/tests/test_update.py b/shopinvader_search_engine_update_product_brand_tag/tests/test_update.py new file mode 100644 index 0000000000..6d60b80a54 --- /dev/null +++ b/shopinvader_search_engine_update_product_brand_tag/tests/test_update.py @@ -0,0 +1,45 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.addons.shopinvader_search_engine_update_product_brand.tests.common import ( + TestProductBrandUpdateBase, +) + + +class TestUpdate(TestProductBrandUpdateBase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.tag = cls.env["product.brand.tag"].create( + { + "name": "tag", + } + ) + cls.new_tag = cls.env["product.brand.tag"].create( + { + "name": "new_tag", + } + ) + cls.brand.tag_ids = cls.tag + cls.brand_binding.state = "done" + cls.product_binding.state = "done" + + def test_unlink_tag(self): + self.brand.tag_ids.unlink() + self.assertEqual(self.brand_binding.state, "to_recompute") + self.assertEqual(self.product_binding.state, "to_recompute") + + def test_add_tag(self): + self.brand.tag_ids = self.new_tag + self.assertEqual(self.brand_binding.state, "to_recompute") + self.assertEqual(self.product_binding.state, "to_recompute") + self.brand_binding.state = "done" + self.product_binding.state = "done" + self.tag.product_brand_ids = self.brand + self.assertEqual(self.brand_binding.state, "to_recompute") + self.assertEqual(self.product_binding.state, "to_recompute") + + def test_update_tag(self): + self.brand.tag_ids[0].name = "new name" + self.assertEqual(self.brand_binding.state, "to_recompute") + self.assertEqual(self.product_binding.state, "to_recompute") diff --git a/shopinvader_search_engine_update_product_media/README.rst b/shopinvader_search_engine_update_product_media/README.rst new file mode 100644 index 0000000000..38929e8775 --- /dev/null +++ b/shopinvader_search_engine_update_product_media/README.rst @@ -0,0 +1,35 @@ +**This file is going to be generated by oca-gen-addon-readme.** + +*Manual changes will be overwritten.* + +Please provide content in the ``readme`` directory: + +* **DESCRIPTION.rst** (required) +* INSTALL.rst (optional) +* CONFIGURE.rst (optional) +* **USAGE.rst** (optional, highly recommended) +* DEVELOP.rst (optional) +* ROADMAP.rst (optional) +* HISTORY.rst (optional, recommended) +* **CONTRIBUTORS.rst** (optional, highly recommended) +* CREDITS.rst (optional) + +Content of this README will also be drawn from the addon manifest, +from keys such as name, authors, maintainers, development_status, +and license. + +A good, one sentence summary in the manifest is also highly recommended. + + +Automatic changelog generation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`HISTORY.rst` can be auto generated using `towncrier `_. + +Just put towncrier compatible changelog fragments into `readme/newsfragments` +and the changelog file will be automatically generated and updated when a new fragment is added. + +Please refer to `towncrier` documentation to know more. + +NOTE: the changelog will be automatically generated when using `/ocabot merge $option`. +If you need to run it manually, refer to `OCA/maintainer-tools README `_. diff --git a/shopinvader_search_engine_update_product_media/__init__.py b/shopinvader_search_engine_update_product_media/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/shopinvader_search_engine_update_product_media/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/shopinvader_search_engine_update_product_media/__manifest__.py b/shopinvader_search_engine_update_product_media/__manifest__.py new file mode 100644 index 0000000000..17ca2084f5 --- /dev/null +++ b/shopinvader_search_engine_update_product_media/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Shopinvader Search Engine Update Media", + "summary": """ + Shopinvader: Mark products linked to a media to be updated when the media change""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/shopinvader/odoo-shopinvader", + "depends": [ + "shopinvader_search_engine_update", + "shopinvader_search_engine_product_media", + ], + "data": [], + "demo": [], + "development_status": "Alpha", +} diff --git a/shopinvader_search_engine_update_product_media/models/__init__.py b/shopinvader_search_engine_update_product_media/models/__init__.py new file mode 100644 index 0000000000..f31e523df6 --- /dev/null +++ b/shopinvader_search_engine_update_product_media/models/__init__.py @@ -0,0 +1 @@ +from . import fs_product_media diff --git a/shopinvader_search_engine_update_product_media/models/fs_product_media.py b/shopinvader_search_engine_update_product_media/models/fs_product_media.py new file mode 100644 index 0000000000..5b4d1d2ae0 --- /dev/null +++ b/shopinvader_search_engine_update_product_media/models/fs_product_media.py @@ -0,0 +1,12 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models + + +class FsProductMedia(models.Model): + _name = "fs.product.media" + _inherit = ["fs.product.media", "se.product.update.mixin"] + + def get_products(self): + return self.mapped("product_tmpl_id") diff --git a/shopinvader_search_engine_update_product_media/readme/CONTEXT.md b/shopinvader_search_engine_update_product_media/readme/CONTEXT.md new file mode 100644 index 0000000000..41ea1775c0 --- /dev/null +++ b/shopinvader_search_engine_update_product_media/readme/CONTEXT.md @@ -0,0 +1,3 @@ +When you update the medias associated to a product and this information is exposed by +the search engine, you expect to see your changes applied into the search engine as soon +as possible. diff --git a/shopinvader_search_engine_update_product_media/readme/CONTRIBUTORS.md b/shopinvader_search_engine_update_product_media/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..a15e3ef244 --- /dev/null +++ b/shopinvader_search_engine_update_product_media/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Laurent Mignon (https://www.acsone.eu) diff --git a/shopinvader_search_engine_update_product_media/readme/DESCRIPTION.md b/shopinvader_search_engine_update_product_media/readme/DESCRIPTION.md new file mode 100644 index 0000000000..d5314a1568 --- /dev/null +++ b/shopinvader_search_engine_update_product_media/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module extends the functionality of the `shopinvader_search_engine_update` and +`shopinvader_search_engine_product_media` modules to mark the information exported to +the search engine as to be recomputed when the medias of a product are updated. diff --git a/shopinvader_search_engine_update_product_media/static/description/icon.png b/shopinvader_search_engine_update_product_media/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132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Ws~IgY>}^5w`vTB(G`PTZaDiGBo5o(tp)qli|NeV( z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/shopinvader_search_engine_update_product_media/tests/__init__.py b/shopinvader_search_engine_update_product_media/tests/__init__.py new file mode 100644 index 0000000000..1693032ed6 --- /dev/null +++ b/shopinvader_search_engine_update_product_media/tests/__init__.py @@ -0,0 +1 @@ +from . import test_update diff --git a/shopinvader_search_engine_update_product_media/tests/test_update.py b/shopinvader_search_engine_update_product_media/tests/test_update.py new file mode 100644 index 0000000000..e48bb810b5 --- /dev/null +++ b/shopinvader_search_engine_update_product_media/tests/test_update.py @@ -0,0 +1,45 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import base64 + +from odoo.addons.shopinvader_search_engine.tests.common import TestProductBindingMixin +from odoo.addons.shopinvader_search_engine_product_media.tests.common import ( + ProductMediaCase, +) + + +class TestUpdate(ProductMediaCase, TestProductBindingMixin): + @classmethod + def setUpClass(cls): + super().setUpClass() + TestProductBindingMixin.setup_records(cls) + cls.env["fs.product.media"].create( + { + "product_tmpl_id": cls.product.product_tmpl_id.id, + "media_id": cls.media_c.id, + "sequence": 10, + "link_existing": True, + } + ) + cls.product_binding.state = "done" + + def test_unlink_media(self): + self.product.media_ids.unlink() + self.assertEqual(self.product_binding.state, "to_recompute") + + def test_add_media(self): + self.env["fs.product.media"].create( + { + "product_tmpl_id": self.product.product_tmpl_id.id, + "file": { + "filename": "new.txt", + "content": base64.b64encode(b"new media"), + }, + "media_type_id": self.media_type_b.id, + } + ) + self.assertEqual(self.product_binding.state, "to_recompute") + + def test_update_media(self): + self.product.media_ids[0].media_type_id = self.media_type_a.id + self.assertEqual(self.product_binding.state, "to_recompute")