diff --git a/report_qr/__manifest__.py b/report_qr/__manifest__.py index 533afba15..6866fbfa0 100644 --- a/report_qr/__manifest__.py +++ b/report_qr/__manifest__.py @@ -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", diff --git a/report_qr/controllers/qr.py b/report_qr/controllers/qr.py index ed4cd6914..f5760deb3 100644 --- a/report_qr/controllers/qr.py +++ b/report_qr/controllers/qr.py @@ -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")] diff --git a/report_qr/models/ir_actions_report.py b/report_qr/models/ir_actions_report.py index ed81d8c7f..ccad9b58c 100644 --- a/report_qr/models/ir_actions_report.py +++ b/report_qr/models/ir_actions_report.py @@ -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 diff --git a/report_qr/tests/test_report_qr.py b/report_qr/tests/test_report_qr.py index fd2543838..56ddf27fc 100644 --- a/report_qr/tests/test_report_qr.py +++ b/report_qr/tests/test_report_qr.py @@ -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)