Skip to content

Commit

Permalink
[MIG] base_report_to_printer: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
glitchov committed Dec 7, 2022
1 parent a697ac3 commit 7e0cae4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion base_report_to_printer/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),"
Expand Down
7 changes: 4 additions & 3 deletions base_report_to_printer/models/ir_actions_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def print_document(self, record_ids, data=None):
"""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)

Expand Down Expand Up @@ -141,13 +141,14 @@ def report_action(self, docids, data=None, config=True):
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)
Expand Down
1 change: 1 addition & 0 deletions base_report_to_printer/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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>
2 changes: 1 addition & 1 deletion base_report_to_printer/tests/test_printing_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_update_archived_printers(self, cups):
"""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(
Expand Down
4 changes: 2 additions & 2 deletions base_report_to_printer/tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_render_qweb_pdf_not_printable(self):
"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):
Expand All @@ -104,7 +104,7 @@ def test_render_qweb_pdf_printable(self):
) 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],
Expand Down

0 comments on commit 7e0cae4

Please sign in to comment.