Browse Source

APR 16: [FIX] Bug fixed 'product_export_with_images'

pull/354/merge
Cybrosys Technologies 1 week ago
parent
commit
e515b04fc2
  1. 6
      product_export_with_images/controllers/product_export_with_images.py
  2. 19
      product_export_with_images/static/description/index.html
  3. 1
      product_export_with_images/wizard/product_export.py

6
product_export_with_images/controllers/product_export_with_images.py

@ -29,7 +29,8 @@ from odoo.http import content_disposition, request
from odoo.tools import image_process
import subprocess
import os
import traceback
from tempfile import NamedTemporaryFile
class ExcelReportController(http.Controller):
@ -51,6 +52,7 @@ class ExcelReportController(http.Controller):
("Content-Disposition", content_disposition("Products" + ".xlsx")),
],
)
# Create workbook object from xlsxwriter library
output = io.BytesIO()
workbook = xlsxwriter.Workbook(output, {"in_memory": True})
header_style = workbook.add_format(
@ -122,7 +124,6 @@ class ExcelReportController(http.Controller):
sheet.insert_image(row, 6, "product." + image_type, {"image_data": image_data})
elif image_type == "webp":
try:
from tempfile import NamedTemporaryFile
with NamedTemporaryFile(suffix='.webp', delete=False) as temp_in:
temp_in.write(source)
@ -150,7 +151,6 @@ class ExcelReportController(http.Controller):
sheet.insert_image(row, 6, "product.png", {"image_data": image_data})
except Exception as e:
import traceback
traceback.print_exc()
row += 1
number += 1

19
product_export_with_images/static/description/index.html

@ -201,6 +201,25 @@
<img src="./assets/icons/patter.svg">
</div>
</div>
<section class="oe_container pb-5">
<div class="mt64 mb64">
<div class="col-sm-12 py-4">
<div class="alert alert-primary mt-4"
style="color: #000;background-color: #f8f8f8;border: 1px solid #dcdcdc;border-radius: 16px;">
This module requires an external system dependency. Please install the WebP library using the appropriate method for your operating system
<br>
<code class="d-block mt-2"
style="background-color:#4e4e4e;color: #fff; border-radius: 5px; padding: 6px 8px;">Ubuntu/Debian: sudo apt-get install webp</code>
<code class="d-block mt-2"
style="background-color:#4e4e4e;color: #fff;padding: 6px 8px; border-radius: 5px;"> macOS: brew install webp</code>
<code class="d-block mt-2"
style="background-color:#4e4e4e;color: #fff;padding: 6px 8px; border-radius: 5px;">Windows: Download from: https://developers.google.com/speed/webp/download</code>
</div>
</div>
</div>
</section>
<!-- key-highlight -->
<div class="" style="border-radius: 16px;
padding: 60px 40px;

1
product_export_with_images/wizard/product_export.py

@ -76,6 +76,5 @@ class ExportWizard(models.TransientModel):
"sales_price": rec.list_price,
"image": rec.image_128,
}
print("vals", rec.image_128)
rec_list.append(vals)
return rec_list

Loading…
Cancel
Save