diff options
| author | Arnold Moyaux <arm@odoo.com> | 2019-06-12 15:39:49 +0000 |
|---|---|---|
| committer | William Henrotin <whe@odoo.com> | 2019-07-31 08:04:38 +0000 |
| commit | caf6cb929b852209e84fa23efd10f58651d18d8e (patch) | |
| tree | f3c5188dd737d3d2538c59f279777a015b91f9dc /addons | |
| parent | bdb61d2c2ffe33fb48d8ffc6a8fe8bfaee8cb7ce (diff) | |
[IMP] base, web: barcode drawer remove margins
The purpose of quiet parameter is to return a barcode image
without left and right margins.
It could be usefull on report where the barcode size should be
minize or align to another element.
closes odoo/odoo#29209
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/web/controllers/main.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 0a178431f2a..befdc0a2c8b 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1784,7 +1784,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): + def report_barcode(self, type, value, width=600, height=100, humanreadable=0, quiet=1): """Contoller able to render barcode images thanks to reportlab. Samples: <img t-att-src="'/report/barcode/QR/%s' % o.name"/> @@ -1796,9 +1796,12 @@ class ReportController(http.Controller): 'UPCA', 'USPS_4State' :param humanreadable: Accepted values: 0 (default) or 1. 1 will insert the readable value at the bottom of the output image + :param quiet: Accepted values: 0 (default) or 1. 1 will display white + margins on left and right. """ try: - barcode = request.env['ir.actions.report'].barcode(type, value, width=width, height=height, humanreadable=humanreadable) + barcode = request.env['ir.actions.report'].barcode(type, value, width=width, + height=height, humanreadable=humanreadable, quiet=quiet) except (ValueError, AttributeError): raise werkzeug.exceptions.HTTPException(description='Cannot convert into barcode.') |
