From fb93cf3b91f43f20432787a9ca9396f58a3c3d16 Mon Sep 17 00:00:00 2001 From: "Adrien Peiffer (ACSONE)" Date: Wed, 17 Jun 2015 10:52:57 +0200 Subject: [PATCH] [FIX] mis_builder: in some cases with other report, ids isn't initialized --- mis_builder/report/report_mis_report_instance.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mis_builder/report/report_mis_report_instance.py b/mis_builder/report/report_mis_report_instance.py index 72dc3b9d..9305081c 100644 --- a/mis_builder/report/report_mis_report_instance.py +++ b/mis_builder/report/report_mis_report_instance.py @@ -55,12 +55,13 @@ class Report(models.Model): @api.v7 def get_pdf(self, cr, uid, ids, report_name, html=None, data=None, context=None): - report = self._get_report_from_name(cr, uid, report_name) - obj = self.pool[report.model].browse(cr, uid, ids, - context=context)[0] - context = context.copy() - if hasattr(obj, 'landscape_pdf') and obj.landscape_pdf: - context.update({'landscape': True}) + if ids: + report = self._get_report_from_name(cr, uid, report_name) + obj = self.pool[report.model].browse(cr, uid, ids, + context=context)[0] + context = context.copy() + if hasattr(obj, 'landscape_pdf') and obj.landscape_pdf: + context.update({'landscape': True}) return super(Report, self).get_pdf(cr, uid, ids, report_name, html=html, data=data, context=context)