Merge PR #378 into 15.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2024-11-12 07:13:57 +00:00
7 changed files with 155 additions and 85 deletions

View File

@@ -106,6 +106,13 @@ Guidelines for use:
When no tray is configured for a report and a user, the When no tray is configured for a report and a user, the
default tray setup on the CUPS server is used. default tray setup on the CUPS server is used.
Known issues / Roadmap
======================
- With threaded printing there's no download fallback when the issue isn't detected by
the CUPS Odoo backend. To able to do it, we would need to notify the bus or use
web_notify for it.
Changelog Changelog
========= =========

View File

@@ -6,6 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 15.0\n" "Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-11 16:21+0000\n"
"PO-Revision-Date: 2024-11-11 16:21+0000\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@@ -379,6 +381,13 @@ msgstr ""
msgid "If checked, this server is useable." msgid "If checked, this server is useable."
msgstr "" msgstr ""
#. module: base_report_to_printer
#. openerp-web
#: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0
#, python-format
msgid "Issue on"
msgstr ""
#. module: base_report_to_printer #. module: base_report_to_printer
#: model_terms:ir.ui.view,arch_db:base_report_to_printer.printing_job_view_form #: model_terms:ir.ui.view,arch_db:base_report_to_printer.printing_job_view_form
msgid "Job" msgid "Job"
@@ -552,8 +561,11 @@ msgid "Port of the server."
msgstr "" msgstr ""
#. module: base_report_to_printer #. module: base_report_to_printer
#. openerp-web
#: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0
#: model_terms:ir.ui.view,arch_db:base_report_to_printer.act_report_xml_view #: model_terms:ir.ui.view,arch_db:base_report_to_printer.act_report_xml_view
#: model_terms:ir.ui.view,arch_db:base_report_to_printer.wizard_print_attachment_form #: model_terms:ir.ui.view,arch_db:base_report_to_printer.wizard_print_attachment_form
#, python-format
msgid "Print" msgid "Print"
msgstr "" msgstr ""
@@ -828,7 +840,7 @@ msgstr ""
#. openerp-web #. openerp-web
#: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0 #: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0
#, python-format #, python-format
msgid "The printer couldn't be reached. Downloading document instead" msgid "The report"
msgstr "" msgstr ""
#. module: base_report_to_printer #. module: base_report_to_printer
@@ -950,6 +962,13 @@ msgstr ""
msgid "Wizard" msgid "Wizard"
msgstr "" msgstr ""
#. module: base_report_to_printer
#. openerp-web
#: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0
#, python-format
msgid "couldn't be printed. Click on the button below to download it"
msgstr ""
#. module: base_report_to_printer #. module: base_report_to_printer
#: code:addons/base_report_to_printer/wizards/print_attachment_report.py:0 #: code:addons/base_report_to_printer/wizards/print_attachment_report.py:0
#, python-format #, python-format

View File

