Commit Graph

116 Commits

Author SHA1 Message Date
Dave Lasley
d533a2e3e1 [FIX] base_report_to_printer: Switch error type
* Prefer UserError to Warning
2017-10-03 18:13:19 +02:00
Dave Lasley
7281badd52 [FIX] base_report_to_printer: Remove execute bit 2017-10-03 18:13:18 +02:00
Dave Lasley
b655dd1ef6 [FIX] base_report_to_printer: Unify logger import 2017-10-03 18:13:18 +02:00
Dave Lasley
bd6f63e969 [FIX] base_report_to_printer: Minor fixes
* Migrate print_document method to v8 api exclusively
* Use api.multi on _can_print_report
* Simplify printing_printer description
* Simplify noupdate declaration
2017-10-03 18:13:17 +02:00
Dave Lasley
3dae8510f3 [IMP] base_report_to_printer: Add test coverage
* Add test coverage
* Minor touch ups in wizard
* Prefer UserError to Warning
2017-10-03 18:13:17 +02:00
Dave Lasley
9b3eddd88d [MIG] base_report_to_printer: Upgrade to v9 2017-10-03 18:13:17 +02:00
Roel Adriaans
2eac4d40ce [IMP] Soft fail on missing cups import
cups is an external dependency, if it is not installed Odoo will not start.
OCA guidelines specify guidelines for External dependencies, code is from there.
2017-10-03 18:13:16 +02:00
Yannick Vaucher
70d61f7ab0 Merge branch '8.0' of https://github.com/intero-chz/report-print-send into 8.0 2017-10-03 18:13:16 +02:00
Alexis de Lattre
9b5db105fc Add support for multiple copies 2017-10-03 18:13:15 +02:00
czoellner
3ae8fb2dc3 pass context to printer to use it for example in print_options()
* context was lost while getting report
* now it will be passed using with_context
* could be used for print_options (example: pass copies amount for
productlabals)
2017-10-03 18:13:15 +02:00
Pedro M. Baeza
1580da488e [MIG] Make modules uninstallable 2017-10-03 18:13:14 +02:00
Stéphane Bidoul
c03f3c0252 [UPD] prefix versions with 8.0 2017-10-03 18:13:14 +02:00
Yannick Vaucher
bb3e8569bd [PEP8] 2017-10-03 18:13:14 +02:00
vrenaville
3bda06635e [FIX] test if the module is installed before monkey patching 2017-10-03 18:13:13 +02:00
Anthony Muschang
fb0bc40a77 [FIX] base_report_to_printer: make print_document callable from 8.0 api 2017-10-03 18:13:13 +02:00
Anthony Muschang
3fe4f72dfb [FIX] base_report_to_printer: make get_pdf callable from 8.0 api 2017-10-03 18:13:12 +02:00
Nicolas Bessi
67ec48b4c3 Improve bloated condition test 2017-10-03 18:13:12 +02:00
Guewen Baconnier
679f21b39c dict.copy() is more efficient than calling dict 2017-10-03 18:13:11 +02:00
Guewen Baconnier
e991d88ba3 Vague method name, put the predicate method closer to its caller 2017-10-03 18:13:11 +02:00
Guewen Baconnier
55ed4e3206 Past tense is confusing 2017-10-03 18:13:11 +02:00
Guewen Baconnier
e6a846341b The alteration of the context has no effect 2017-10-03 18:13:10 +02:00
Nicolas Bessi
5095569ba5 Fix set the skip directive in context
instead of a faulty return
2017-10-03 18:13:10 +02:00
Nicolas Bessi
2a1e3dabe1 Compatibility fix for report with custom parser
By calling `super.get_pdf` in print_document we can encounter trouble with MRO resolution
that prevent custom report parser (e.g. override of `get_pdf`) to be called.

