odoo-addon-base-report-to-printer 17.0.1.1.1__py3-none-any.whl → 18.0.1.0.0.2__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.
- odoo/addons/base_report_to_printer/README.rst +52 -45
- odoo/addons/base_report_to_printer/__manifest__.py +1 -1
- odoo/addons/base_report_to_printer/data/printing_data.xml +5 -11
- odoo/addons/base_report_to_printer/i18n/am.po +17 -47
- odoo/addons/base_report_to_printer/i18n/base_report_to_printer.pot +1 -12
- odoo/addons/base_report_to_printer/i18n/bg.po +17 -47
- odoo/addons/base_report_to_printer/i18n/ca.po +17 -47
- odoo/addons/base_report_to_printer/i18n/de.po +19 -64
- odoo/addons/base_report_to_printer/i18n/el_GR.po +17 -47
- odoo/addons/base_report_to_printer/i18n/es.po +19 -64
- odoo/addons/base_report_to_printer/i18n/es_AR.po +19 -64
- odoo/addons/base_report_to_printer/i18n/es_ES.po +17 -47
- odoo/addons/base_report_to_printer/i18n/fi.po +17 -47
- odoo/addons/base_report_to_printer/i18n/fr.po +19 -64
- odoo/addons/base_report_to_printer/i18n/gl.po +17 -47
- odoo/addons/base_report_to_printer/i18n/hr.po +20 -53
- odoo/addons/base_report_to_printer/i18n/hr_HR.po +19 -49
- odoo/addons/base_report_to_printer/i18n/it.po +19 -65
- odoo/addons/base_report_to_printer/i18n/nl.po +17 -47
- odoo/addons/base_report_to_printer/i18n/nl_NL.po +17 -47
- odoo/addons/base_report_to_printer/i18n/pt.po +17 -47
- odoo/addons/base_report_to_printer/i18n/pt_BR.po +17 -47
- odoo/addons/base_report_to_printer/i18n/pt_PT.po +17 -47
- odoo/addons/base_report_to_printer/i18n/sl.po +19 -49
- odoo/addons/base_report_to_printer/i18n/sv.po +19 -64
- odoo/addons/base_report_to_printer/i18n/tr.po +17 -47
- odoo/addons/base_report_to_printer/i18n/zh_CN.po +21 -66
- odoo/addons/base_report_to_printer/models/ir_actions_report.py +6 -5
- odoo/addons/base_report_to_printer/models/printing_action.py +2 -2
- odoo/addons/base_report_to_printer/models/printing_printer.py +1 -1
- odoo/addons/base_report_to_printer/models/printing_report_xml_action.py +1 -1
- odoo/addons/base_report_to_printer/models/res_users.py +11 -3
- odoo/addons/base_report_to_printer/readme/CONTRIBUTORS.md +1 -0
- odoo/addons/base_report_to_printer/readme/CREDITS.md +1 -0
- odoo/addons/base_report_to_printer/static/description/index.html +16 -9
- odoo/addons/base_report_to_printer/static/src/js/qweb_action_manager.esm.js +2 -2
- odoo/addons/base_report_to_printer/tests/test_ir_actions_report.py +121 -86
- odoo/addons/base_report_to_printer/tests/test_printing_job.py +16 -9
- odoo/addons/base_report_to_printer/tests/test_printing_printer.py +50 -34
- odoo/addons/base_report_to_printer/tests/test_printing_printer_tray.py +9 -9
- odoo/addons/base_report_to_printer/tests/test_printing_printer_wizard.py +15 -9
- odoo/addons/base_report_to_printer/tests/test_printing_server.py +38 -27
- odoo/addons/base_report_to_printer/tests/test_report.py +41 -20
- odoo/addons/base_report_to_printer/views/printing_job.xml +2 -2
- odoo/addons/base_report_to_printer/views/printing_printer.xml +3 -3
- odoo/addons/base_report_to_printer/views/printing_report.xml +2 -2
- odoo/addons/base_report_to_printer/views/printing_server.xml +3 -3
- odoo/addons/base_report_to_printer/wizards/print_attachment_report.xml +2 -2
- odoo/addons/base_report_to_printer/wizards/printing_printer_update_wizard.py +1 -1
- {odoo_addon_base_report_to_printer-17.0.1.1.1.dist-info → odoo_addon_base_report_to_printer-18.0.1.0.0.2.dist-info}/METADATA +55 -48
- odoo_addon_base_report_to_printer-18.0.1.0.0.2.dist-info/RECORD +77 -0
- odoo_addon_base_report_to_printer-17.0.1.1.1.dist-info/RECORD +0 -76
- {odoo_addon_base_report_to_printer-17.0.1.1.1.dist-info → odoo_addon_base_report_to_printer-18.0.1.0.0.2.dist-info}/WHEEL +0 -0
- {odoo_addon_base_report_to_printer-17.0.1.1.1.dist-info → odoo_addon_base_report_to_printer-18.0.1.0.0.2.dist-info}/top_level.txt +0 -0
|
@@ -99,7 +99,7 @@ class TestPrintingPrinter(TransactionCase):
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
@mock.patch("
|
|
102
|
+
@mock.patch(f"{server_model}.cups")
|
|
103
103
|
def test_update_printers(self, cups):
|
|
104
104
|
"""
|
|
105
105
|
Check that the update_printers method calls _prepare_update_from_cups
|
|
@@ -111,7 +111,7 @@ class TestPrintingPrinter(TransactionCase):
|
|
|
111
111
|
self.ServerModel.update_printers()
|
|
112
112
|
self.assertEqual(self.printer.name, "My custom name")
|
|
113
113
|
|
|
114
|
-
@mock.patch("
|
|
114
|
+
@mock.patch(f"{server_model}.cups")
|
|
115
115
|
def test_prepare_update_from_cups_no_ppd(self, cups):
|
|
116
116
|
"""
|
|
117
117
|
Check that the tray_ids field has no value when no PPD is available
|
|
@@ -124,7 +124,7 @@ class TestPrintingPrinter(TransactionCase):
|
|
|
124
124
|
vals = self.printer._prepare_update_from_cups(connection, cups_printer)
|
|
125
125
|
self.assertFalse("tray_ids" in vals)
|
|
126
126
|
|
|
127
|
-
@mock.patch("
|
|
127
|
+
@mock.patch(f"{server_model}.cups")
|
|
128
128
|
def test_prepare_update_from_cups_empty_ppd(self, cups):
|
|
129
129
|
"""
|
|
130
130
|
Check that the tray_ids field has no value when the PPD file has
|
|
@@ -142,7 +142,7 @@ class TestPrintingPrinter(TransactionCase):
|
|
|
142
142
|
vals = self.printer._prepare_update_from_cups(connection, cups_printer)
|
|
143
143
|
self.assertFalse("tray_ids" in vals)
|
|
144
144
|
|
|
145
|
-
@mock.patch("
|
|
145
|
+
@mock.patch(f"{server_model}.cups")
|
|
146
146
|
@mock.patch("os.unlink")
|
|
147
147
|
def test_prepare_update_from_cups_unlink_error(self, os_unlink, cups):
|
|
148
148
|
"""
|
|
@@ -159,7 +159,7 @@ class TestPrintingPrinter(TransactionCase):
|
|
|
159
159
|
with self.assertRaises(OSError):
|
|
160
160
|
self.printer._prepare_update_from_cups(connection, cups_printer)
|
|
161
161
|
|
|
162
|
-
@mock.patch("
|
|
162
|
+
@mock.patch(f"{server_model}.cups")
|
|
163
163
|
@mock.patch("os.unlink")
|
|
164
164
|
def test_prepare_update_from_cups_unlink_error_enoent(self, os_unlink, cups):
|
|
165
165
|
"""
|
|
@@ -181,7 +181,7 @@ class TestPrintingPrinter(TransactionCase):
|
|
|
181
181
|
[(0, 0, {"name": "Auto (Default)", "system_name": "Auto"})],
|
|
182
182
|
)
|
|
183
183
|
|
|
184
|
-
@mock.patch("
|
|
184
|
+
@mock.patch(f"{server_model}.cups")
|
|
185
185
|
def test_prepare_update_from_cups(self, cups):
|
|
186
186
|
"""
|
|
187
187
|
Check the return value when adding a single tray
|
|
@@ -197,7 +197,7 @@ class TestPrintingPrinter(TransactionCase):
|
|
|
197
197
|
[(0, 0, {"name": "Auto (Default)", "system_name": "Auto"})],
|
|
198
198
|
)
|
|
199
199
|
|
|
200
|
-
@mock.patch("
|
|
200
|
+
@mock.patch(f"{server_model}.cups")
|
|
201
201
|
def test_prepare_update_from_cups_with_multiple_trays(self, cups):
|
|
202
202
|
"""
|
|
203
203
|
Check the return value when adding multiple trays at once
|
|
@@ -216,7 +216,7 @@ class TestPrintingPrinter(TransactionCase):
|
|
|
216
216
|
],
|
|
217
217
|
)
|
|
218
218
|
|
|
219
|
-
@mock.patch("
|
|
219
|
+
@mock.patch(f"{server_model}.cups")
|
|
220
220
|
def test_prepare_update_from_cups_already_known_trays(self, cups):
|
|
221
221
|
"""
|
|
222
222
|
Check that calling the method twice doesn't create the trays multiple
|
|
@@ -236,7 +236,7 @@ class TestPrintingPrinter(TransactionCase):
|
|
|
236
236
|
[(0, 0, {"name": "Auto (Default)", "system_name": "Auto"})],
|
|
237
237
|
)
|
|
238
238
|
|
|
239
|
-
@mock.patch("
|
|
239
|
+
@mock.patch(f"{server_model}.cups")
|
|
240
240
|
def test_prepare_update_from_cups_unknown_trays(self, cups):
|
|
241
241
|
"""
|
|
242
242
|
Check that trays which are not in the PPD file are removed from Odoo
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Copyright 2016 LasLabs Inc.
|
|
2
2
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
3
3
|
|
|
4
|
+
import logging
|
|
4
5
|
from unittest import mock
|
|
5
6
|
|
|
6
7
|
from odoo.exceptions import UserError
|
|
@@ -36,7 +37,7 @@ class TestPrintingPrinterWizard(TransactionCase):
|
|
|
36
37
|
"uri": self.printer_vals["device-uri"],
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
@mock.patch("
|
|
40
|
+
@mock.patch(f"{model}.cups")
|
|
40
41
|
def test_action_ok_inits_connection(self, cups):
|
|
41
42
|
"""It should initialize CUPS connection"""
|
|
42
43
|
self.Model.action_ok()
|
|
@@ -44,7 +45,7 @@ class TestPrintingPrinterWizard(TransactionCase):
|
|
|
44
45
|
host=self.server.address, port=self.server.port
|
|
45
46
|
)
|
|
46
47
|
|
|
47
|
-
@mock.patch("
|
|
48
|
+
@mock.patch(f"{model}.cups")
|
|
48
49
|
def test_action_ok_gets_printers(self, cups):
|
|
49
50
|
"""It should get printers from CUPS"""
|
|
50
51
|
cups.Connection().getPrinters.return_value = {"sys_name": self.printer_vals}
|
|
@@ -52,14 +53,19 @@ class TestPrintingPrinterWizard(TransactionCase):
|
|
|
52
53
|
self.Model.action_ok()
|
|
53
54
|
cups.Connection().getPrinters.assert_called_once_with()
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
def test_action_ok_raises_warning_on_error(self, cups):
|
|
56
|
+
def test_action_ok_raises_warning_on_error(self):
|
|
57
57
|
"""It should raise Warning on any error"""
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
self.
|
|
58
|
+
with (
|
|
59
|
+
mock.patch(f"{model}.cups") as cups,
|
|
60
|
+
self.assertLogs(level=logging.WARNING) as logs,
|
|
61
|
+
):
|
|
62
|
+
cups.Connection.side_effect = StopTest
|
|
63
|
+
with self.assertRaises(UserError):
|
|
64
|
+
self.Model.action_ok()
|
|
65
|
+
self.assertEqual(len(logs.records), 1)
|
|
66
|
+
self.assertEqual(logs.records[0].levelno, logging.WARNING)
|
|
61
67
|
|
|
62
|
-
@mock.patch("
|
|
68
|
+
@mock.patch(f"{model}.cups")
|
|
63
69
|
def test_action_ok_creates_new_printer(self, cups):
|
|
64
70
|
"""It should create new printer w/ proper vals"""
|
|
65
71
|
cups.Connection().getPrinters.return_value = {"sys_name": self.printer_vals}
|
|
@@ -75,7 +81,7 @@ class TestPrintingPrinterWizard(TransactionCase):
|
|
|
75
81
|
|
|
76
82
|
self.assertEqual(val, rec_id[key])
|
|
77
83
|
|
|
78
|
-
@mock.patch("
|
|
84
|
+
@mock.patch(f"{model}.cups")
|
|
79
85
|
def test_action_ok_skips_existing_printer(self, cups):
|
|
80
86
|
"""It should not recreate existing printers"""
|
|
81
87
|
cups.Connection().getPrinters.return_value = {"sys_name": self.printer_vals}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Copyright 2016 LasLabs Inc.
|
|
2
2
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
3
3
|
|
|
4
|
+
import logging
|
|
4
5
|
from unittest import mock
|
|
5
6
|
|
|
6
7
|
from odoo import fields
|
|
@@ -43,15 +44,20 @@ class TestPrintingServer(TransactionCase):
|
|
|
43
44
|
values["printer_id"] = printer.id
|
|
44
45
|
return self.env["printing.job"].create(values)
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
def test_update_printers_error(self, cups):
|
|
47
|
+
def test_update_printers_error(self):
|
|
48
48
|
"""It should catch any exception from CUPS and update status"""
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
with (
|
|
50
|
+
mock.patch(f"{model}.cups") as cups,
|
|
51
|
+
self.assertLogs(level=logging.WARNING) as logs,
|
|
52
|
+
):
|
|
53
|
+
cups.Connection.side_effect = Exception
|
|
54
|
+
rec_id = self.new_printer()
|
|
55
|
+
self.Model.update_printers()
|
|
56
|
+
self.assertEqual("server-error", rec_id.status)
|
|
57
|
+
self.assertEqual(len(logs.records), 1)
|
|
58
|
+
self.assertEqual(logs.records[0].levelno, logging.WARNING)
|
|
53
59
|
|
|
54
|
-
@mock.patch("
|
|
60
|
+
@mock.patch(f"{model}.cups")
|
|
55
61
|
def test_update_printers_inits_cups(self, cups):
|
|
56
62
|
"""It should init CUPS connection"""
|
|
57
63
|
self.new_printer()
|
|
@@ -60,29 +66,29 @@ class TestPrintingServer(TransactionCase):
|
|
|
60
66
|
host=self.server.address, port=self.server.port
|
|
61
67
|
)
|
|
62
68
|
|
|
63
|
-
@mock.patch("
|
|
69
|
+
@mock.patch(f"{model}.cups")
|
|
64
70
|
def test_update_printers_gets_all_printers(self, cups):
|
|
65
71
|
"""It should get all printers from CUPS server"""
|
|
66
72
|
self.new_printer()
|
|
67
73
|
self.Model.update_printers()
|
|
68
74
|
cups.Connection().getPrinters.assert_called_once_with()
|
|
69
75
|
|
|
70
|
-
@mock.patch("
|
|
76
|
+
@mock.patch(f"{model}.cups")
|
|
71
77
|
def test_update_printers_search(self, cups):
|
|
72
78
|
"""It should search all when no domain"""
|
|
73
|
-
with mock.patch("
|
|
79
|
+
with mock.patch(f"{model_base}.search") as search:
|
|
74
80
|
self.Model.update_printers()
|
|
75
81
|
search.assert_called_once_with([])
|
|
76
82
|
|
|
77
|
-
@mock.patch("
|
|
83
|
+
@mock.patch(f"{model}.cups")
|
|
78
84
|
def test_update_printers_search_domain(self, cups):
|
|
79
85
|
"""It should use specific domain for search"""
|
|
80
|
-
with mock.patch("
|
|
86
|
+
with mock.patch(f"{model_base}.search") as search:
|
|
81
87
|
expect = [("id", ">", 0)]
|
|
82
88
|
self.Model.update_printers(expect)
|
|
83
89
|
search.assert_called_once_with(expect)
|
|
84
90
|
|
|
85
|
-
@mock.patch("
|
|
91
|
+
@mock.patch(f"{model}.cups")
|
|
86
92
|
def test_update_printers_update_unavailable(self, cups):
|
|
87
93
|
"""It should update status when printer is unavailable"""
|
|
88
94
|
rec_id = self.new_printer()
|
|
@@ -90,7 +96,7 @@ class TestPrintingServer(TransactionCase):
|
|
|
90
96
|
self.Model.action_update_printers()
|
|
91
97
|
self.assertEqual("unavailable", rec_id.status)
|
|
92
98
|
|
|
93
|
-
@mock.patch("
|
|
99
|
+
@mock.patch(f"{model}.cups")
|
|
94
100
|
def test_update_archived_printers(self, cups):
|
|
95
101
|
"""It should update status even if printer is archived"""
|
|
96
102
|
rec_id = self.new_printer()
|
|
@@ -103,7 +109,7 @@ class TestPrintingServer(TransactionCase):
|
|
|
103
109
|
rec_id.status,
|
|
104
110
|
)
|
|
105
111
|
|
|
106
|
-
@mock.patch("
|
|
112
|
+
@mock.patch(f"{model}.cups")
|
|
107
113
|
def test_update_jobs_cron(self, cups):
|
|
108
114
|
"""It should get all jobs from CUPS server"""
|
|
109
115
|
self.new_printer()
|
|
@@ -125,7 +131,7 @@ class TestPrintingServer(TransactionCase):
|
|
|
125
131
|
],
|
|
126
132
|
)
|
|
127
133
|
|
|
128
|
-
@mock.patch("
|
|
134
|
+
@mock.patch(f"{model}.cups")
|
|
129
135
|
def test_update_jobs_button(self, cups):
|
|
130
136
|
"""It should get all jobs from CUPS server"""
|
|
131
137
|
self.new_printer()
|
|
@@ -147,17 +153,22 @@ class TestPrintingServer(TransactionCase):
|
|
|
147
153
|
],
|
|
148
154
|
)
|
|
149
155
|
|
|
150
|
-
|
|
151
|
-
def test_update_jobs_error(self, cups):
|
|
156
|
+
def test_update_jobs_error(self):
|
|
152
157
|
"""It should catch any exception from CUPS and update status"""
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
with (
|
|
159
|
+
mock.patch(f"{model}.cups") as cups,
|
|
160
|
+
self.assertLogs(level=logging.WARNING) as logs,
|
|
161
|
+
):
|
|
162
|
+
cups.Connection.side_effect = Exception
|
|
163
|
+
self.new_printer()
|
|
164
|
+
self.server.update_jobs()
|
|
165
|
+
cups.Connection.assert_called_with(
|
|
166
|
+
host=self.server.address, port=self.server.port
|
|
167
|
+
)
|
|
168
|
+
self.assertEqual(len(logs.records), 2)
|
|
169
|
+
self.assertEqual(logs.records[0].levelno, logging.WARNING)
|
|
170
|
+
|
|
171
|
+
@mock.patch(f"{model}.cups")
|
|
161
172
|
def test_update_jobs_uncompleted(self, cups):
|
|
162
173
|
"""
|
|
163
174
|
It should search which jobs have been completed since last update
|
|
@@ -182,7 +193,7 @@ class TestPrintingServer(TransactionCase):
|
|
|
182
193
|
],
|
|
183
194
|
)
|
|
184
195
|
|
|
185
|
-
@mock.patch("
|
|
196
|
+
@mock.patch(f"{model}.cups")
|
|
186
197
|
def test_update_jobs(self, cups):
|
|
187
198
|
"""
|
|
188
199
|
It should update all jobs, known or not
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# Copyright 2017 Tecnativa - Jairo Llopis
|
|
3
3
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
4
4
|
|
|
5
|
+
import logging
|
|
5
6
|
from unittest import mock
|
|
6
7
|
|
|
7
8
|
from odoo import exceptions
|
|
@@ -128,11 +129,14 @@ class TestReport(common.HttpCase):
|
|
|
128
129
|
|
|
129
130
|
def test_render_qweb_pdf_printable(self):
|
|
130
131
|
"""It should print the report, only if it is printable"""
|
|
131
|
-
with
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
with (
|
|
133
|
+
mock.patch(
|
|
134
|
+
"odoo.addons.base_report_to_printer.models."
|
|
135
|
+
"printing_printer.PrintingPrinter."
|
|
136
|
+
"print_document"
|
|
137
|
+
) as print_document,
|
|
138
|
+
self.assertLogs(level=logging.WARNING) as logs,
|
|
139
|
+
):
|
|
136
140
|
self.report.property_printing_action_id.action_type = "server"
|
|
137
141
|
self.report.printing_printer_id = self.new_printer()
|
|
138
142
|
document = self.report._render_qweb_pdf(
|
|
@@ -145,14 +149,19 @@ class TestReport(common.HttpCase):
|
|
|
145
149
|
doc_format="qweb-pdf",
|
|
146
150
|
tray=False,
|
|
147
151
|
)
|
|
152
|
+
self.assertEqual(len(logs.records), 1)
|
|
153
|
+
self.assertEqual(logs.records[0].levelno, logging.WARNING)
|
|
148
154
|
|
|
149
155
|
def test_render_qweb_text_printable(self):
|
|
150
156
|
"""It should print the report, only if it is printable"""
|
|
151
|
-
with
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
with (
|
|
158
|
+
mock.patch(
|
|
159
|
+
"odoo.addons.base_report_to_printer.models."
|
|
160
|
+
"printing_printer.PrintingPrinter."
|
|
161
|
+
"print_document"
|
|
162
|
+
) as print_document,
|
|
163
|
+
self.assertLogs(level=logging.WARNING) as logs,
|
|
164
|
+
):
|
|
156
165
|
self.report_text.property_printing_action_id.action_type = "server"
|
|
157
166
|
self.report_text.printing_printer_id = self.new_printer()
|
|
158
167
|
document = self.report_text._render_qweb_text(
|
|
@@ -165,29 +174,41 @@ class TestReport(common.HttpCase):
|
|
|
165
174
|
doc_format="qweb-text",
|
|
166
175
|
tray=False,
|
|
167
176
|
)
|
|
177
|
+
self.assertEqual(len(logs.records), 1)
|
|
178
|
+
self.assertEqual(logs.records[0].levelno, logging.WARNING)
|
|
168
179
|
|
|
169
180
|
def test_print_document_not_printable(self):
|
|
170
181
|
"""It should print the report, regardless of the defined behaviour"""
|
|
171
182
|
self.report.printing_printer_id = self.new_printer()
|
|
172
|
-
with
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
183
|
+
with (
|
|
184
|
+
mock.patch(
|
|
185
|
+
"odoo.addons.base_report_to_printer.models."
|
|
186
|
+
"printing_printer.PrintingPrinter."
|
|
187
|
+
"print_document"
|
|
188
|
+
) as print_document,
|
|
189
|
+
self.assertLogs(level=logging.WARNING) as logs,
|
|
190
|
+
):
|
|
177
191
|
self.report.print_document(self.partners.ids)
|
|
178
192
|
print_document.assert_called_once()
|
|
193
|
+
self.assertEqual(len(logs.records), 2)
|
|
194
|
+
self.assertEqual(logs.records[0].levelno, logging.WARNING)
|
|
179
195
|
|
|
180
196
|
def test_print_document_printable(self):
|
|
181
197
|
"""It should print the report, regardless of the defined behaviour"""
|
|
182
198
|
self.report.property_printing_action_id.action_type = "server"
|
|
183
199
|
self.report.printing_printer_id = self.new_printer()
|
|
184
|
-
with
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
200
|
+
with (
|
|
201
|
+
mock.patch(
|
|
202
|
+
"odoo.addons.base_report_to_printer.models."
|
|
203
|
+
"printing_printer.PrintingPrinter."
|
|
204
|
+
"print_document"
|
|
205
|
+
) as print_document,
|
|
206
|
+
self.assertLogs(level=logging.WARNING) as logs,
|
|
207
|
+
):
|
|
189
208
|
self.report.print_document(self.partners.ids)
|
|
190
209
|
print_document.assert_called_once()
|
|
210
|
+
self.assertEqual(len(logs.records), 2)
|
|
211
|
+
self.assertEqual(logs.records[0].levelno, logging.WARNING)
|
|
191
212
|
|
|
192
213
|
def test_print_document_no_printer(self):
|
|
193
214
|
"""It should raise an error"""
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
<field name="name">printing.job.tree (in base_report_to_printer)</field>
|
|
37
37
|
<field name="model">printing.job</field>
|
|
38
38
|
<field name="arch" type="xml">
|
|
39
|
-
<
|
|
39
|
+
<list>
|
|
40
40
|
<field name="name" />
|
|
41
41
|
<field name="job_id_cups" />
|
|
42
42
|
<field name="job_state" />
|
|
43
|
-
</
|
|
43
|
+
</list>
|
|
44
44
|
</field>
|
|
45
45
|
</record>
|
|
46
46
|
</odoo>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<field name="name">printing.printer.tree (in base_report_to_printer)</field>
|
|
102
102
|
<field name="model">printing.printer</field>
|
|
103
103
|
<field name="arch" type="xml">
|
|
104
|
-
<
|
|
104
|
+
<list
|
|
105
105
|
decoration-success="status=='available'"
|
|
106
106
|
decoration-warning="status=='printing'"
|
|
107
107
|
decoration-danger="status not in ['printing', 'available']"
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
<field name="system_name" />
|
|
112
112
|
<field name="server_id" />
|
|
113
113
|
<field name="status" />
|
|
114
|
-
</
|
|
114
|
+
</list>
|
|
115
115
|
</field>
|
|
116
116
|
</record>
|
|
117
117
|
<record model="ir.ui.view" id="printing_printer_view_search">
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
<field name="name">Show Printers</field>
|
|
136
136
|
<field name="type">ir.actions.act_window</field>
|
|
137
137
|
<field name="res_model">printing.printer</field>
|
|
138
|
-
<field name="view_mode">
|
|
138
|
+
<field name="view_mode">list,form</field>
|
|
139
139
|
</record>
|
|
140
140
|
<menuitem
|
|
141
141
|
name="Printers"
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
>printing.report.xml.action.tree (in base_report_to_printer)</field>
|
|
22
22
|
<field name="model">printing.report.xml.action</field>
|
|
23
23
|
<field name="arch" type="xml">
|
|
24
|
-
<
|
|
24
|
+
<list>
|
|
25
25
|
<field name="user_id" />
|
|
26
26
|
<field name="action" />
|
|
27
27
|
<field name="printer_id" />
|
|
28
28
|
<field name="printer_tray_id" />
|
|
29
|
-
</
|
|
29
|
+
</list>
|
|
30
30
|
</field>
|
|
31
31
|
</record>
|
|
32
32
|
<!-- Add a shorcut to "Actions/Report" in the Printing menu -->
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
<field name="name">printing.server.tree (in base_report_to_printer)</field>
|
|
46
46
|
<field name="model">printing.server</field>
|
|
47
47
|
<field name="arch" type="xml">
|
|
48
|
-
<
|
|
48
|
+
<list>
|
|
49
49
|
<field name="name" />
|
|
50
50
|
<field name="address" />
|
|
51
51
|
<field name="port" />
|
|
52
|
-
</
|
|
52
|
+
</list>
|
|
53
53
|
</field>
|
|
54
54
|
</record>
|
|
55
55
|
<record model="ir.ui.view" id="printing_server_view_search">
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
<field name="name">Servers</field>
|
|
68
68
|
<field name="type">ir.actions.act_window</field>
|
|
69
69
|
<field name="res_model">printing.server</field>
|
|
70
|
-
<field name="view_mode">
|
|
70
|
+
<field name="view_mode">list,form</field>
|
|
71
71
|
</record>
|
|
72
72
|
<menuitem
|
|
73
73
|
name="Servers"
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
<group>
|
|
9
9
|
<field name="printer_id" />
|
|
10
10
|
<field name="attachment_line_ids">
|
|
11
|
-
<
|
|
11
|
+
<list editable="top">
|
|
12
12
|
<field name="attachment_id" create="0" />
|
|
13
13
|
<field name="record_name" />
|
|
14
14
|
<field name="copies" />
|
|
15
|
-
</
|
|
15
|
+
</list>
|
|
16
16
|
</field>
|
|
17
17
|
</group>
|
|
18
18
|
<footer>
|