odoo-addon-base-report-to-printer 16.0.1.4.0__py3-none-any.whl → 16.0.1.5.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.

@@ -11,7 +11,7 @@ Report to printer
11
11
  !! This file is generated by oca-gen-addon-readme !!
12
12
  !! changes will be overwritten. !!
13
13
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14
- !! source digest: sha256:0b90f3571ae0351b1c584a749baa61b60002dbbd9e3c633c81feee6176d2ec61
14
+ !! source digest: sha256:64d5393975585c1cb95054aec330cf9091a2bd3c045091bdbf04038f22bf1e1f
15
15
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16
16
 
17
17
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -7,7 +7,7 @@
7
7
 
8
8
  {
9
9
  "name": "Report to printer",
10
- "version": "16.0.1.4.0",
10
+ "version": "16.0.1.5.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),"
@@ -10,9 +10,10 @@
10
10
  import errno
11
11
  import logging
12
12
  import os
13
+ import threading
13
14
  from tempfile import mkstemp
14
15
 
15
- from odoo import api, fields, models
16
+ from odoo import api, fields, models, registry
16
17
 
17
18
  _logger = logging.getLogger(__name__)
18
19
 
@@ -153,7 +154,41 @@ class PrintingPrinter(models.Model):
153
154
  finally:
154
155
  os.close(fd)
155
156
 
156
- return self.print_file(file_name, report=report, **print_opts)
157
+ self.env.cr.postrollback.add(
158
+ lambda: os.remove(file_name) if os.path.exists(file_name) else None
159
+ )
160
+
161
+ test_mode = getattr(threading.current_thread(), "testing", False)
162
+ if not test_mode:
163
+ dbname = self.env.cr.dbname
164
+ context = self.env.context
165
+ uid = self.env.uid
166
+ printer_id = self.id
167
+ report_id = report.id if report else None
168
+
169
+ @self.env.cr.postcommit.add
170
+ def _launch_print_file():
171
+ with registry(dbname).cursor() as cr:
172
+ env = api.Environment(cr, uid, context)
173
+ printer = env["printing.printer"].browse(printer_id)
174
+ report = env["ir.actions.report"].browse(report_id)
175
+ printer.print_file_and_clean(file_name, report=report, **print_opts)
176
+
177
+ return True
178
+ else:
179
+ return self.print_file_and_clean(file_name, report=report, **print_opts)
180
+
181
+ def print_file_and_clean(self, file_name, report=None, **print_opts):
182
+ """Print a file and clean up the given file after printing"""
183
+ try:
184
+ return self.print_file(file_name, report=report, **print_opts)
185
+ finally:
186
+ try:
187
+ os.remove(file_name)
188
+ except OSError as exc:
189
+ _logger.warning(
190
+ "Unable to remove temporary file %s: %s", file_name, exc
191
+ )
157
192
 
158
193
  @staticmethod
159
194
  def _set_option_doc_format(report, value):
@@ -198,10 +233,6 @@ class PrintingPrinter(models.Model):
198
233
  _logger.info(
199
234
  "Printing job: '{}' on {}".format(file_name, self.server_id.address)
200
235
  )
201
- try:
202
- os.remove(file_name)
203
- except OSError as exc:
204
- _logger.warning("Unable to remove temporary file %s: %s", file_name, exc)
205
236
  return True
206
237
 
207
238
  def set_default(self):
@@ -372,7 +372,7 @@ ul.auto-toc {
372
372
  !! This file is generated by oca-gen-addon-readme !!
373
373
  !! changes will be overwritten. !!
374
374
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375
- !! source digest: sha256:0b90f3571ae0351b1c584a749baa61b60002dbbd9e3c633c81feee6176d2ec61
375
+ !! source digest: sha256:64d5393975585c1cb95054aec330cf9091a2bd3c045091bdbf04038f22bf1e1f
376
376
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377
377
  <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/license-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>
378
378
  <p>This module allows users to send reports to a printer attached to the server.</p>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-base_report_to_printer
3
- Version: 16.0.1.4.0
3
+ Version: 16.0.1.5.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
@@ -27,7 +27,7 @@ Report to printer
27
27
  !! This file is generated by oca-gen-addon-readme !!
28
28
  !! changes will be overwritten. !!
29
29
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
30
- !! source digest: sha256:0b90f3571ae0351b1c584a749baa61b60002dbbd9e3c633c81feee6176d2ec61
30
+ !! source digest: sha256:64d5393975585c1cb95054aec330cf9091a2bd3c045091bdbf04038f22bf1e1f
31
31
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
32
32
 
33
33
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -1,6 +1,6 @@
1
- odoo/addons/base_report_to_printer/README.rst,sha256=PkMCN4uddk3EptCCKykpnV1aO4pyDQ3_LtRi-jm7LaM,6640
1
+ odoo/addons/base_report_to_printer/README.rst,sha256=kDJBIm6JBR1k7PC6ISq7XEOZI6IeLPOU-UgEhV2I1wM,6640
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=HXT38_K4m59EqdkIKKhpRiSy2gLbLUVmC1fKEaYqGCQ,1478
3
+ odoo/addons/base_report_to_printer/__manifest__.py,sha256=1jkNZ0nL3kM3oebWhwfhjUDbzWjUibWRQsB1FIDYRA4,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=qLvKbJuEKkTL6CW9i5uVugsT3ZlA26JGLogR5Q4wqd4,39457
@@ -31,7 +31,7 @@ odoo/addons/base_report_to_printer/models/__init__.py,sha256=y92zKlKN-X-KT04jwLi
31
31
  odoo/addons/base_report_to_printer/models/ir_actions_report.py,sha256=t5-Xlxf4SomIa-luNUfdWqOBqdJAgq_rta07Pv0Yfz4,9587
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=hUm90szJSGu_1MBe6LXTFjyu_rxSJRHvD17XcGQWcHA,8981
34
+ odoo/addons/base_report_to_printer/models/printing_printer.py,sha256=8dmNUqL0BO1dzuy9mXOCTyHw9vXPdXmkxi0kqJLKLDc,10218
35
35
  odoo/addons/base_report_to_printer/models/printing_report_xml_action.py,sha256=tHNX9cceVYXl2hsnFavKE8mCnfGpfOgTjudjkIk9PZc,1631
36
36
  odoo/addons/base_report_to_printer/models/printing_server.py,sha256=aqw1e4JAibQlAzjsd5jc7HOdHY5EIx64VW567sMoBSQ,10630
37
37
  odoo/addons/base_report_to_printer/models/printing_tray.py,sha256=tmSwhwdwiJIIRefDOQnLUG1k0tqAj96Pvh6T3zeYgzM,566
@@ -46,7 +46,7 @@ odoo/addons/base_report_to_printer/readme/USAGE.rst,sha256=__mLAaeK28z7E4PnK7L03
46
46
  odoo/addons/base_report_to_printer/security/ir.model.access.csv,sha256=tIjk4kiES-JnJ_vgM7QrBSkuldIfvqUH5mZAKYPnY08,194
47
47
  odoo/addons/base_report_to_printer/security/security.xml,sha256=dfla373wWbU9ItIXd1-0SCTAXk3I22VshWXg-sVWpno,8517
48
48
  odoo/addons/base_report_to_printer/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
49
- odoo/addons/base_report_to_printer/static/description/index.html,sha256=iUJ8xKw_XZOil1QdGvI0xC1N0lEYupp5jqyZxnEAXx8,19791
49
+ odoo/addons/base_report_to_printer/static/description/index.html,sha256=TthssOR7f8fyLUTbZalreCJEUuuPLdCLwP4eFPAgegQ,19791
50
50
  odoo/addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js,sha256=Wp1cRqIdRqYVaZE4hzPt5Ts04v8MU8MPHmahsyIHbdU,3596
51
51
  odoo/addons/base_report_to_printer/tests/__init__.py,sha256=tpUyFuG96289zrpY1fTMi-moLC2KFq_93_NjuDCw1Rg,458
52
52
  odoo/addons/base_report_to_printer/tests/test_ir_actions_report.py,sha256=IoFRIJLCy2NIA_op7TvD5V6DBy9aj_cCYlWEasVyxjI,12086
@@ -70,7 +70,7 @@ odoo/addons/base_report_to_printer/wizards/print_attachment_report.py,sha256=VS7
70
70
  odoo/addons/base_report_to_printer/wizards/print_attachment_report.xml,sha256=nniCofH1YSOj_HeD4zTV1ilGTjhjCgdZUqK9lfBz2K4,2214
71
71
  odoo/addons/base_report_to_printer/wizards/printing_printer_update_wizard.py,sha256=l58Nk3BAVydb9Yi_fbh7FIpA-UDyTnvK7xIYvEr742c,895
72
72
  odoo/addons/base_report_to_printer/wizards/printing_printer_update_wizard_view.xml,sha256=UbN9xjc12hI57ojjs84hPgQOfqPbuD_XThPyvyMxp-Y,1399
73
- odoo_addon_base_report_to_printer-16.0.1.4.0.dist-info/METADATA,sha256=0vCe34LyntFW6khLXtCc46zvVAlRFjGdQbEdoW1yyXI,7273
74
- odoo_addon_base_report_to_printer-16.0.1.4.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
75
- odoo_addon_base_report_to_printer-16.0.1.4.0.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
76
- odoo_addon_base_report_to_printer-16.0.1.4.0.dist-info/RECORD,,
73
+ odoo_addon_base_report_to_printer-16.0.1.5.0.dist-info/METADATA,sha256=6dI1tc2IBbzznhBPlCuj08cPWPIGLLpxwqXbwKd5qwc,7273
74
+ odoo_addon_base_report_to_printer-16.0.1.5.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
75
+ odoo_addon_base_report_to_printer-16.0.1.5.0.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
76
+ odoo_addon_base_report_to_printer-16.0.1.5.0.dist-info/RECORD,,