The fix consist of not calling `super` and prevent multiple call to 'printer.print_document'
2017-10-03 18:13:09 +02:00
Alexandre Fayolle
0863057526 Add OCA as author of OCA addons
In order to get visibility on https://www.odoo.com/apps the OCA board has
decided to add the OCA as author of all the addons maintained as part of the
association.
2017-10-03 18:13:09 +02:00
Guewen Baconnier
e8058b21a2 When get_pdf has no printer, just create the pdf file
And do not print anything, instead of raising an error.
2017-10-03 18:13:08 +02:00
Guewen Baconnier
c27499cf3e Add a limitation in the readme
Corrected some typos at the same time
2017-10-03 18:13:08 +02:00
Guewen Baconnier
d814ab0f41 Updated translations 2017-10-03 18:13:07 +02:00
Guewen Baconnier
fe9c7a54d3 Raise an error if no printer is configured 2017-10-03 18:13:07 +02:00
Guewen Baconnier
83170107a8 Do no longer returns a PDF when a report is printed
Instead, a notification is displayed to the user.
When report.get_pdf() is called on a report that must be printer,
it will print the report *and* returns the pdf, thus code that
calls directly report.get_pdf() will print the pdf on the printer
as expected.

Fixes #16
2017-10-03 18:13:07 +02:00
Alexis de Lattre
77d817af25 Add CUPS_HOST in more debug logs 2017-10-03 18:13:06 +02:00
Alexis de Lattre
35dff1b11c base_report_to_printer: add support for remote CUPS server (not just localhost)
More logging and better error handling
2017-10-03 18:13:06 +02:00
Alexis de Lattre
656939d38e [Usability] Auto-add Administrator user to the Print group
Make XML code more readable
2017-10-03 18:13:05 +02:00
Alexis de Lattre
421bcda960 [FIX] Bug #19 avoid crash when using 'raw' option 2017-10-03 18:13:05 +02:00
Guewen Baconnier
354bade837 Give access to models to all users for reading
So they are able to print
2017-10-03 18:13:04 +02:00
Guewen Baconnier
9dc3dd7ce0 Clean the XML file (remove eval, reindent) 2017-10-03 18:13:04 +02:00
Guewen Baconnier
b4e9161dcc Do not write the printer status if it has not changed
Avoid unnecessary UPDATE every minute
2017-10-03 18:13:04 +02:00
Guewen Baconnier
254495f994 Use a cron instead of threads to update printers status
The implementation with threads was blocking the loading of the
server in multiprocess.  Using a cron will lower the frequency of
the updates but at least it is simple and reliable.

Fixes #14
2017-10-03 18:13:03 +02:00
Guewen Baconnier
b015085e63 Invalidate the cache when the table is created so the table_exists()
method returns a fresh value after creation of the table
2017-10-03 18:13:03 +02:00
Guewen Baconnier
262a5db1e8 Error on installation of the module 2017-10-03 18:13:02 +02:00
Guewen Baconnier
916d974add Extract a method so it will be easier to override in printer_tray 2017-10-03 18:13:02 +02:00
Guewen Baconnier
9df607093d Refresh the list of printers every 15 seconds instead of 10 2017-10-03 18:13:01 +02:00
Guewen Baconnier
ebe52ef481 Avoid to hits the database too many times to check if the list of
printers needs to be refreshed.

Keep the last update datetime in cache and invalidate this datetime if is
is older than POLL_INTERVAL.  Thus, one process won't hit the DB more
than 1 time every POLL_INTERVAL (10 seconds currently) to check if it
needs to update the list.
2017-10-03 18:13:01 +02:00
Guewen Baconnier
7ac2564668 Move the 'skip_update' right in the browse, it prevents a loop
See https://github.com/odoo/odoo/issues/3644

Also, it helps to have the value set/read in context close to each
other.
2017-10-03 18:13:01 +02:00
Guewen Baconnier
39bd5e94e4 We need the report in print_document and print options (needed in
printer_tray)
2017-10-03 18:13:00 +02:00
Guewen Baconnier
ad5e8b6e46 missing api decorator 2017-10-03 18:13:00 +02:00
Guewen Baconnier
975afd7c72 Update translations, add a string to URI so it is uppercased 2017-10-03 18:12:59 +02:00
Guewen Baconnier
aecc0a5114 Improve form view, add search view for printers 2017-10-03 18:12:59 +02:00
Guewen Baconnier
e15d2672fe Update copyrights 2017-10-03 18:12:58 +02:00
Guewen Baconnier
3d89e22aeb Restore the print capability on deprecated reports 2017-10-03 18:12:58 +02:00
Guewen Baconnier
9c4ea8c10c Implements the print on the new 'report' model 2017-10-03 18:12:58 +02:00