Skip to content

Commit

Permalink
Do no longer returns a PDF when a report is printed
Browse files Browse the repository at this point in the history
Instead, a notification is displayed to the user.
When report.get_pdf() is called on a report that must be printer,
it will print the report *and* returns the pdf, thus code that
calls directly report.get_pdf() will print the pdf on the printer
as expected.

Fixes OCA#16
  • Loading branch information
guewen authored and trisdoan committed Oct 14, 2024
1 parent 9791680 commit 358088b
Show file tree
Hide file tree
Showing 8 changed files with 225 additions and 71 deletions.
11 changes: 8 additions & 3 deletions base_report_to_printer/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This module allows users to send reports to a printer attached to the server.

It adds an optional behaviour on reports to send it directly to a printer.

* `Send to Client` is the default behavious providing you a downloadable PDF
* `Send to Client` is the default behaviour providing you a downloadable PDF
* `Send to Printer` prints the report on selected printer

Report behaviour is defined by settings.
Expand All @@ -23,13 +23,18 @@ After installing enable the "Printing / Print Operator" option under access
rights to give users the ability to view the print menu.


To show all available printers for your server, uses
To show all available printers for your server, use the
`Settings/Configuration/Printing/Update Printers from CUPS` wizard.


Then goto the user profile and set the users printing action and default
Then go to the user profile and set the users printing action and default
printer.

Caveat
------

The notification when a report is sent to a printer will not be
displayed for the deprecated report types (RML, Webkit, ...).

Dependencies
------------
Expand Down
1 change: 1 addition & 0 deletions base_report_to_printer/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'security/security.xml',
'printing_data.xml',
'printing_view.xml',
'base_report_to_printer.xml',
'wizard/update_printers.xml',
],
'installable': True,
Expand Down
11 changes: 11 additions & 0 deletions base_report_to_printer/base_report_to_printer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="base_report_to_printer assets" inherit_id="report.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/base_report_to_printer/static/src/js/qwebactionmanager.js"></script>
</xpath>
</template>
</data>
</openerp>

100 changes: 65 additions & 35 deletions base_report_to_printer/i18n/base_report_to_printer.pot
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# Translation of OpenERP Server.
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_report_to_printer
# * base_report_to_printer
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-11-05 14:48+0000\n"
"PO-Revision-Date: 2014-11-17 12:50+0000\n"
"POT-Creation-Date: 2015-01-21 14:44+0000\n"
"PO-Revision-Date: 2015-01-21 14:44+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
Expand Down Expand Up @@ -38,16 +37,22 @@ msgid "Cancel"
msgstr ""

#. module: base_report_to_printer
#: field:printing.action,create_uid:0 field:printing.printer,create_uid:0
#: field:printing.printer.polling,create_uid:0
#: code:addons/base_report_to_printer/wizard/update_printers.py:50
#, python-format
msgid "Could not get the list of printers from the CUPS server (%s:%s)"
msgstr ""

#. module: base_report_to_printer
#: field:printing.action,create_uid:0
#: field:printing.printer,create_uid:0
#: field:printing.printer.update.wizard,create_uid:0
#: field:printing.report.xml.action,create_uid:0
msgid "Created by"
msgstr ""

#. module: base_report_to_printer
#: field:printing.action,create_date:0 field:printing.printer,create_date:0
#: field:printing.printer.polling,create_date:0
#: field:printing.action,create_date:0
#: field:printing.printer,create_date:0
#: field:printing.printer.update.wizard,create_date:0
#: field:printing.report.xml.action,create_date:0
msgid "Created on"
Expand All @@ -63,40 +68,55 @@ msgstr ""
msgid "Default Printer"
msgstr ""

#. module: base_report_to_printer
#. openerp-web
#: code:addons/base_report_to_printer/static/src/js/qwebactionmanager.js:27
#, python-format
msgid "Document sent to the printer "
msgstr ""

#. module: base_report_to_printer
#: selection:printing.printer,status:0
msgid "Error"
msgstr ""

#. module: base_report_to_printer
#: field:printing.action,id:0 field:printing.printer,id:0
#: field:printing.printer.polling,id:0
#. openerp-web
#: code:addons/base_report_to_printer/static/src/js/qwebactionmanager.js:30
#, python-format
msgid "Error when sending the document to the printer "
msgstr ""

