odoo-addon-base-report-to-printer 16.0.1.1.8.2__py3-none-any.whl → 16.0.1.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of odoo-addon-base-report-to-printer might be problematic. Click here for more details.

Files changed (19) hide show
  1. odoo/addons/base_report_to_printer/README.rst +13 -1
  2. odoo/addons/base_report_to_printer/__manifest__.py +2 -1
  3. odoo/addons/base_report_to_printer/i18n/base_report_to_printer.pot +25 -2
  4. odoo/addons/base_report_to_printer/models/ir_actions_report.py +32 -1
  5. odoo/addons/base_report_to_printer/models/printing_printer.py +10 -2
  6. odoo/addons/base_report_to_printer/models/printing_server.py +6 -0
  7. odoo/addons/base_report_to_printer/readme/CONTRIBUTORS.rst +5 -0
  8. odoo/addons/base_report_to_printer/readme/ROADMAP.rst +3 -0
  9. odoo/addons/base_report_to_printer/security/ir.model.access.csv +2 -0
  10. odoo/addons/base_report_to_printer/static/description/index.html +31 -17
  11. odoo/addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js +57 -19
  12. odoo/addons/base_report_to_printer/tests/test_ir_actions_report.py +17 -0
  13. odoo/addons/base_report_to_printer/tests/test_printing_printer_tray.py +4 -3
  14. odoo/addons/base_report_to_printer/views/printing_printer.xml +1 -0
  15. odoo/addons/base_report_to_printer/views/printing_server.xml +1 -0
  16. {odoo_addon_base_report_to_printer-16.0.1.1.8.2.dist-info → odoo_addon_base_report_to_printer-16.0.1.2.0.dist-info}/METADATA +14 -2
  17. {odoo_addon_base_report_to_printer-16.0.1.1.8.2.dist-info → odoo_addon_base_report_to_printer-16.0.1.2.0.dist-info}/RECORD +19 -17
  18. {odoo_addon_base_report_to_printer-16.0.1.1.8.2.dist-info → odoo_addon_base_report_to_printer-16.0.1.2.0.dist-info}/WHEEL +0 -0
  19. {odoo_addon_base_report_to_printer-16.0.1.1.8.2.dist-info → odoo_addon_base_report_to_printer-16.0.1.2.0.dist-info}/top_level.txt +0 -0
@@ -7,7 +7,7 @@ Report to printer
7
7
  !! This file is generated by oca-gen-addon-readme !!
8
8
  !! changes will be overwritten. !!
9
9
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10
- !! source digest: sha256:9d9b0362fdecf578e230c992110f6a674fe46b63b185f38b5c180e2ea86c8cb5
10
+ !! source digest: sha256:b6075c1e1dd7cdecda74534f415e34eff210a7eb45270a9f9b086cb2c06563b1
11
11
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
12
 
13
13
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -106,6 +106,13 @@ Guidelines for use:
106
106
  When no tray is configured for a report and a user, the
107
107
  default tray setup on the CUPS server is used.
108
108
 
109
+ Known issues / Roadmap
110
+ ======================
111
+
112
+ - With threaded printing there's no download fallback when the issue isn't detected by
113
+ the CUPS Odoo backend. To able to do it, we would need to notify the bus or use
114
+ web_notify for it.
115
+
109
116
  Changelog
110
117
  =========
111
118
 
@@ -163,6 +170,11 @@ Contributors
163
170
  * Akim Juillerat <akim.juillerat@camptocamp.com>
164
171
  * Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
165
172
 
173
+ * `Tecnativa <https://www.tecnativa.com>`_:
174
+
175
+ * Sergio Teruel
176
+ * David Vidal
177
+
166
178
  Maintainers
167
179
  ~~~~~~~~~~~
168
180
 
@@ -7,7 +7,7 @@
7
7
 
