[MIG] report_qr: Migration to 15.0

pull/673/head
Jasmin Solanki 2022-02-07 16:04:16 +05:30 committed by David Ramia
parent 5c7779d9bb
commit e900bb9a74
4 changed files with 6 additions and 6 deletions

View File

@ -3,7 +3,7 @@
{
"name": "Web QR Manager",
"version": "14.0.1.0.1",
"version": "15.0.1.0.0",
"author": "Creu Blanca, " "Odoo Community Association (OCA)",
"category": "Reporting",
"website": "https://github.com/OCA/reporting-engine",

View File

@ -11,10 +11,10 @@ class Home(http.Controller):
barcode = request.env["ir.actions.report"].qr_generate(
value, box_size=box_size, border=border, factory=factory, **kwargs
)
except (ValueError, AttributeError):
except (ValueError, AttributeError) as e:
raise werkzeug.exceptions.HTTPException(
description="Cannot convert into barcode."
)
) from e
if factory != "png":
return request.make_response(
barcode, headers=[("Content-Type", "image/svg+xml")]

View File

@ -31,5 +31,5 @@ class IrActionsReport(models.Model):
arr = io.BytesIO()
img.save(arr)
return arr.getvalue()
except Exception:
raise ValueError("Cannot convert into barcode.")
except Exception as e:
raise ValueError("Cannot convert into barcode.") from e

View File

@ -14,5 +14,5 @@ class TestReportQr(HttpCase):
"""There is a QR limitation for 4296 characters, we will test that an
Exception is raised"""
new_data = "".join(["TEST"] * 1500)
with self.assertRaises(Exception):
with self.assertRaises(ValueError):
self.env["ir.actions.report"].qr_generate(new_data)