mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
Merge pull request #28 from acsone/8.0-fix-get-pdf-v8-api-amu
[8.0] [FIX]: change signature of methods print_document & get_pdf for 8.0 api
This commit is contained in:
@@ -19,12 +19,13 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import models, exceptions, _
|
||||
from openerp import models, exceptions, _, api
|
||||
|
||||
|
||||
class Report(models.Model):
|
||||
_inherit = 'report'
|
||||
|
||||
@api.v7
|
||||
def print_document(self, cr, uid, ids, report_name, html=None,
|
||||
data=None, context=None):
|
||||
""" Print a document, do not return the document file """
|
||||
@@ -43,6 +44,12 @@ class Report(models.Model):
|
||||
)
|
||||
return printer.print_document(report, document, report.report_type)
|
||||
|
||||
@api.v8
|
||||
def print_document(self, records, report_name, html=None, data=None):
|
||||
return self._model.print_document(self._cr, self._uid,
|
||||
records.ids, report_name,
|
||||
html=html, data=data, context=self._context)
|
||||
|
||||
def _can_print_report(self, cr, uid, ids, behaviour, printer, document,
|
||||
context=None):
|
||||
"""Predicate that decide if report can be sent to printer
|
||||
@@ -56,6 +63,7 @@ class Report(models.Model):
|
||||
return True
|
||||
return False
|
||||
|
||||
@api.v7
|
||||
def get_pdf(self, cr, uid, ids, report_name, html=None,
|
||||
data=None, context=None):
|
||||
""" Generate a PDF and returns it.
|
||||
@@ -75,3 +83,9 @@ class Report(models.Model):
|
||||
if can_print_report:
|
||||
printer.print_document(report, document, report.report_type)
|
||||
return document
|
||||
|
||||
@api.v8
|
||||
def get_pdf(self, records, report_name, html=None, data=None):
|
||||
return self._model.get_pdf(self._cr, self._uid,
|
||||
records.ids, report_name,
|
||||
html=html, data=data, context=self._context)
|
||||
Reference in New Issue
Block a user