diff --git a/addons/account/report/report_vat.py b/addons/account/report/report_vat.py
index 79eeccac66c..2d31a5c7a70 100644
--- a/addons/account/report/report_vat.py
+++ b/addons/account/report/report_vat.py
@@ -53,7 +53,6 @@ class tax_report(http.Controller, common_report_header):
}
return request.registry['report'].render(self.cr, self.uid, [], 'account.report_vat', docargs)
-
def _get_basedon(self, form):
return form['form']['based_on']
diff --git a/addons/report/controllers/main.py b/addons/report/controllers/main.py
index af04e5749eb..724d3040e36 100644
--- a/addons/report/controllers/main.py
+++ b/addons/report/controllers/main.py
@@ -360,7 +360,6 @@ class Report(http.Controller):
def _build_wkhtmltopdf_args(self, paperformat, specific_paperformat_args=None):
"""Build arguments understandable by wkhtmltopdf from an ir.actions.report.paperformat
record.
- Sample:
:paperformat: ir.actions.report.paperformat record associated to a document
:specific_paperformat_args: a dict containing prioritized wkhtmltopdf arguments
@@ -456,12 +455,10 @@ class Report(http.Controller):
response.headers.add('Content-Disposition', 'attachment; filename=report.pdf;')
return response
- @http.route([
- '/report/getbarcode//',
- '/report/getbarcode////',
- ], type='http', auth="user")
+ @http.route(['/report/barcode', '/report/barcode//'], type='http', auth="user")
def barcode(self, type, value, width=300, height=50):
"""Contoller able to render barcode images thanks to reportlab.
+ Sample:
:param type: Accepted types: 'Codabar', 'Code11', 'Code128', 'EAN13', 'EAN8', 'Extended39',
'Extended93', 'FIM', 'I2of5', 'MSI', 'POSTNET', 'QR', 'Standard39', 'Standard93',
@@ -469,9 +466,11 @@ class Report(http.Controller):
"""
try:
barcode = createBarcodeImageInMemory(
- type, value=value, format='jpg', width=width, height=height
+ type, value=value, format='png', width=width, height=height
)
except (ValueError, AttributeError):
raise exceptions.HTTPException(description='Cannot convert into barcode.')
+ except AssertionError:
+ raise exceptions.HTTPException(description='Please upgrade reportlab to at least 3.0.')
- return request.make_response(barcode, headers=[('Content-Type', 'image/jpg')])
+ return request.make_response(barcode, headers=[('Content-Type', 'image/png')])
diff --git a/addons/report/models/report_paperformat.py b/addons/report/models/report_paperformat.py
index 188de726f48..975ed779d97 100644
--- a/addons/report/models/report_paperformat.py
+++ b/addons/report/models/report_paperformat.py
@@ -76,7 +76,7 @@ class report_paperformat(osv.Model):
'Orientation'),
'header_line': fields.boolean('Display a header line'),
'header_spacing': fields.integer('Header spacing'),
- 'dpi': fields.integer('Output DPI'),
+ 'dpi': fields.integer('Output DPI', required=True),
'report_ids': fields.one2many('ir.actions.report.xml',
'paperformat_id',
'Associated reports',
@@ -94,6 +94,20 @@ class report_paperformat(osv.Model):
'page width/height.', ['format']),
]
+ _defaults = {
+ 'format': 'A4',
+ 'margin_top': 40,
+ 'margin_bottom': 20,
+ 'margin_left': 7,
+ 'margin_right': 7,
+ 'page_height': False,
+ 'page_width': False,
+ 'orientation': 'Landscape',
+ 'header_line': False,
+ 'header_spacing': 35,
+ 'dpi': 90,
+ }
+
class res_company(osv.Model):
_inherit = 'res.company'