From d8f0cdf405572dd11131fc495ca8a94f3c48d0f7 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Thu, 26 Mar 2026 12:31:42 +0100 Subject: [PATCH 1/2] storage_image_product: ease test setup for other modules Having a mixin class allows to run the setup of the base data explicitly where needed especially when you have test classes with multiple inheritances. After the Odoo tests apocalypse we cannot rely anymore on running Klass.setUpClass() w/o tons of attributes warning. Now you can inherit the mixin and do the setup properly. --- storage_image_product/tests/common.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/storage_image_product/tests/common.py b/storage_image_product/tests/common.py index 52c88ad45e..6860247530 100644 --- a/storage_image_product/tests/common.py +++ b/storage_image_product/tests/common.py @@ -8,7 +8,7 @@ from odoo.addons.component.tests.common import TransactionComponentCase -class ProductImageCommonCase(TransactionComponentCase): +class ProductImageCaseMixin: @staticmethod def _get_file_content(name, base_path=None, as_binary=False): path = base_path or os.path.dirname(os.path.abspath(__file__)) @@ -25,8 +25,7 @@ def _create_storage_image(cls, name): ) @classmethod - def setUpClass(cls): - super().setUpClass() + def _setup_base_image_data(cls): cls.template = cls.env.ref("product.product_product_4_product_template") cls.product_a = cls.env.ref("product.product_product_4") cls.product_b = cls.env.ref("product.product_product_4b") @@ -34,3 +33,10 @@ def setUpClass(cls): cls.logo_image = cls._create_storage_image("logo-image.jpg") cls.white_image = cls._create_storage_image("white-image.jpg") cls.black_image = cls._create_storage_image("black-image.jpg") + + +class ProductImageCommonCase(TransactionComponentCase, ProductImageCaseMixin): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls._setup_base_image_data() From 3952ed1a423abeff4d3d91e0cf119913305aca05 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 27 Mar 2026 07:34:32 +0000 Subject: [PATCH 2/2] [BOT] post-merge updates --- README.md | 2 +- storage_image_product/README.rst | 2 +- storage_image_product/__manifest__.py | 2 +- storage_image_product/static/description/index.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1c65bcb85e..298bfea534 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ addon | version | maintainers | summary [storage_backend_sftp](storage_backend_sftp/) | 18.0.1.0.0 | | Implement SFTP Storage [storage_file](storage_file/) | 18.0.1.0.0 | | Storage file in storage backend [storage_image](storage_image/) | 18.0.1.0.1 | | Store image and resized image in a storage backend -[storage_image_product](storage_image_product/) | 18.0.1.0.1 | | Link images to products and categories +[storage_image_product](storage_image_product/) | 18.0.1.0.2 | | Link images to products and categories [storage_media](storage_media/) | 18.0.1.1.1 | | Give the posibility to store media data in Odoo [storage_media_product](storage_media_product/) | 18.0.1.0.1 | | Link media to products and categories [storage_thumbnail](storage_thumbnail/) | 18.0.1.0.0 | | Abstract module that add the possibility to have thumbnail diff --git a/storage_image_product/README.rst b/storage_image_product/README.rst index 37a4377eee..f32d81c587 100644 --- a/storage_image_product/README.rst +++ b/storage_image_product/README.rst @@ -11,7 +11,7 @@ Storage Image Product !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:7417948de53286309bdc23535830b7a81e6f5f21fc592be94b370fa9adce89ea + !! source digest: sha256:da4b914be20e01a01cfa782549a9aeab2ac2a946a96895fce85de92e6f2b454c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png diff --git a/storage_image_product/__manifest__.py b/storage_image_product/__manifest__.py index eb5a9193f0..7eaac02f1e 100644 --- a/storage_image_product/__manifest__.py +++ b/storage_image_product/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Storage Image Product", "summary": "Link images to products and categories", - "version": "18.0.1.0.1", + "version": "18.0.1.0.2", "category": "Storage", "website": "https://github.com/OCA/storage", "author": " Akretion, Odoo Community Association (OCA)", diff --git a/storage_image_product/static/description/index.html b/storage_image_product/static/description/index.html index 713cb88786..e5e73410d7 100644 --- a/storage_image_product/static/description/index.html +++ b/storage_image_product/static/description/index.html @@ -372,7 +372,7 @@

Storage Image Product

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:7417948de53286309bdc23535830b7a81e6f5f21fc592be94b370fa9adce89ea +!! source digest: sha256:da4b914be20e01a01cfa782549a9aeab2ac2a946a96895fce85de92e6f2b454c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Production/Stable License: LGPL-3 OCA/storage Translate me on Weblate Try me on Runboat

Attach images to products and categories