[FIX] data_nature_importer: double PIL size

This commit is contained in:
Niels Göttsch 2026-03-03 22:15:51 +01:00 committed by madmooose
parent 0c62fc4de0
commit 4f0a9ba952
11 changed files with 22 additions and 6 deletions

View file

@ -44,6 +44,7 @@ Changelog
- 16.0.1.1.1: Use default image as product image - 16.0.1.1.1: Use default image as product image
- 16.0.1.2.0: Add Extra Product Media support - 16.0.1.2.0: Add Extra Product Media support
- 16.0.1.2.1: Add image mime type check - 16.0.1.2.1: Add image mime type check
- 16.0.1.2.3: Increase the max image pixels limit for PIL to avoid DecompressionBombError
Bug Tracker Bug Tracker
=========== ===========

View file

@ -4,7 +4,7 @@
"author": "BAKEUP", "author": "BAKEUP",
"website": "https://www.bakeup.org", "website": "https://www.bakeup.org",
"category": "product", "category": "product",
"version": "16.0.1.2.1", "version": "16.0.1.2.3",
"depends": ["product", "queue_job", "website_sale"], "depends": ["product", "queue_job", "website_sale"],
"data": [ "data": [
"security/ir.model.access.csv", "security/ir.model.access.csv",

View file

@ -1,8 +1,14 @@
from PIL import Image
from odoo import models from odoo import models
from .. import utils as dn_utils from .. import utils as dn_utils
# Increase the max image pixels limit for PIL to avoid DecompressionBombError
Image.MAX_IMAGE_PIXELS = 2 * 189135000 # set custom limit for large images
class ProductTemplate(models.Model): class ProductTemplate(models.Model):
_inherit = "product.template" _inherit = "product.template"

View file

@ -4,3 +4,4 @@
- 16.0.1.1.1: Use default image as product image - 16.0.1.1.1: Use default image as product image
- 16.0.1.2.0: Add Extra Product Media support - 16.0.1.2.0: Add Extra Product Media support
- 16.0.1.2.1: Add image mime type check - 16.0.1.2.1: Add image mime type check
- 16.0.1.2.3: Increase the max image pixels limit for PIL to avoid DecompressionBombError

View file

@ -387,6 +387,7 @@ ul.auto-toc {
<li>16.0.1.1.1: Use default image as product image</li> <li>16.0.1.1.1: Use default image as product image</li>
<li>16.0.1.2.0: Add Extra Product Media support</li> <li>16.0.1.2.0: Add Extra Product Media support</li>
<li>16.0.1.2.1: Add image mime type check</li> <li>16.0.1.2.1: Add image mime type check</li>
<li>16.0.1.2.3: Increase the max image pixels limit for PIL to avoid DecompressionBombError</li>
</ul> </ul>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">

View file

@ -42,6 +42,7 @@ Changelog
- 16.0.1.3.0: Add GTIN Article field and update metadata retrieval - 16.0.1.3.0: Add GTIN Article field and update metadata retrieval
- 16.0.1.3.1: Temporay disable image_1920 field verification - 16.0.1.3.1: Temporay disable image_1920 field verification
- 16.0.1.3.2: Temporay disable image_1920 field verification for product.image - 16.0.1.3.2: Temporay disable image_1920 field verification for product.image
- 16.0.1.3.3: Add max size for bith image_1920 fields
Bug Tracker Bug Tracker
=========== ===========

View file

@ -4,7 +4,7 @@
"author": "BAKEUP", "author": "BAKEUP",
"website": "https://www.bakeup.org", "website": "https://www.bakeup.org",
"category": "Product", "category": "Product",
"version": "16.0.1.3.2", "version": "16.0.1.3.3",
"depends": ["nfu_product", "data_nature_importer"], "depends": ["nfu_product", "data_nature_importer"],
"data": ["data/ir_config_parameter.xml", "views/product_bnn_views.xml"], "data": ["data/ir_config_parameter.xml", "views/product_bnn_views.xml"],
"assets": {}, "assets": {},

View file

@ -5,4 +5,6 @@ class ProductImage(models.Model):
_inherit = "product.image" _inherit = "product.image"
# TODO: Remove as soon as data_nature thumbnails work # TODO: Remove as soon as data_nature thumbnails work
image_1920 = fields.Image(verify_resolution=False) image_1920 = fields.Image(
"Image", max_width=1920, max_height=1920, verify_resolution=False
)

View file

@ -7,7 +7,9 @@ class ProductTemplate(models.Model):
_inherit = "product.template" _inherit = "product.template"
# TODO: Remove as soon as data_nature thumbnails work # TODO: Remove as soon as data_nature thumbnails work
image_1920 = fields.Image(verify_resolution=False) image_1920 = fields.Image(
"Image", max_width=1920, max_height=1920, verify_resolution=False
)
manufacturer_abbr = fields.Char(string="Manufacturer Abbreviation") manufacturer_abbr = fields.Char(string="Manufacturer Abbreviation")
# Should be moved to product.product at some point # Should be moved to product.product at some point

View file

@ -8,3 +8,4 @@
- 16.0.1.3.0: Add GTIN Article field and update metadata retrieval - 16.0.1.3.0: Add GTIN Article field and update metadata retrieval
- 16.0.1.3.1: Temporay disable image_1920 field verification - 16.0.1.3.1: Temporay disable image_1920 field verification
- 16.0.1.3.2: Temporay disable image_1920 field verification for product.image - 16.0.1.3.2: Temporay disable image_1920 field verification for product.image
- 16.0.1.3.3: Add max size for bith image_1920 fields

View file

@ -396,6 +396,7 @@ ul.auto-toc {
<li>16.0.1.3.0: Add GTIN Article field and update metadata retrieval</li> <li>16.0.1.3.0: Add GTIN Article field and update metadata retrieval</li>
<li>16.0.1.3.1: Temporay disable image_1920 field verification</li> <li>16.0.1.3.1: Temporay disable image_1920 field verification</li>
<li>16.0.1.3.2: Temporay disable image_1920 field verification for product.image</li> <li>16.0.1.3.2: Temporay disable image_1920 field verification for product.image</li>
<li>16.0.1.3.3: Add max size for bith image_1920 fields</li>
</ul> </ul>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">