Skip to content

Commit

Permalink
[IMP] Various adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
psugne committed Oct 16, 2024
1 parent 38cd331 commit 7682f55
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 34 deletions.
24 changes: 3 additions & 21 deletions product_multi_image/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ You can manage your images at Product template level:
#. Go to *Sales > Products > Products* and choose a product template.
#. Go to the *Images* tab.
#. Add a new image or edit the existing ones.
#. You can select for which variants you want to make available the image.
#. You can select for which variants you want to make the image available.
Keep it empty for making visible in all.
#. Refresh the page.
#. The first image in the collection is the main image for the product
template.

Expand All @@ -62,33 +61,16 @@ into account this behaviour:
#. If you add an image here, the image is actually added to the product
template, and restricted to this variant.
#. When editing an existing image, the image is changed generally for all
the variants where is enabled, not only for this variant.
the variants where it is enabled, not only for this variant.
#. When removing an image from this form, if the image is only in this variant,
the image is removed. Otherwise, the image gets restricted to the rest of
the variants where is available.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/135/9.0
the variants where it is used.

Known issues / Roadmap
======================

* When you change the image on the product variant, the preview image of the
*Images* tab doesn't get refreshed until you refresh the browser, or if you
go to its template, but the image has been actually saved!
* The field "Available in these variants" appears when opening the image
from the product variant.
* Add logic for handling to add images with the same name that another variant
of the same template, renaming the new image to a unique name.
* Add logic for handling to add the same image in several variants to a
already in another variant for not duplicating bytes.
* Provide proper migration scripts from module product_images from 7.0.
* Migrate to v8 api when https://github.com/odoo/odoo/issues/10799 gets fixed.
* If you try to sort images before saving the product variant or template, you
will get an error similar to ``DataError: invalid input syntax for integer:
"one2many_v_id_62"``. This bug has not been fixed yet, but a workaround is to
save and edit again to sort images.

Bug Tracker
===========
Expand Down
9 changes: 2 additions & 7 deletions product_multi_image/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/product-attribute",
"category": "Sales Management",
"category": "Product",
"summary": "Add multiple images for a product, a.k.a. an image gallery.",
"post_init_hook": "post_init_hook",
"uninstall_hook": "uninstall_hook",
"depends": [
Expand All @@ -23,10 +24,4 @@
"views/product_template_view.xml",
],
"installable": True,
"images": [
"images/product.png",
"images/db.png",
"images/file.png",
"images/url.png",
],
}
2 changes: 0 additions & 2 deletions product_multi_image/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ class ProductProduct(models.Model):
inverse="_inverse_image_ids",
)

# image, image_medium, image_small fields are not available since 13.0

@api.depends(
"product_tmpl_id",
"product_tmpl_id.image_ids",
Expand Down
2 changes: 0 additions & 2 deletions product_multi_image/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@
class ProductTemplate(models.Model):
_name = "product.template"
_inherit = [_name, "base_multi_image.owner"]

# image, image_medium, image_small fields are not available since 13.0
5 changes: 3 additions & 2 deletions product_multi_image/tests/test_product_multi_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@


class TestProductMultiImage(common.TransactionCase):
def setUp(self):
super().setUp()
@classmethod
def setUpClass(self):
super().setUpClass()
self.transparent_image = ( # 1x1 Transparent GIF
b"R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
)
Expand Down

0 comments on commit 7682f55

Please sign in to comment.