8
8
  {
9
9
  "name": "Report to printer",
10
- "version": "16.0.1.1.8",
10
+ "version": "16.0.1.2.0",
11
11
  "category": "Generic Modules/Base",
12
12
  "author": "Agile Business Group & Domsense, Pegueroles SCP, NaN,"
13
13
  " LasLabs, Camptocamp, Odoo Community Association (OCA),"
@@ -18,6 +18,7 @@
18
18
  "data": [
19
19
  "data/printing_data.xml",
20
20
  "security/security.xml",
21
+ "security/ir.model.access.csv",
21
22
  "views/printing_printer.xml",
22
23
  "views/printing_server.xml",
23
24
  "views/printing_job.xml",
@@ -171,7 +171,7 @@ msgstr ""
171
171
  #. odoo-javascript
172
172
  #: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0
173
173
  #, python-format
174
- msgid "Could not send to printer!"
174
+ msgid "Could not sent to printer!"
175
175
  msgstr ""
176
176
 
177
177
  #. module: base_report_to_printer
@@ -391,6 +391,13 @@ msgstr ""
391
391
  msgid "If checked, this server is useable."
392
392
  msgstr ""
393
393
 
394
+ #. module: base_report_to_printer
395
+ #. odoo-javascript
396
+ #: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0
397
+ #, python-format
398
+ msgid "Issue on"
399
+ msgstr ""
400
+
394
401
  #. module: base_report_to_printer
395
402
  #: model_terms:ir.ui.view,arch_db:base_report_to_printer.printing_job_view_form
396
403
  msgid "Job"
@@ -476,6 +483,12 @@ msgstr ""
476
483
  msgid "Model"
477
484
  msgstr ""
478
485
 
486
+ #. module: base_report_to_printer
487
+ #: model:ir.model.fields,field_description:base_report_to_printer.field_printing_printer__multi_thread
488
+ #: model:ir.model.fields,field_description:base_report_to_printer.field_printing_server__multi_thread
489
+ msgid "Multi Thread"
490
+ msgstr ""
491
+
479
492
  #. module: base_report_to_printer
480
493
  #: model:ir.model.fields,field_description:base_report_to_printer.field_printing_action__name
481
494
  #: model:ir.model.fields,field_description:base_report_to_printer.field_printing_job__name
@@ -559,8 +572,11 @@ msgid "Port of the server."
559
572
  msgstr ""
560
573
 
561
574
  #. module: base_report_to_printer
575
+ #. odoo-javascript
576
+ #: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0
562
577
  #: model_terms:ir.ui.view,arch_db:base_report_to_printer.act_report_xml_view
563
578
  #: model_terms:ir.ui.view,arch_db:base_report_to_printer.wizard_print_attachment_form
579
+ #, python-format
564
580
  msgid "Print"
565
581
  msgstr ""
566
582
 
@@ -840,7 +856,7 @@ msgstr ""
840
856
  #. odoo-javascript
841
857
  #: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0
842
858
  #, python-format
843
- msgid "The printer couldn't be reached. Downloading document instead"
859
+ msgid "The report"
844
860
  msgstr ""
845
861
 
846
862
  #. module: base_report_to_printer
@@ -943,6 +959,13 @@ msgstr ""
943
959
  msgid "Wizard"
944
960
  msgstr ""
945
961
 
962
+ #. module: base_report_to_printer
963
+ #. odoo-javascript
964
+ #: code:addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js:0
965
+ #, python-format
966
+ msgid "couldn't be printed. Click on the button below to download it"
967
+ msgstr ""
968
+
946
969
  #. module: base_report_to_printer
947
970
  #. odoo-python
948
971
  #: code:addons/base_report_to_printer/wizards/print_attachment_report.py:0
@@ -3,9 +3,11 @@
3
3
  # Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
4
4
  # Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
5
5
  # Copyright (C) 2013-2014 Camptocamp (<http://www.camptocamp.com>)
6
+ # Copyright 2024 Tecnativa - Sergio Teruel
6
7
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
8
+ import threading
7
9
 
8
- from odoo import _, api, exceptions, fields, models
10
+ from odoo import _, api, exceptions, fields, models, registry
9
11
  from odoo.tools.safe_eval import safe_eval, time
10
12
 
11
13
  REPORT_TYPES = {"qweb-pdf": "pdf", "qweb-text": "text"}
@@ -57,6 +59,8 @@ class IrActionsReport(models.Model):
57
59
  "skip_printer_exception"
58
60
  ):
59
61
  serializable_result["printer_exception"] = True
62
+ if self.env.context.get("force_print_to_client"):
63
+ serializable_result["action"] = "client"
60
64
  return serializable_result
61
65
 
62
66
  def _get_user_default_print_behaviour(self):
@@ -118,6 +122,32 @@ class IrActionsReport(models.Model):
118
122
  result["printer_exception"] = True
119
123
  return result
120
124
 
125
+ def print_document_client_action(self, record_ids, data=None):
126
+ behaviour = self.behaviour()
127
+ printer = behaviour.pop("printer", None)
128
+ if printer.multi_thread:
129
+
130
+ @self.env.cr.postcommit.add
131
+ def _launch_print_thread():
132
+ threaded_calculation = threading.Thread(
133
+ target=self.print_document_threaded,
134
+ args=(self.id, record_ids, data),
135
+ )
136
+ threaded_calculation.start()
137
+
138
+ return True
139
+ else:
140
+ try:
141
+ return self.print_document(record_ids, data=data)
142
+ except Exception:
143
+ return
144
+
145
+ def print_document_threaded(self, report_id, record_ids, data):
146
+ with registry(self._cr.dbname).cursor() as cr:
147
+ self = self.with_env(self.env(cr=cr))
148
+ report = self.env["ir.actions.report"].browse(report_id)
149
+ report.print_document(record_ids, data)
150
+
121
151
  def print_document(self, record_ids, data=None):
122
152
  """Print a document, do not return the document file"""
123
153
  report_type = REPORT_TYPES.get(self.report_type)
@@ -146,6 +176,7 @@ class IrActionsReport(models.Model):
146
176
  else:
147
177
  title = self.report_name
148
178
  behaviour["title"] = title
179
+ behaviour["res_ids"] = record_ids
149
180
  # TODO should we use doc_format instead of report_type
150
181
  return printer.print_document(
151
182
  self, document, doc_format=self.report_type, **behaviour
@@ -12,7 +12,7 @@ import logging
12
12
  import os
13
13
  from tempfile import mkstemp
14
14
 
15
- from odoo import fields, models
15
+ from odoo import api, fields, models
16
16
 
17
17
  _logger = logging.getLogger(__name__)
18
18
 
@@ -67,11 +67,19 @@ class PrintingPrinter(models.Model):
67
67
  tray_ids = fields.One2many(
68
68
  comodel_name="printing.tray", inverse_name="printer_id", string="Paper Sources"
69
69
  )
70
+ multi_thread = fields.Boolean(
71
+ compute="_compute_multi_thread", readonly=False, store=True
72
+ )
73
+
74
+ @api.depends("server_id.multi_thread")
75
+ def _compute_multi_thread(self):
76
+ for printer in self:
77
+ printer.multi_thread = printer.server_id.multi_thread
70
78
 
71
79
  def _prepare_update_from_cups(self, cups_connection, cups_printer):
72
80
  mapping = {3: "available", 4: "printing", 5: "error"}
73
81
  cups_vals = {
74
- "name": cups_printer["printer-info"],
82
+ "name": self.name or cups_printer["printer-info"],
75
83
  "model": cups_printer.get("printer-make-and-model", False),
76
84
  "location": cups_printer.get("printer-location", False),
77
85
  "uri": cups_printer.get("device-uri", False),
@@ -42,6 +42,7 @@ class PrintingServer(models.Model):
42
42
  string="Printers List",
43
43
  help="List of printers available on this server.",
44
44
  )
45
+ multi_thread = fields.Boolean()
45
46
 
46
47
  def _open_connection(self, raise_on_error=False):
47
48
  self.ensure_one()
@@ -121,6 +122,11 @@ class PrintingServer(models.Model):
121
122
  printer_values["server_id"] = server.id
122
123
 
123
124
  updated_printers.append(name)
125
+ # We want to keep any existing customized name over existing printer
126
+ # We want also to rely in the system name as a fallback to avoid
127
+ # empty names.
128
+ if not printer_values.get("name") and not printer.name:
129
+ printer_values["name"] = name
124
130
  if not printer:
125
131
  printer_values["system_name"] = name
126
132
  printer.create(printer_values)
@@ -15,3 +15,8 @@
15
15
  * Hughes Damry <hughes.damry@acsone.eu>
16
16
  * Akim Juillerat <akim.juillerat@camptocamp.com>
17
17
  * Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
18
+
19
+ * `Tecnativa <https://www.tecnativa.com>`_:
20
+
21
+ * Sergio Teruel
22
+ * David Vidal
@@ -0,0 +1,3 @@
1
+ - With threaded printing there's no download fallback when the issue isn't detected by
2
+ the CUPS Odoo backend. To able to do it, we would need to notify the bus or use
3
+ web_notify for it.
@@ -0,0 +1,2 @@
1
+ id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
2
+ access_printing_printer_update_wizard,printers update,model_printing_printer_update_wizard,base.group_system,1,1,1,1
@@ -367,7 +367,7 @@ ul.auto-toc {
367
367
  !! This file is generated by oca-gen-addon-readme !!
368
368
  !! changes will be overwritten. !!
369
369
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
- !! source digest: sha256:9d9b0362fdecf578e230c992110f6a674fe46b63b185f38b5c180e2ea86c8cb5
370
+ !! source digest: sha256:b6075c1e1dd7cdecda74534f415e34eff210a7eb45270a9f9b086cb2c06563b1
371
371
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
372
  <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/report-print-send/tree/16.0/base_report_to_printer"><img alt="OCA/report-print-send" src="https://img.shields.io/badge/github-OCA%2Freport--print--send-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/report-print-send-16-0/report-print-send-16-0-base_report_to_printer"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/report-print-send&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
373
  <p>This module allows users to send reports to a printer attached to the server.</p>
@@ -396,16 +396,17 @@ preprinted paper such as payment slip.</p>
396
396
  <li><a class="reference internal" href="#installation" id="toc-entry-1">Installation</a></li>
397
397
  <li><a class="reference internal" href="#configuration" id="toc-entry-2">Configuration</a></li>
398
398
  <li><a class="reference internal" href="#usage" id="toc-entry-3">Usage</a></li>
399
- <li><a class="reference internal" href="#changelog" id="toc-entry-4">Changelog</a><ul>
400
- <li><a class="reference internal" href="#section-1" id="toc-entry-5">13.0.1.0.0 (2019-09-30)</a></li>
401
- <li><a class="reference internal" href="#section-2" id="toc-entry-6">12.0.1.0.0 (2018-02-04)</a></li>
399
+ <li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-4">Known issues / Roadmap</a></li>
400
+ <li><a class="reference internal" href="#changelog" id="toc-entry-5">Changelog</a><ul>
401
+ <li><a class="reference internal" href="#section-1" id="toc-entry-6">13.0.1.0.0 (2019-09-30)</a></li>
402
+ <li><a class="reference internal" href="#section-2" id="toc-entry-7">12.0.1.0.0 (2018-02-04)</a></li>
402
403
  </ul>
403
404
  </li>
404
- <li><a class="reference internal" href="#bug-tracker" id="toc-entry-7">Bug Tracker</a></li>
405
- <li><a class="reference internal" href="#credits" id="toc-entry-8">Credits</a><ul>
406
- <li><a class="reference internal" href="#authors" id="toc-entry-9">Authors</a></li>
407
- <li><a class="reference internal" href="#contributors" id="toc-entry-10">Contributors</a></li>
408
- <li><a class="reference internal" href="#maintainers" id="toc-entry-11">Maintainers</a></li>
405
+ <li><a class="reference internal" href="#bug-tracker" id="toc-entry-8">Bug Tracker</a></li>
406
+ <li><a class="reference internal" href="#credits" id="toc-entry-9">Credits</a><ul>
407
+ <li><a class="reference internal" href="#authors" id="toc-entry-10">Authors</a></li>
408
+ <li><a class="reference internal" href="#contributors" id="toc-entry-11">Contributors</a></li>
409
+ <li><a class="reference internal" href="#maintainers" id="toc-entry-12">Maintainers</a></li>
409
410
  </ul>
410
411
  </li>
411
412
  </ul>
@@ -456,23 +457,31 @@ change these in <em>Settings &gt; Printing &gt; Reports</em> in
456
457
  <p>When no tray is configured for a report and a user, the
457
458
  default tray setup on the CUPS server is used.</p>
458
459
  </div>
460
+ <div class="section" id="known-issues-roadmap">
461
+ <h1><a class="toc-backref" href="#toc-entry-4">Known issues / Roadmap</a></h1>
462
+ <ul class="simple">
463
+ <li>With threaded printing there’s no download fallback when the issue isn’t detected by
464
+ the CUPS Odoo backend. To able to do it, we would need to notify the bus or use
465
+ web_notify for it.</li>
466
+ </ul>
467
+ </div>
459
468
  <div class="section" id="changelog">
460
- <h1><a class="toc-backref" href="#toc-entry-4">Changelog</a></h1>
469
+ <h1><a class="toc-backref" href="#toc-entry-5">Changelog</a></h1>
461
470
  <div class="section" id="section-1">
462
- <h2><a class="toc-backref" href="#toc-entry-5">13.0.1.0.0 (2019-09-30)</a></h2>
471
+ <h2><a class="toc-backref" href="#toc-entry-6">13.0.1.0.0 (2019-09-30)</a></h2>
463
472
  <ul class="simple">
464
473
  <li>[RELEASE] Port from V12.</li>
465
474
  </ul>
466
475
  </div>
467
476
  <div class="section" id="section-2">
468
- <h2><a class="toc-backref" href="#toc-entry-6">12.0.1.0.0 (2018-02-04)</a></h2>
477
+ <h2><a class="toc-backref" href="#toc-entry-7">12.0.1.0.0 (2018-02-04)</a></h2>
469
478
  <ul class="simple">
470
479
  <li>[RELEASE] Port from V11.</li>
471
480
  </ul>
472
481
  </div>
473
482
  </div>
474
483
  <div class="section" id="bug-tracker">
475
- <h1><a class="toc-backref" href="#toc-entry-7">Bug Tracker</a></h1>
484
+ <h1><a class="toc-backref" href="#toc-entry-8">Bug Tracker</a></h1>
476
485
  <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/report-print-send/issues">GitHub Issues</a>.
477
486
  In case of trouble, please check there if your issue has already been reported.
478
487
  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
480
489
  <p>Do not contact contributors directly about support or help with technical issues.</p>
481
490
  </div>
482
491
  <div class="section" id="credits">
483
- <h1><a class="toc-backref" href="#toc-entry-8">Credits</a></h1>
492
+ <h1><a class="toc-backref" href="#toc-entry-9">Credits</a></h1>
484
493
  <div class="section" id="authors">
485
- <h2><a class="toc-backref" href="#toc-entry-9">Authors</a></h2>
494
+ <h2><a class="toc-backref" href="#toc-entry-10">Authors</a></h2>
486
495
  <ul class="simple">
487
496
  <li>Agile Business Group &amp; Domsense</li>
488
497
  <li>Pegueroles SCP</li>
@@ -493,7 +502,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
493
502
  </ul>
494
503
  </div>
495
504
  <div class="section" id="contributors">
496
- <h2><a class="toc-backref" href="#toc-entry-10">Contributors</a></h2>
505
+ <h2><a class="toc-backref" href="#toc-entry-11">Contributors</a></h2>
497
506
  <ul class="simple">
498
507
  <li>Ferran Pegueroles &lt;<a class="reference external" href="mailto:ferran&#64;pegueroles.com">ferran&#64;pegueroles.com</a>&gt;</li>
499
508
  <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>
@@ -512,10 +521,15 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
512
521
  <li>Hughes Damry &lt;<a class="reference external" href="mailto:hughes.damry&#64;acsone.eu">hughes.damry&#64;acsone.eu</a>&gt;</li>
513
522
  <li>Akim Juillerat &lt;<a class="reference external" href="mailto:akim.juillerat&#64;camptocamp.com">akim.juillerat&#64;camptocamp.com</a>&gt;</li>
514
523
  <li>Jacques-Etienne Baudoux (BCIM) &lt;<a class="reference external" href="mailto:je&#64;bcim.be">je&#64;bcim.be</a>&gt;</li>
524
+ <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
525
+ <li>Sergio Teruel</li>
526
+ <li>David Vidal</li>
527
+ </ul>
528
+ </li>
515
529
  </ul>
516
530
  </div>
517
531
  <div class="section" id="maintainers">
518
- <h2><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h2>
532
+ <h2><a class="toc-backref" href="#toc-entry-12">Maintainers</a></h2>
519
533
  <p>This module is maintained by the OCA.</p>
520
534
  <a class="reference external image-reference" href="https://odoo-community.org">
521
535
  <img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -1,4 +1,5 @@
1
1
  /** @odoo-module */
2
+ import {Markup} from "web.utils";
2
3
  import {registry} from "@web/core/registry";
3
4
 
4
5
  async function cupsReportActionHandler(action, options, env) {
@@ -8,36 +9,73 @@ async function cupsReportActionHandler(action, options, env) {
8
9
  const print_action = await orm.call(
9
10
  "ir.actions.report",
10
11
  "print_action_for_report_name",
11
- [action.report_name]
12
+ [action.report_name],
13
+ {context: {force_print_to_client: action.context.force_print_to_client}}
12
14
  );
13
- if (
14
- print_action &&
15
- print_action.action === "server" &&
16
- !print_action.printer_exception
17
- ) {
18
- const result = await orm.call("ir.actions.report", "print_document", [
19
- action.id,
20
- action.context.active_ids,
21
- action.data,
22
- ]);
15
+ var printer_exception = print_action.printer_exception;
16
+ if (print_action && print_action.action === "server" && !printer_exception) {
17
+ // The Odoo CUPS backend is ok. We try to print into the printer
18
+ const result = await orm.call(
19
+ "ir.actions.report",
20
+ "print_document_client_action",
21
+ [action.id, action.context.active_ids, action.data]
22
+ );
23
23
  if (result) {
24
24
  env.services.notification.add(env._t("Successfully sent to printer!"), {
25
25
  type: "success",
26
26
  });
27
- } else {
28
- env.services.notification.add(env._t("Could not send to printer!"), {
29
- type: "danger",
30
- });
27
+ return true;
28
+ // In case of exception during the job, we won't get any response. So we
29
+ // should flag the exception and notify the user
31
30
  }
32
- return true;
31
+ env.services.notification.add(env._t("Could not sent to printer!"), {
32
+ type: "danger",
33
+ });
34
+ printer_exception = true;
33
35
  }
34
- if (print_action.printer_exception) {
35
- env.services.notification.add(
36
- env._t("The printer couldn't be reached. Downloading document instead"),
36
+ if (print_action && print_action.action === "server" && printer_exception) {
37
+ // Just so the translation engine detects them as it doesn't do it inside
38
+ // template strings
39
+ const terms = {
40
+ the_report: env._t("The report"),
41
+ couldnt_be_printed: env._t(
42
+ "couldn't be printed. Click on the button below to download it"
43
+ ),
44
+ issue_on: env._t("Issue on"),
45
+ };
46
+ const notificationRemove = env.services.notification.add(
47
+ Markup(
48
+ `<p>${terms.the_report} <strong>${action.name}</strong> ${terms.couldnt_be_printed}</p>`
49
+ ),
37
50
  {
51
+ title: `${terms.issue_on} ${print_action.printer_name}`,
38
52
  type: "warning",
53
+ sticky: true,
54
+ messageIsHtml: true,
55
+ buttons: [
56
+ {
57
+ name: env._t("Print"),
58
+ primary: true,
59
+ icon: "fa-print",
60
+ onClick: async () => {
61
+ const context = {
62
+ force_print_to_client: true,
63
+ must_skip_send_to_printer: true,
64
+ };
65
+ env.services.user.updateContext(context);
66
+ await env.services.action.doAction(
67
+ {type: "ir.actions.report", ...action},
68
+ {
69
+ additionalContext: context,
70
+ }
71
+ );
72
+ notificationRemove();
73
+ },
74
+ },
75
+ ],
39
76
  }
40
77
  );
78
+ return true;
41
79
  }
42
80
  }
43
81
  }
@@ -295,3 +295,20 @@ class TestIrActionsReportXml(TransactionCase):
295
295
  self.assertEqual(action.printer_tray_id, tray)
296
296
  action.onchange_printing_printer_id()
297
297
  self.assertFalse(action.printer_tray_id)
298
+
299
+ def test_print_in_new_thread(self):
300
+ """It should return the action and printer from printing action in other thread"""
301
+ report = self.Model.search([], limit=1)
302
+ self.env.user.printing_action = "server"
303
+ printing_action = self.new_printing_action()
304
+ printing_action.user_id = self.env.user
305
+ printing_action.printer_id = self.new_printer()
306
+ printing_action.printer_id.multi_thread = True
307
+ self.assertEqual(
308
+ report.behaviour(),
309
+ {
310
+ "action": printing_action.action,
311
+ "printer": printing_action.printer_id,
312
+ "tray": False,
313
+ },
314
+ )
@@ -40,7 +40,7 @@ class TestPrintingPrinter(TransactionCase):
40
40
  self.server = self.env["printing.server"].create({})
41
41
  self.printer = self.env["printing.printer"].create(
42
42
  {
43
- "name": "Printer",
43
+ "name": "",
44
44
  "server_id": self.server.id,
45
45
  "system_name": "Sys Name",
46
46
  "default": True,
@@ -105,10 +105,11 @@ class TestPrintingPrinter(TransactionCase):
105
105
  Check that the update_printers method calls _prepare_update_from_cups
106
106
  """
107
107
  self.mock_cups_ppd(cups, file_name=False)
108
-
109
- self.assertEqual(self.printer.name, "Printer")
110
108
  self.ServerModel.update_printers()
111
109
  self.assertEqual(self.printer.name, "info")
110
+ self.printer.name = "My custom name"
111
+ self.ServerModel.update_printers()
112
+ self.assertEqual(self.printer.name, "My custom name")
112
113
 
113
114
  @mock.patch("%s.cups" % server_model)
114
115
  def test_prepare_update_from_cups_no_ppd(self, cups):
@@ -78,6 +78,7 @@
78
78
  <field name="location" />
79
79
  <field name="status" />
80
80
  <field name="status_message" />
81
+ <field name="multi_thread" />
81
82
  </group>
82
83
  <group string="Trays" name="trays">
83
84
  <field name="tray_ids" nolabel="1" colspan="2">
@@ -31,6 +31,7 @@
31
31
  <field name="user" />
32
32
  <field name="password" />
33
33
  <field name="encryption_policy" />
34
+ <field name="multi_thread" />
34
35
  </group>
35
36
  <group name="printers" string="Printers">
36
37
  <field name="printer_ids" nolabel="1" colspan="2" />
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-base_report_to_printer
3
- Version: 16.0.1.1.8.2
3
+ Version: 16.0.1.2.0
4
4
  Summary: Report to printer
5
5
  Home-page: https://github.com/OCA/report-print-send
6
6
  Author: Agile Business Group & Domsense, Pegueroles SCP, NaN, LasLabs, Camptocamp, Odoo Community Association (OCA), Open for Small Business Ltd
@@ -23,7 +23,7 @@ Report to printer
23
23
  !! This file is generated by oca-gen-addon-readme !!
24
24
  !! changes will be overwritten. !!
25
25
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
26
- !! source digest: sha256:9d9b0362fdecf578e230c992110f6a674fe46b63b185f38b5c180e2ea86c8cb5
26
+ !! source digest: sha256:b6075c1e1dd7cdecda74534f415e34eff210a7eb45270a9f9b086cb2c06563b1
27
27
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28
28
 
29
29
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -122,6 +122,13 @@ Guidelines for use:
122
122
  When no tray is configured for a report and a user, the
123
123
  default tray setup on the CUPS server is used.
124
124
 
125
+ Known issues / Roadmap
126
+ ======================
127
+
128
+ - With threaded printing there's no download fallback when the issue isn't detected by
129
+ the CUPS Odoo backend. To able to do it, we would need to notify the bus or use
130
+ web_notify for it.
131
+
125
132
  Changelog
126
133
  =========
127
134
 
@@ -179,6 +186,11 @@ Contributors
179
186
  * Akim Juillerat <akim.juillerat@camptocamp.com>
180
187
  * Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
181
188
 
189
+ * `Tecnativa <https://www.tecnativa.com>`_:
190
+
191
+ * Sergio Teruel
192
+ * David Vidal
193
+
182
194
  Maintainers
183
195
  ~~~~~~~~~~~
184
196
 
@@ -1,10 +1,10 @@
1
- odoo/addons/base_report_to_printer/README.rst,sha256=n63cYWzhUhFWNf-NOf7SWj2p1K66rFthKIWQfX27lRc,6157
1
+ odoo/addons/base_report_to_printer/README.rst,sha256=2k3rpmlnj5Pfl8bP43DA9Q73yC_NcgNizRIXjHBJoec,6475
2
2
  odoo/addons/base_report_to_printer/__init__.py,sha256=Ldk9I_2g8cYtB7aM2jrf7Si9uWQbxTyaUwq31rv-X1E,439
3
- odoo/addons/base_report_to_printer/__manifest__.py,sha256=CEqAYGeeFt3vH0mxxvuDO3Ni_6lJAOo-XFt-ZgoECEc,1438
3
+ odoo/addons/base_report_to_printer/__manifest__.py,sha256=VbX0iaBNf3s0DJ69tGWlnCAatXydSBoWwX5MPRb28Tw,1478
4
4
  odoo/addons/base_report_to_printer/data/neutralize.sql,sha256=ED9Je55ll3LB7G6W2Wjm9daqurleECxpmLe68DjCoWc,83
5
5
  odoo/addons/base_report_to_printer/data/printing_data.xml,sha256=_D1pBsEJ8oQ2JvO0lFKaAM7yypZloLcyOaG9OFYVyIM,1476
6
6
  odoo/addons/base_report_to_printer/i18n/am.po,sha256=1Ilrl65uRTbIHSM0w1iSaj8m5MDoNlJ5mv9lwLG8hCY,38547
7
- odoo/addons/base_report_to_printer/i18n/base_report_to_printer.pot,sha256=iRqBECD-ojbqfl8eH4UwLGXvLB4HrfovVUfFBEboPaU,38177
7
+ odoo/addons/base_report_to_printer/i18n/base_report_to_printer.pot,sha256=XqCI--E2zmJE3XOsh5uO5WrlclTmydb0WJGHICf3VvA,38925
8
8
  odoo/addons/base_report_to_printer/i18n/bg.po,sha256=sMjrUwsVVjgxgKGSRsvlgK0N_Wdd1rLgeGDL6rTCOlk,38646
9
9
  odoo/addons/base_report_to_printer/i18n/ca.po,sha256=Cy-4pXlA_Fm8JIffdSMQD-szs5QYVMBI9hXE7HLEIN4,38546
10
10
  odoo/addons/base_report_to_printer/i18n/de.po,sha256=PDq8Ft5vVXNN093tbbaWDiTrTW-nfMhbS22Xs9iVTqs,42461
@@ -28,29 +28,31 @@ odoo/addons/base_report_to_printer/i18n/sv.po,sha256=XDxOivIGGb0_4EK6ZZg8GFks8R-
28
28
  odoo/addons/base_report_to_printer/i18n/tr.po,sha256=Ou4UT_ajqApn12gFE5GxYf4s41ZfJ54DnML2Uata_7U,38530
29
29
  odoo/addons/base_report_to_printer/i18n/zh_CN.po,sha256=IhQktqFUa1M0cHh3d_ITVpxdjjHcoWPOn0iby6XFnCs,38542
30
30
  odoo/addons/base_report_to_printer/models/__init__.py,sha256=y92zKlKN-X-KT04jwLi8XgUsY8HAbDiRvdPKDWCpvGo,243
31
- odoo/addons/base_report_to_printer/models/ir_actions_report.py,sha256=5HhTLi4MzL3RlGkR2kCgp0jjeaTya8EJiDRML8wToD4,8269
31
+ odoo/addons/base_report_to_printer/models/ir_actions_report.py,sha256=qGzleQcyCB8PQXyatJvGYs3B2QikCPWQki2BRbt2B9k,9461
32
32
  odoo/addons/base_report_to_printer/models/printing_action.py,sha256=5i1Vdd-59RxfMoJSI_24BwpHb2BXKm7brRmO17zzsF8,912
33
33
  odoo/addons/base_report_to_printer/models/printing_job.py,sha256=DBQSIqYhGVeqa2DgC_PWtoRAXbyLLvBKnNHn5G9XLWE,5029
34
- odoo/addons/base_report_to_printer/models/printing_printer.py,sha256=3avOPIsqTHUpu6H4dgJvmrCEQrSI3_8wUH-_BKj4wog,8678
34
+ odoo/addons/base_report_to_printer/models/printing_printer.py,sha256=hUm90szJSGu_1MBe6LXTFjyu_rxSJRHvD17XcGQWcHA,8981
35
35
  odoo/addons/base_report_to_printer/models/printing_report_xml_action.py,sha256=tHNX9cceVYXl2hsnFavKE8mCnfGpfOgTjudjkIk9PZc,1631
36
- odoo/addons/base_report_to_printer/models/printing_server.py,sha256=8NFqPPPZmDJIykOVpdRBUY80uRW9Al3hrJXWCtlyDqc,10197
36
+ odoo/addons/base_report_to_printer/models/printing_server.py,sha256=c7w5k3qoHuUlOGSSNFBlvdf2z6V_15UMdXuhcllSf38,10552
37
37
  odoo/addons/base_report_to_printer/models/printing_tray.py,sha256=tmSwhwdwiJIIRefDOQnLUG1k0tqAj96Pvh6T3zeYgzM,566
38
38
  odoo/addons/base_report_to_printer/models/res_users.py,sha256=2jbOTw8zX21GcmyyspEY_S78WV9JA26m2vwM09I2HkU,1614
39
39
  odoo/addons/base_report_to_printer/readme/CONFIGURE.rst,sha256=4iv4TSqIPqNM7_g7H8vO2oUT8zuOaySZWvTdeYfLUSM,656
40
- odoo/addons/base_report_to_printer/readme/CONTRIBUTORS.rst,sha256=cPZS5CaJKZwkiXoNtuXy7zYSTDo2aY_VuCyoqH6LSA0,753
40
+ odoo/addons/base_report_to_printer/readme/CONTRIBUTORS.rst,sha256=f0HP41ikm5lPMqLL1y5ePlW3IGkWKySDiapkAtQuF1c,833
41
41
  odoo/addons/base_report_to_printer/readme/DESCRIPTION.rst,sha256=r9bWH-rEGsBaJM0owPnSZwPLCaji7FSopDvM9_Hf63Y,767
42
42
  odoo/addons/base_report_to_printer/readme/HISTORY.rst,sha256=ABtERQPm9HZB_R6jXIUgVKFWsAsN-DcRr96SX9foXZ4,153
43
43
  odoo/addons/base_report_to_printer/readme/INSTALL.rst,sha256=t2YpmitUkax9UiKn1geUUjPCNvf-uMR3oiyYdBWOXpg,246
44
+ odoo/addons/base_report_to_printer/readme/ROADMAP.rst,sha256=mR5-Z4p6Mr9qB24NLMpbiiNP-SsQmHjdffeWgQOJ_Zo,190
44
45
  odoo/addons/base_report_to_printer/readme/USAGE.rst,sha256=__mLAaeK28z7E4PnK7L038QJFltllISiWXO_gT6JhK0,593
46
+ odoo/addons/base_report_to_printer/security/ir.model.access.csv,sha256=tIjk4kiES-JnJ_vgM7QrBSkuldIfvqUH5mZAKYPnY08,194
45
47
  odoo/addons/base_report_to_printer/security/security.xml,sha256=wnrjXp2w6bgVUt0c4kPfc8XOP3hPOox8jA2FdL0wdxw,7481
46
48
  odoo/addons/base_report_to_printer/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
47
- odoo/addons/base_report_to_printer/static/description/index.html,sha256=Oro7tb53-Khxuw-Q0ThzMfAuZT7WIz7_uKfOiWAVhJk,18958
48
- odoo/addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js,sha256=r6v4w6oXjQdLQHSDB46zJyJlWx03KtJEah5qSQNSNnU,1509
49
+ odoo/addons/base_report_to_printer/static/description/index.html,sha256=W9O3MHLM4BZA9bH3M-yXJH3PFf56JZFMoX-YzCdwmLk,19571
50
+ odoo/addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js,sha256=Wp1cRqIdRqYVaZE4hzPt5Ts04v8MU8MPHmahsyIHbdU,3596
49
51
  odoo/addons/base_report_to_printer/tests/__init__.py,sha256=tpUyFuG96289zrpY1fTMi-moLC2KFq_93_NjuDCw1Rg,458
50
- odoo/addons/base_report_to_printer/tests/test_ir_actions_report.py,sha256=O7x-XjP3ShbnApyjVQ7dWIptIVYe-W_EoNLDVgjA19A,11412
52
+ odoo/addons/base_report_to_printer/tests/test_ir_actions_report.py,sha256=IoFRIJLCy2NIA_op7TvD5V6DBy9aj_cCYlWEasVyxjI,12086
51
53
  odoo/addons/base_report_to_printer/tests/test_printing_job.py,sha256=z7LZ9eJeloIE9jHCH1x-trsU6ZzWIjKyo7xiohL_jQY,2129
52
54
  odoo/addons/base_report_to_printer/tests/test_printing_printer.py,sha256=W81b_kDStLnjWGnEbKj9k9L7dUAe-J9_sMcsYNNmAn0,7131
53
- odoo/addons/base_report_to_printer/tests/test_printing_printer_tray.py,sha256=RTKJy2hB7yRKg4q32oH2_SUxiiFQemVP7nmgKRcgw54,8917
55
+ odoo/addons/base_report_to_printer/tests/test_printing_printer_tray.py,sha256=Xr6g4x60Munkux9gDbir11U1QIHvepJUJu7kDgpxD_4,9004
54
56
  odoo/addons/base_report_to_printer/tests/test_printing_printer_wizard.py,sha256=LXsh0SYi41zDPD1hNxYsk_Yms9C7SvOuEEHuespINUU,3381
55
57
  odoo/addons/base_report_to_printer/tests/test_printing_report_xml_action.py,sha256=n3tgmex7wwiudvUqBjvVAmyu8s1AF2uOAyHbSyz9ICw,3191
56
58
  odoo/addons/base_report_to_printer/tests/test_printing_server.py,sha256=GekYiElVfCCDdByeuZUu0tBsT1IqYyX9eH0O8-ppJZU,7580
@@ -59,16 +61,16 @@ odoo/addons/base_report_to_printer/tests/test_report.py,sha256=FjvSL5NCXL_pwGlcn
59
61
  odoo/addons/base_report_to_printer/tests/test_res_users.py,sha256=Q_wqWEE7FvuLC5CPeYc8VQ12uyLV6rTlOhH8nQv9rOE,1983
60
62
  odoo/addons/base_report_to_printer/views/ir_actions_report.xml,sha256=CP_pykwKIJRjy39X1sp9CPOMaMpnt0PK8OR9-2DascU,890
61
63
  odoo/addons/base_report_to_printer/views/printing_job.xml,sha256=L25kmiDDl5bS0nvrA0rdkC_1_2U2JgiAD-7z_zwSdoY,1852
62
- odoo/addons/base_report_to_printer/views/printing_printer.xml,sha256=zvKWyobq_b-96YuGP7GAe6Lk1r81EDcdGx_DrfghslE,5957
64
+ odoo/addons/base_report_to_printer/views/printing_printer.xml,sha256=0pQ978HysX2aDU0uKTzOD63y4By4qDlYivzKje9f01Q,6011
63
65
  odoo/addons/base_report_to_printer/views/printing_report.xml,sha256=ivzOzDhs2iM1CapXuWAlgbhQ6knebj2akp1AOicI_gU,1453
64
- odoo/addons/base_report_to_printer/views/printing_server.xml,sha256=9YdvoXgwFbvWcaYfjmEUzBZkp2582g-mefu4VU9pnKw,2887
66
+ odoo/addons/base_report_to_printer/views/printing_server.xml,sha256=nT2XJZbXDSSpbZcJG7w0zcYGMFlqftc03LjG2sJhVPA,2941
65
67
  odoo/addons/base_report_to_printer/views/res_users.xml,sha256=IIi8W930iAEp1jknTsZ5MxBP2qiRJE4DNMI6yME9G-c,1392
66
68
  odoo/addons/base_report_to_printer/wizards/__init__.py,sha256=MvgzXHSqDX2nGpbYkjyXSuv1iHe2ECwuPaAJdz5zitc,83
67
69
  odoo/addons/base_report_to_printer/wizards/print_attachment_report.py,sha256=VS7FZ4Gz6ZjsUrsNXHqx2YBmagGWq-FnJJ5Wl64uaFY,2478
68
70
  odoo/addons/base_report_to_printer/wizards/print_attachment_report.xml,sha256=nniCofH1YSOj_HeD4zTV1ilGTjhjCgdZUqK9lfBz2K4,2214
69
71
  odoo/addons/base_report_to_printer/wizards/printing_printer_update_wizard.py,sha256=l58Nk3BAVydb9Yi_fbh7FIpA-UDyTnvK7xIYvEr742c,895
70
72
  odoo/addons/base_report_to_printer/wizards/printing_printer_update_wizard_view.xml,sha256=UbN9xjc12hI57ojjs84hPgQOfqPbuD_XThPyvyMxp-Y,1399
71
- odoo_addon_base_report_to_printer-16.0.1.1.8.2.dist-info/METADATA,sha256=E7Y9MweLavNq6ZbRmMXLVvKSjBmXTe-hERPLWCZfcU4,6792
72
- odoo_addon_base_report_to_printer-16.0.1.1.8.2.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
73
- odoo_addon_base_report_to_printer-16.0.1.1.8.2.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
74
- odoo_addon_base_report_to_printer-16.0.1.1.8.2.dist-info/RECORD,,
73
+ odoo_addon_base_report_to_printer-16.0.1.2.0.dist-info/METADATA,sha256=-f4hPnWu_OGCoRDPxXMTaECfoKNesFjkAdqhJAzU5yQ,7108
74
+ odoo_addon_base_report_to_printer-16.0.1.2.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
75
+ odoo_addon_base_report_to_printer-16.0.1.2.0.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
76
+ odoo_addon_base_report_to_printer-16.0.1.2.0.dist-info/RECORD,,