summaryrefslogtreecommitdiff
path: root/addons/web/controllers
diff options
context:
space:
mode:
authoroco-odoo <oco@odoo.com>2020-02-07 10:10:09 +0000
committeroco-odoo <oco@odoo.com>2020-03-30 11:28:41 +0000
commit0eef278268d1f4cce30c97bfef723f769b1a48e0 (patch)
treeae9df84a16740d8a41b079da599017a3f55f0a2d /addons/web/controllers
parentc1f3596bd32efcbec40e66c29930ccdc29072f92 (diff)
[IMP] base, account, l10n_ch, website_sale, payment, web: make payment QR-code generation more generic
This new modelling makes it easier to add new QR-code formats, and allows using all of them in website_sale and account.payment's form view as well (so, Swiss QR codes are now available there, while they were restricted to only invoices in the past). All barcodes are now generated as reports, from a dedicated route. This was only partly the case before : Swiss QR added a cross on top of the QR-code directly in the template, it wasn't part of the image returned by the route; now it is. [ADD] base_qr_code_sepa: new module decoupling SEPA QR-codes generation from the base module Each new QR-code generation option should thus be done in a dedicated module (or added to a localization) in the future. [IMP] base_qr_code_sepa: update the generated QR codes to version 2 of the specification Version 1 is still supported, so no need to backport this. [IMP] l10n_ch: make Swiss QR-codes compatible with the new version of the specification (the old one is deprecated) This will be backported to 11.0 and 12.0, as these QR-codes will soon replace ISR. [IMP] account: make it possible to mark manual payments as sent with a button on the form view This way, when making them directly with a QR-code (or doing a more classical wire transfer), people can keep track of what they already have asked the bank to do, and what they still have to treat. closes odoo/odoo#44839 Related: odoo/enterprise#8262 Related: odoo/upgrade#992 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Diffstat (limited to 'addons/web/controllers')
-rw-r--r--addons/web/controllers/main.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index 3b0e2e27f28..b450663cd46 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -1991,7 +1991,7 @@ class ReportController(http.Controller):
# Misc. route utils
#------------------------------------------------------
@http.route(['/report/barcode', '/report/barcode/<type>/<path:value>'], type='http', auth="public")
- def report_barcode(self, type, value, width=600, height=100, humanreadable=0, quiet=1):
+ def report_barcode(self, type, value, width=600, height=100, humanreadable=0, quiet=1, mask=None):
"""Contoller able to render barcode images thanks to reportlab.
Samples:
<img t-att-src="'/report/barcode/QR/%s' % o.name"/>
@@ -2005,10 +2005,13 @@ class ReportController(http.Controller):
at the bottom of the output image
:param quiet: Accepted values: 0 (default) or 1. 1 will display white
margins on left and right.
+ :param mask: The mask code to be used when rendering this QR-code.
+ Masks allow adding elements on top of the generated image,
+ such as the Swiss cross in the center of QR-bill codes.
"""
try:
barcode = request.env['ir.actions.report'].barcode(type, value, width=width,
- height=height, humanreadable=humanreadable, quiet=quiet)
+ height=height, humanreadable=humanreadable, quiet=quiet, mask=mask)
except (ValueError, AttributeError):
raise werkzeug.exceptions.HTTPException(description='Cannot convert into barcode.')