@@ -1,23 +1,21 @@
# Translation of Odoo Server. # Translation of Odoo Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * base_report_to_printer # * base_report_to_printer
# #
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 11.0\n" "Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-19 03:38+0000\n" "POT-Creation-Date: 2024-11-11 16:26+0000\n"
"PO-Revision-Date: 2023-10-16 19:36+0000\n" "PO-Revision-Date: 2024-11-11 17:27+0100\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n" "Last-Translator: \n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" "Language-Team: \n"
"Language: es\n" "Language: es\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Weblate 4.17\n" "X-Generator: Poedit 3.4.4\n"
#. module: base_report_to_printer #. module: base_report_to_printer
#: model:ir.model.fields.selection,name:base_report_to_printer.selection__printing_job__job_state__aborted #: model:ir.model.fields.selection,name:base_report_to_printer.selection__printing_job__job_state__aborted
@@ -59,7 +57,8 @@ msgstr "Archivado"
#. module: base_report_to_printer #. module: base_report_to_printer
#: model_terms:ir.ui.view,arch_db:base_report_to_printer.printing_printer_view_form #: model_terms:ir.ui.view,arch_db:base_report_to_printer.printing_printer_view_form
msgid "Are you sure to want to cancel all jobs of this printer?" msgid "Are you sure to want to cancel all jobs of this printer?"
msgstr "¿Estás seguro que quieres cancelar todos los trabajos de la impresora?" msgstr ""
"¿Estás seguro que quieres cancelar todos los trabajos de la impresora?"
#. module: base_report_to_printer #. module: base_report_to_printer
#: model_terms:ir.ui.view,arch_db:base_report_to_printer.printing_printer_view_form #: model_terms:ir.ui.view,arch_db:base_report_to_printer.printing_printer_view_form
@@ -298,7 +297,7 @@ msgstr "Política de cifrado para conectar al servidor. Vacía por defecto."
#. module: base_report_to_printer #. module: base_report_to_printer
#: model:ir.model.fields.selection,name:base_report_to_printer.selection__printing_printer__status__error #: model:ir.model.fields.selection,name:base_report_to_printer.selection__printing_printer__status__error
msgid "Error" msgid "Error"
msgstr "Error" msgstr ""
#. module: base_report_to_printer #. module: base_report_to_printer
#: model:ir.model.fields.selection,name:base_report_to_printer.selection__printing_job__job_state_reason__compression-error #: model:ir.model.fields.selection,name:base_report_to_printer.selection__printing_job__job_state_reason__compression-error
@@ -314,8 +313,8 @@ msgstr "Error en el documento"
#: code:addons/base_report_to_printer/models/printing_server.py:0 #: code:addons/base_report_to_printer/models/printing_server.py:0
#, python-format #, python-format
msgid "" msgid ""
"Failed to connect to the CUPS server on %(address)s:%(port)s. Check that the " "Failed to connect to the CUPS server on %(address)s:%(port)s. Check that "
"CUPS server is running and that you can reach it from the Odoo server." "the CUPS server is running and that you can reach it from the Odoo server."
msgstr "" msgstr ""
"Ha fallado la conexión al servidor CUPS en %(address)s:%(port)s. Compruebe " "Ha fallado la conexión al servidor CUPS en %(address)s:%(port)s. Compruebe "
"que el servidor CUPS está en funcionamiento y que el servidor de Odoo tiene " "que el servidor CUPS está en funcionamiento y que el servidor de Odoo tiene "
@@ -379,7 +378,7 @@ msgstr "Retenido por que la impresora está desconectada"
#: model:ir.model.fields,field_description:base_report_to_printer.field_wizard_print_attachment__id #: model:ir.model.fields,field_description:base_report_to_printer.field_wizard_print_attachment__id
#: model:ir.model.fields,field_description:base_report_to_printer.field_wizard_print_attachment_line__id #: model:ir.model.fields,field_description:base_report_to_printer.field_wizard_print_attachment_line__id
msgid "ID" msgid "ID"
msgstr "ID" msgstr ""
#. module: base_report_to_printer #. module: base_report_to_printer
#: model:ir.model.fields,help:base_report_to_printer.field_printing_server__address #: model:ir.model.fields,help:base_report_to_printer.field_printing_server__address
@@ -391,6 +390,13 @@ msgstr "Dirección IP o nombre del servidor"
msgid "If checked, this server is useable." msgid "If checked, this server is useable."
msgstr "Si está marcado, el servidor es utilizable." msgstr "Si está marcado, el servidor es utilizable."
#. module: base_report_to_printer
#. openerp-web
#: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0
#, python-format
msgid "Issue on"
msgstr "Incidencia en"
#. module: base_report_to_printer #. module: base_report_to_printer
#: model_terms:ir.ui.view,arch_db:base_report_to_printer.printing_job_view_form #: model_terms:ir.ui.view,arch_db:base_report_to_printer.printing_job_view_form
msgid "Job" msgid "Job"
@@ -480,7 +486,7 @@ msgstr "Modelo"
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__multi_thread #: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__multi_thread
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__multi_thread #: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__multi_thread
msgid "Multi Thread" msgid "Multi Thread"
msgstr "" msgstr "Multi Hilo"
#. module: base_report_to_printer #. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_action__name #: model:ir.model.fields,field_description:base_report_to_printer.field_printing_action__name
@@ -515,7 +521,7 @@ msgstr "Sin razón"
#. module: base_report_to_printer #. module: base_report_to_printer
#: model_terms:ir.ui.view,arch_db:base_report_to_printer.printer_update_wizard #: model_terms:ir.ui.view,arch_db:base_report_to_printer.printer_update_wizard
msgid "Ok" msgid "Ok"
msgstr "Ok" msgstr ""
#. module: base_report_to_printer #. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_ir_actions_report__printer_tray_id #: model:ir.model.fields,field_description:base_report_to_printer.field_ir_actions_report__printer_tray_id
@@ -564,8 +570,11 @@ msgid "Port of the server."
msgstr "Puerto del servidor." msgstr "Puerto del servidor."
#. module: base_report_to_printer #. module: base_report_to_printer
#. openerp-web
#: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0
#: model_terms:ir.ui.view,arch_db:base_report_to_printer.act_report_xml_view #: model_terms:ir.ui.view,arch_db:base_report_to_printer.act_report_xml_view
#: model_terms:ir.ui.view,arch_db:base_report_to_printer.wizard_print_attachment_form #: model_terms:ir.ui.view,arch_db:base_report_to_printer.wizard_print_attachment_form
#, python-format
msgid "Print" msgid "Print"
msgstr "Imprimir" msgstr "Imprimir"
@@ -657,7 +666,7 @@ msgstr "Lista de impresoras"
#: model:ir.ui.menu,name:base_report_to_printer.printing_menu #: model:ir.ui.menu,name:base_report_to_printer.printing_menu
#: model_terms:ir.ui.view,arch_db:base_report_to_printer.view_users_form #: model_terms:ir.ui.view,arch_db:base_report_to_printer.view_users_form
msgid "Printing" msgid "Printing"
msgstr "Impresión" msgstr "Imprimiendo"
#. module: base_report_to_printer #. module: base_report_to_printer
#: model:res.groups,name:base_report_to_printer.printing_group_manager #: model:res.groups,name:base_report_to_printer.printing_group_manager
@@ -727,7 +736,7 @@ msgstr "Informe"
#. module: base_report_to_printer #. module: base_report_to_printer
#: model:ir.model,name:base_report_to_printer.model_ir_actions_report #: model:ir.model,name:base_report_to_printer.model_ir_actions_report
msgid "Report Action" msgid "Report Action"
msgstr "Informar Acción" msgstr "Acción de informe"
#. module: base_report_to_printer #. module: base_report_to_printer
#: model_terms:ir.ui.view,arch_db:base_report_to_printer.printing_report_xml_action_view_form #: model_terms:ir.ui.view,arch_db:base_report_to_printer.printing_report_xml_action_view_form
@@ -840,8 +849,8 @@ msgstr "El ID del trabajo debe ser único por servidor !"
#. openerp-web #. openerp-web
#: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0 #: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0
#, python-format #, python-format
msgid "The printer couldn't be reached. Downloading document instead" msgid "The report"
msgstr "" msgstr "El informe"
#. module: base_report_to_printer #. module: base_report_to_printer
#: model:ir.model.fields,help:base_report_to_printer.field_ir_actions_report__printing_action_ids #: model:ir.model.fields,help:base_report_to_printer.field_ir_actions_report__printing_action_ids
@@ -851,7 +860,8 @@ msgstr "Este campo permite configurar acción e impresora a nivel de usuario"
#. module: base_report_to_printer #. module: base_report_to_printer
#: model_terms:ir.ui.view,arch_db:base_report_to_printer.printer_update_wizard #: model_terms:ir.ui.view,arch_db:base_report_to_printer.printer_update_wizard
msgid "" msgid ""
"This process will create all missing printers from the current CUPS server.\"" "This process will create all missing printers from the current CUPS server."
"\""
msgstr "" msgstr ""
"Este proceso creará todas las impresoras que falten desde el servidor CUPS " "Este proceso creará todas las impresoras que falten desde el servidor CUPS "
"actual" "actual"
@@ -890,7 +900,7 @@ msgstr "Tipo"
#. module: base_report_to_printer #. module: base_report_to_printer
#: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__uri #: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__uri
msgid "URI" msgid "URI"
msgstr "URI" msgstr ""
#. module: base_report_to_printer #. module: base_report_to_printer
#: model:ir.model.fields.selection,name:base_report_to_printer.selection__printing_printer__status__unavailable #: model:ir.model.fields.selection,name:base_report_to_printer.selection__printing_printer__status__unavailable
@@ -963,37 +973,15 @@ msgstr "Usuarios"
msgid "Wizard" msgid "Wizard"
msgstr "Asistente" msgstr "Asistente"
#. module: base_report_to_printer
#. openerp-web
#: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0
#, python-format
msgid "couldn't be printed. Click on the button below to download it"
msgstr "no se ha podido imprimir. Pulsar en el botón para descargarlo"
#. module: base_report_to_printer #. module: base_report_to_printer
#: code:addons/base_report_to_printer/wizards/print_attachment_report.py:0 #: code:addons/base_report_to_printer/wizards/print_attachment_report.py:0
#, python-format #, python-format
msgid "{name} ({copies} copies)" msgid "{name} ({copies} copies)"
msgstr "{name} ({copies} copies) :{name} ({copies} copias)" msgstr "{name} ({copies} copies) :{name} ({copies} copias)"
#, python-format
#~ msgid "Document sent to the printer %s"
#~ msgstr "Documento enviado a la impresora %s"
#, python-format
#~ msgid "Error when sending the document to the printer "
#~ msgstr "Error enviando el documento a la impresora "
#, 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 ""
#~ "Ha fallado la conexión al servidor CUPS %s:%s. Comprueba que el servidor "
#~ "CUPS está funcionando y que el servidor de Odoo puede comunicarse con él."
#~ msgid ""
#~ "This process will create all missing printers from the current CUPS "
#~ "server."
#~ msgstr ""
#~ "Este proceso creará las impresoras no configurada del servidor CUPS "
#~ "actual."
#~ msgid "or"
#~ msgstr "o"
#~ msgid "ir.actions.report"
#~ msgstr "ir.actions.report"

