mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[MIG] base_report_to_printer: Migration to 16.0
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
{
|
||||
"name": "Report to printer",
|
||||
"version": "15.0.1.0.0",
|
||||
"version": "16.0.1.0.0",
|
||||
"category": "Generic Modules/Base",
|
||||
"author": "Agile Business Group & Domsense, Pegueroles SCP, NaN,"
|
||||
" LasLabs, Camptocamp, Odoo Community Association (OCA),"
|
||||
|
||||
@@ -101,7 +101,7 @@ class IrActionsReport(models.Model):
|
||||
"""Print a document, do not return the document file"""
|
||||
document, doc_format = self.with_context(
|
||||
must_skip_send_to_printer=True
|
||||
)._render_qweb_pdf(record_ids, data=data)
|
||||
)._render_qweb_pdf(self.report_name, record_ids, data=data)
|
||||
behaviour = self.behaviour()
|
||||
printer = behaviour.pop("printer", None)
|
||||
|
||||
@@ -141,13 +141,15 @@ class IrActionsReport(models.Model):
|
||||
res["id"] = self.id
|
||||
return res
|
||||
|
||||
def _render_qweb_pdf(self, res_ids=None, data=None):
|
||||
def _render_qweb_pdf(self, report_ref, res_ids=None, data=None):
|
||||
"""Generate a PDF and returns it.
|
||||
|
||||
If the action configured on the report is server, it prints the
|
||||
generated document as well.
|
||||
"""
|
||||
document, doc_format = super()._render_qweb_pdf(res_ids=res_ids, data=data)
|
||||
document, doc_format = super()._render_qweb_pdf(
|
||||
report_ref=report_ref, res_ids=res_ids, data=data
|
||||
)
|
||||
|
||||
behaviour = self.behaviour()
|
||||
printer = behaviour.pop("printer", None)
|
||||
|
||||
@@ -12,3 +12,4 @@
|
||||
* Rod Schouteden <rod@schout-it.be>
|
||||
* Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
|
||||
* Matias Peralta <mnp@adhoc.com.ar>
|
||||
* Hughes Damry <hughes.damry@acsone.eu>
|
||||
|
||||
@@ -95,7 +95,7 @@ class TestPrintingServer(TransactionCase):
|
||||
"""It should update status even if printer is archived"""
|
||||
rec_id = self.new_printer()
|
||||
rec_id.toggle_active()
|
||||
self.server.refresh()
|
||||
self.server.invalidate_model()
|
||||
cups.Connection().getPrinters().get.return_value = False
|
||||
self.Model.action_update_printers()
|
||||
self.assertEqual(
|
||||
|
||||
@@ -92,7 +92,7 @@ class TestReport(common.HttpCase):
|
||||
"printing_printer.PrintingPrinter."
|
||||
"print_document"
|
||||
) as print_document:
|
||||
self.report._render_qweb_pdf(self.partners.ids)
|
||||
self.report._render_qweb_pdf(self.report.report_name, self.partners.ids)
|
||||
print_document.assert_not_called()
|
||||
|
||||
def test_render_qweb_pdf_printable(self):
|
||||
@@ -104,7 +104,9 @@ class TestReport(common.HttpCase):
|
||||
) as print_document:
|
||||
self.report.property_printing_action_id.action_type = "server"
|
||||
self.report.printing_printer_id = self.new_printer()
|
||||
document = self.report._render_qweb_pdf(self.partners.ids)
|
||||
document = self.report._render_qweb_pdf(
|
||||
self.report.report_name, self.partners.ids
|
||||
)
|
||||
print_document.assert_called_once_with(
|
||||
self.report,
|
||||
document[0],
|
||||
|
||||
Reference in New Issue
Block a user