#. module: base_report_to_printer
#: code:addons/base_report_to_printer/printing.py:140
#, python-format
msgid "Failed to connect to the CUPS server on %s:%s. Check that the CUPS server is running and that you can reach it from the Odoo server."
msgstr ""

#. module: base_report_to_printer
#: field:printing.action,id:0
#: field:printing.printer,id:0
#: field:printing.printer.update.wizard,id:0
#: field:printing.report.xml.action,id:0
msgid "ID"
msgstr ""

#. module: base_report_to_printer
#: field:printing.action,write_uid:0 field:printing.printer,write_uid:0
#: field:printing.printer.polling,write_uid:0
#: field:printing.action,write_uid:0
#: field:printing.printer,write_uid:0
#: field:printing.printer.update.wizard,write_uid:0
#: field:printing.report.xml.action,write_uid:0
msgid "Last Updated by"
msgstr ""

#. module: base_report_to_printer
#: field:printing.action,write_date:0 field:printing.printer,write_date:0
#: field:printing.printer.polling,write_date:0
#: field:printing.action,write_date:0
#: field:printing.printer,write_date:0
#: field:printing.printer.update.wizard,write_date:0
#: field:printing.report.xml.action,write_date:0
msgid "Last Updated on"
msgstr ""

#. module: base_report_to_printer
#: field:printing.printer.polling,last_update:0
msgid "Last update"
msgstr ""

#. module: base_report_to_printer
#: field:printing.printer,location:0
msgid "Location"
Expand All @@ -108,10 +128,17 @@ msgid "Model"
msgstr ""

#. module: base_report_to_printer
#: field:printing.action,name:0 field:printing.printer,name:0
#: field:printing.action,name:0
#: field:printing.printer,name:0
msgid "Name"
msgstr ""

#. module: base_report_to_printer
#: code:addons/base_report_to_printer/ir_report.py:114
#, python-format
msgid "No printer configured to print this report."
msgstr ""

#. module: base_report_to_printer
#: view:res.users:base_report_to_printer.view_printing_users_form
msgid "Preferences"
Expand Down Expand Up @@ -142,11 +169,6 @@ msgstr ""
msgid "Printers"
msgstr ""

#. module: base_report_to_printer
#: model:ir.model,name:base_report_to_printer.model_printing_printer_polling
msgid "Printers Polling"
msgstr ""

#. module: base_report_to_printer
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_main
#: selection:printing.printer,status:0
Expand All @@ -165,8 +187,12 @@ msgid "Printing action"
msgstr ""

#. module: base_report_to_printer
#. openerp-web
#: code:addons/base_report_to_printer/static/src/js/qwebactionmanager.js:26
#: code:addons/base_report_to_printer/static/src/js/qwebactionmanager.js:29
#: model:ir.model,name:base_report_to_printer.model_report
#: field:printing.report.xml.action,report_id:0
#, python-format
msgid "Report"
msgstr ""

Expand Down Expand Up @@ -229,16 +255,19 @@ msgstr ""

#. module: base_report_to_printer
#: view:printing.printer.update.wizard:base_report_to_printer.printer_update_wizard
msgid ""
"This process will create all the missing printers from the current CUPS "
"server."
msgid "This process will create all missing printers from the current CUPS server."
msgstr ""

#. module: base_report_to_printer
#: field:printing.action,type:0
msgid "Type"
msgstr ""

#. module: base_report_to_printer
#: field:printing.printer,uri:0
msgid "URI"
msgstr ""

#. module: base_report_to_printer
#: selection:printing.printer,status:0
msgid "Unavailable"
Expand All @@ -256,11 +285,6 @@ msgstr ""
msgid "Update Printers from CUPS"
msgstr ""

#. module: base_report_to_printer
#: field:printing.printer,uri:0
msgid "URI"
msgstr ""

#. module: base_report_to_printer
#: field:printing.report.xml.action,user_id:0
msgid "User"
Expand All @@ -270,3 +294,9 @@ msgstr ""
#: model:ir.model,name:base_report_to_printer.model_res_users
msgid "Users"
msgstr ""

#. module: base_report_to_printer
#: view:printing.printer.update.wizard:base_report_to_printer.printer_update_wizard
msgid "or"
msgstr ""

Loading

0 comments on commit 358088b

Please sign in to comment.