View File

@@ -59,6 +59,8 @@ class IrActionsReport(models.Model):
"skip_printer_exception" "skip_printer_exception"
): ):
serializable_result["printer_exception"] = True serializable_result["printer_exception"] = True
if self.env.context.get("force_print_to_client"):
serializable_result["action"] = "client"
return serializable_result return serializable_result
def _get_user_default_print_behaviour(self): def _get_user_default_print_behaviour(self):
@@ -135,7 +137,10 @@ class IrActionsReport(models.Model):
return True return True
else: else:
return self.print_document(record_ids, data=data) try:
return self.print_document(record_ids, data=data)
except Exception:
return
def print_document_threaded(self, report_id, record_ids, data): def print_document_threaded(self, report_id, record_ids, data):
with registry(self._cr.dbname).cursor() as cr: with registry(self._cr.dbname).cursor() as cr:
@@ -171,6 +176,7 @@ class IrActionsReport(models.Model):
else: else:
title = self.report_name title = self.report_name
behaviour["title"] = title behaviour["title"] = title
behaviour["res_ids"] = record_ids
# TODO should we use doc_format instead of report_type # TODO should we use doc_format instead of report_type
return printer.print_document( return printer.print_document(
self, document, doc_format=self.report_type, **behaviour self, document, doc_format=self.report_type, **behaviour

View File

@@ -0,0 +1,3 @@
- With threaded printing there's no download fallback when the issue isn't detected by
the CUPS Odoo backend. To able to do it, we would need to notify the bus or use
web_notify for it.

View File

@@ -396,16 +396,17 @@ preprinted paper such as payment slip.</p>
<li><a class="reference internal" href="#installation" id="toc-entry-1">Installation</a></li> <li><a class="reference internal" href="#installation" id="toc-entry-1">Installation</a></li>
<li><a class="reference internal" href="#configuration" id="toc-entry-2">Configuration</a></li> <li><a class="reference internal" href="#configuration" id="toc-entry-2">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-3">Usage</a></li> <li><a class="reference internal" href="#usage" id="toc-entry-3">Usage</a></li>
<li><a class="reference internal" href="#changelog" id="toc-entry-4">Changelog</a><ul> <li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-4">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#section-1" id="toc-entry-5">13.0.1.0.0 (2019-09-30)</a></li> <li><a class="reference internal" href="#changelog" id="toc-entry-5">Changelog</a><ul>
<li><a class="reference internal" href="#section-2" id="toc-entry-6">12.0.1.0.0 (2018-02-04)</a></li> <li><a class="reference internal" href="#section-1" id="toc-entry-6">13.0.1.0.0 (2019-09-30)</a></li>
<li><a class="reference internal" href="#section-2" id="toc-entry-7">12.0.1.0.0 (2018-02-04)</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-7">Bug Tracker</a></li> <li><a class="reference internal" href="#bug-tracker" id="toc-entry-8">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-8">Credits</a><ul> <li><a class="reference internal" href="#credits" id="toc-entry-9">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-9">Authors</a></li> <li><a class="reference internal" href="#authors" id="toc-entry-10">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-10">Contributors</a></li> <li><a class="reference internal" href="#contributors" id="toc-entry-11">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-11">Maintainers</a></li> <li><a class="reference internal" href="#maintainers" id="toc-entry-12">Maintainers</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@@ -456,23 +457,31 @@ change these in <em>Settings &gt; Printing &gt; Reports</em> in
<p>When no tray is configured for a report and a user, the <p>When no tray is configured for a report and a user, the
default tray setup on the CUPS server is used.</p> default tray setup on the CUPS server is used.</p>
</div> </div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-4">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>With threaded printing theres no download fallback when the issue isnt detected by
the CUPS Odoo backend. To able to do it, we would need to notify the bus or use
web_notify for it.</li>
</ul>
</div>
<div class="section" id="changelog"> <div class="section" id="changelog">
<h1><a class="toc-backref" href="#toc-entry-4">Changelog</a></h1> <h1><a class="toc-backref" href="#toc-entry-5">Changelog</a></h1>
<div class="section" id="section-1"> <div class="section" id="section-1">
<h2><a class="toc-backref" href="#toc-entry-5">13.0.1.0.0 (2019-09-30)</a></h2> <h2><a class="toc-backref" href="#toc-entry-6">13.0.1.0.0 (2019-09-30)</a></h2>
<ul class="simple"> <ul class="simple">
<li>[RELEASE] Port from V12.</li> <li>[RELEASE] Port from V12.</li>
</ul> </ul>
</div> </div>
<div class="section" id="section-2"> <div class="section" id="section-2">
<h2><a class="toc-backref" href="#toc-entry-6">12.0.1.0.0 (2018-02-04)</a></h2> <h2><a class="toc-backref" href="#toc-entry-7">12.0.1.0.0 (2018-02-04)</a></h2>
<ul class="simple"> <ul class="simple">
<li>[RELEASE] Port from V11.</li> <li>[RELEASE] Port from V11.</li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-7">Bug Tracker</a></h1> <h1><a class="toc-backref" href="#toc-entry-8">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/report-print-send/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/report-print-send/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
@@ -480,9 +489,9 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-8">Credits</a></h1> <h1><a class="toc-backref" href="#toc-entry-9">Credits</a></h1>
<div class="section" id="authors"> <div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-9">Authors</a></h2> <h2><a class="toc-backref" href="#toc-entry-10">Authors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Agile Business Group &amp; Domsense</li> <li>Agile Business Group &amp; Domsense</li>
<li>Pegueroles SCP</li> <li>Pegueroles SCP</li>
@@ -493,7 +502,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
</ul> </ul>
</div> </div>
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-10">Contributors</a></h2> <h2><a class="toc-backref" href="#toc-entry-11">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Ferran Pegueroles &lt;<a class="reference external" href="mailto:ferran&#64;pegueroles.com">ferran&#64;pegueroles.com</a>&gt;</li> <li>Ferran Pegueroles &lt;<a class="reference external" href="mailto:ferran&#64;pegueroles.com">ferran&#64;pegueroles.com</a>&gt;</li>
<li>Albert Cervera i Areny &lt;<a class="reference external" href="mailto:albert&#64;nan-tic.com">albert&#64;nan-tic.com</a>&gt;</li> <li>Albert Cervera i Areny &lt;<a class="reference external" href="mailto:albert&#64;nan-tic.com">albert&#64;nan-tic.com</a>&gt;</li>
@@ -518,7 +527,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h2> <h2><a class="toc-backref" href="#toc-entry-12">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p> <p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"> <a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /> <img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />

View File

@@ -1,4 +1,5 @@
/** @odoo-module */ /** @odoo-module */
import {Markup} from "web.utils";
import {registry} from "@web/core/registry"; import {registry} from "@web/core/registry";
async function cupsReportActionHandler(action, options, env) { async function cupsReportActionHandler(action, options, env) {
@@ -8,13 +9,12 @@ async function cupsReportActionHandler(action, options, env) {
const print_action = await orm.call( const print_action = await orm.call(
"ir.actions.report", "ir.actions.report",
"print_action_for_report_name", "print_action_for_report_name",
[action.report_name] [action.report_name],
{context: {force_print_to_client: action.context.force_print_to_client}}
); );
if ( var printer_exception = print_action.printer_exception;
print_action && if (print_action && print_action.action === "server" && !printer_exception) {
print_action.action === "server" && // The Odoo CUPS backend is ok. We try to print into the printer
!print_action.printer_exception
) {
const result = await orm.call( const result = await orm.call(
"ir.actions.report", "ir.actions.report",
"print_document_client_action", "print_document_client_action",
@@ -24,20 +24,58 @@ async function cupsReportActionHandler(action, options, env) {
env.services.notification.add(env._t("Successfully sent to printer!"), { env.services.notification.add(env._t("Successfully sent to printer!"), {
type: "success", type: "success",
}); });
} else { return true;
env.services.notification.add(env._t("Could not sent to printer!"), { // In case of exception during the job, we won't get any response. So we
type: "danger", // should flag the exception and notify the user
});
} }
return true; env.services.notification.add(env._t("Could not sent to printer!"), {
type: "danger",
});
printer_exception = true;
} }
if (print_action.printer_exception) { if (print_action && print_action.action === "server" && printer_exception) {
env.services.notification.add( // Just so the translation engine detects them as it doesn't do it inside
env._t("The printer couldn't be reached. Downloading document instead"), // template strings
const terms = {
the_report: env._t("The report"),
couldnt_be_printed: env._t(
"couldn't be printed. Click on the button below to download it"
),
issue_on: env._t("Issue on"),
};
const notificationRemove = env.services.notification.add(
Markup(
`<p>${terms.the_report} <strong>${action.name}</strong> ${terms.couldnt_be_printed}</p>`
),
{ {
title: `${terms.issue_on} ${print_action.printer_name}`,
type: "warning", type: "warning",
sticky: true,
messageIsHtml: true,
buttons: [
{
name: env._t("Print"),
primary: true,
icon: "fa-print",
onClick: async () => {
const context = {
force_print_to_client: true,
must_skip_send_to_printer: true,
};
env.services.user.updateContext(context);
await env.services.action.doAction(
{type: "ir.actions.report", ...action},
{
additionalContext: context,
}
);
notificationRemove();
},
},
],
} }
); );
return true;
} }
} }
} }