Fix set the skip directive in context

instead of a faulty return
This commit is contained in:
Nicolas Bessi
2015-01-30 14:39:23 +01:00
committed by Guewen Baconnier
parent 6934e02fa5
commit cd8455e287

View File

@@ -43,8 +43,12 @@ class Report(models.Model):
def print_document(self, cr, uid, ids, report_name, html=None,
data=None, context=None):
""" Print a document, do not return the document file """
if context is None:
context = self.pool['res.users'].context_get(cr, uid)
local_context = dict(context)
local_context['must_skip_sent_to_printer'] = True
document = self.get_pdf(cr, uid, ids, report_name,
html=html, data=data, context=context)
html=html, data=data, context=local_context)
report = self._get_report_from_name(cr, uid, report_name)
behaviour = report.behaviour()[report.id]
printer = behaviour['printer']
@@ -73,7 +77,6 @@ class Report(models.Model):
behaviour, printer, document,
context=context)
if can_send_report:
sent = printer.print_document(report, document, report.report_type)
printer.print_document(report, document, report.report_type)
context['must_skip_sent_to_printer'] = True
return sent
return document