diff --git a/base_report_to_printer/README.rst b/base_report_to_printer/README.rst index 4e49307..0c1819b 100644 --- a/base_report_to_printer/README.rst +++ b/base_report_to_printer/README.rst @@ -1,10 +1,29 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 +================= +Report to printer +================= -================= -Report To Printer -================= +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freport--print--send-lightgray.png?logo=github + :target: https://github.com/OCA/report-print-send/tree/12.0/base_report_to_printer + :alt: OCA/report-print-send +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/report-print-send-12-0/report-print-send-12-0-base_report_to_printer + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/144/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| This module allows users to send reports to a printer attached to the server. @@ -31,10 +50,17 @@ Settings can be configured: * per report * per user and report +**Table of contents** + +.. contents:: + :local: + Installation ============ -* Install PyCups - https://pypi.python.org/pypi/pycups +To install this module, you need to: + +#. Install PyCups - https://pypi.python.org/pypi/pycups .. code-block:: bash @@ -43,58 +69,64 @@ Installation sudo apt-get install python3-dev sudo pip install pycups - Configuration ============= -After installing enable the "Printing / Print User" option under access -rights to give users the ability to view the print menu. +To configure this module, you need to: +#. Enable the "Printing / Print User" option under access + rights to give users the ability to view the print menu. Usage ===== +Guidelines for use: + * To update the CUPS printers in *Settings > Printing > Update Printers from CUPS* - * If you want to print a report on a specific printer or tray, you can change + * To print a report on a specific printer or tray, you can change these in *Settings > Printing > Reports* to define default behaviour. - * If you want to print a report on a specific printer and/or tray for a user, you can + * To print a report on a specific printer and/or tray for a user, you can change these in *Settings > Printing > Reports* in *Specific actions per user* - * Users may also select a default action, printer or tray in their preferences + * Users may also select a default action, printer or tray in their preferences. When no tray is configured for a report and a user, the default tray setup on the CUPS server is used. -Caveat ------- +Changelog +========= -The notification when a report is sent to a printer will not be -displayed for the deprecated report types (RML, Webkit, ...). - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/144/11.0 +12.0.1.0.0 (2018-02-04) +~~~~~~~~~~~~~~~~~~~~~~~ +* [RELEASE] Port from V11. Bug Tracker =========== -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed feedback. +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* Agile Business Group & Domsense +* Pegueroles SCP +* NaN +* LasLabs +* Camptocamp +* Open for Small Business Ltd Contributors ------------- +~~~~~~~~~~~~ * Ferran Pegueroles * Albert Cervera i Areny @@ -106,18 +138,21 @@ Contributors * Dave Lasley * Sylvain Garancher * Jairo Llopis +* Graeme Gellatly -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/report-print-send `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_report_to_printer/__init__.py b/base_report_to_printer/__init__.py index 5c28b44..68217f5 100644 --- a/base_report_to_printer/__init__.py +++ b/base_report_to_printer/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (c) 2007 Ferran Pegueroles # Copyright (c) 2009 Albert Cervera i Areny # Copyright (C) 2011 Agile Business Group sagl () diff --git a/base_report_to_printer/__manifest__.py b/base_report_to_printer/__manifest__.py index 998f1f8..bd0f323 100644 --- a/base_report_to_printer/__manifest__.py +++ b/base_report_to_printer/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (c) 2007 Ferran Pegueroles # Copyright (c) 2009 Albert Cervera i Areny # Copyright (C) 2011 Agile Business Group sagl () @@ -8,10 +7,11 @@ { 'name': "Report to printer", - 'version': '11.0.2.3.0', + 'version': '12.0.1.0.0', 'category': 'Generic Modules/Base', 'author': "Agile Business Group & Domsense, Pegueroles SCP, NaN," - " LasLabs, Camptocamp, Odoo Community Association (OCA)", + " LasLabs, Camptocamp, Odoo Community Association (OCA)," + " Open for Small Business Ltd", 'website': 'http://www.agilebg.com', 'license': 'AGPL-3', "depends": ['web'], @@ -28,7 +28,7 @@ 'wizards/printing_printer_update_wizard_view.xml', ], 'installable': True, - 'application': True, + 'application': False, 'external_dependencies': { 'python': ['cups'], }, diff --git a/base_report_to_printer/models/__init__.py b/base_report_to_printer/models/__init__.py index ea1b173..6f03d65 100644 --- a/base_report_to_printer/models/__init__.py +++ b/base_report_to_printer/models/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from . import ir_actions_report from . import printing_action diff --git a/base_report_to_printer/models/ir_actions_report.py b/base_report_to_printer/models/ir_actions_report.py index a490ccc..3d864ab 100644 --- a/base_report_to_printer/models/ir_actions_report.py +++ b/base_report_to_printer/models/ir_actions_report.py @@ -136,14 +136,14 @@ class IrActionsReport(models.Model): res['id'] = self.id return res - def render_qweb_pdf(self, docids, data=None): + def render_qweb_pdf(self, res_ids=None, data=None): """ Generate a PDF and returns it. If the action configured on the report is server, it prints the generated document as well. """ document, doc_format = super(IrActionsReport, self).render_qweb_pdf( - docids, data=data) + res_ids=res_ids, data=data) behaviour = self.behaviour() printer = behaviour.pop('printer', None) diff --git a/base_report_to_printer/models/printing_action.py b/base_report_to_printer/models/printing_action.py index 39c2766..072ed24 100644 --- a/base_report_to_printer/models/printing_action.py +++ b/base_report_to_printer/models/printing_action.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (c) 2007 Ferran Pegueroles # Copyright (c) 2009 Albert Cervera i Areny # Copyright (C) 2011 Agile Business Group sagl () diff --git a/base_report_to_printer/models/printing_job.py b/base_report_to_printer/models/printing_job.py index 63fbde9..b082a2a 100644 --- a/base_report_to_printer/models/printing_job.py +++ b/base_report_to_printer/models/printing_job.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) 2016 SYLEAM () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/base_report_to_printer/models/printing_printer.py b/base_report_to_printer/models/printing_printer.py index 0e83e7e..fb9c504 100644 --- a/base_report_to_printer/models/printing_printer.py +++ b/base_report_to_printer/models/printing_printer.py @@ -62,9 +62,20 @@ class PrintingPrinter(models.Model): @api.multi def _prepare_update_from_cups(self, cups_connection, cups_printer): - vals = super(PrintingPrinter, self)._prepare_update_from_cups( - cups_connection, cups_printer) - + mapping = { + 3: 'available', + 4: 'printing', + 5: 'error' + } + vals = { + 'name': cups_printer['printer-info'], + 'model': cups_printer.get('printer-make-and-model', False), + 'location': cups_printer.get('printer-location', False), + 'uri': cups_printer.get('device-uri', False), + 'status': mapping.get(cups_printer.get( + 'printer-state'), 'unknown'), + 'status_message': cups_printer.get('printer-state-message', ''), + } printer_uri = cups_printer['printer-uri-supported'] printer_system_name = printer_uri[printer_uri.rfind('/') + 1:] ppd_info = cups_connection.getPPD3(printer_system_name) @@ -103,33 +114,12 @@ class PrintingPrinter(models.Model): for tray in self.tray_ids.filtered( lambda record: record.system_name not in cups_trays.keys()) ]) - - return vals - - @api.multi - def _prepare_update_from_cups(self, cups_connection, cups_printer): - mapping = { - 3: 'available', - 4: 'printing', - 5: 'error' - } - vals = { - 'name': cups_printer['printer-info'], - 'model': cups_printer.get('printer-make-and-model', False), - 'location': cups_printer.get('printer-location', False), - 'uri': cups_printer.get('device-uri', False), - 'status': mapping.get(cups_printer.get( - 'printer-state'), 'unknown'), - 'status_message': cups_printer.get('printer-state-message', ''), - } return vals @api.multi def print_document(self, report, content, **print_opts): """ Print a file - Format could be pdf, qweb-pdf, raw, ... - """ self.ensure_one() fd, file_name = mkstemp() diff --git a/base_report_to_printer/models/printing_report_xml_action.py b/base_report_to_printer/models/printing_report_xml_action.py index 018c079..6f61a6a 100644 --- a/base_report_to_printer/models/printing_report_xml_action.py +++ b/base_report_to_printer/models/printing_report_xml_action.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (c) 2007 Ferran Pegueroles # Copyright (c) 2009 Albert Cervera i Areny # Copyright (C) 2011 Agile Business Group sagl () diff --git a/base_report_to_printer/models/printing_server.py b/base_report_to_printer/models/printing_server.py index 3f30364..4f80536 100644 --- a/base_report_to_printer/models/printing_server.py +++ b/base_report_to_printer/models/printing_server.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) 2016 SYLEAM () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -206,6 +205,11 @@ class PrintingServer(models.Model): ('server_id', '=', server.id), ('system_name', '=', printer_system_name), ], limit=1) + # CUPS retains jobs for disconnected printers and also may + # leak jobs data for unshared printers, therefore we just + # discard here if not printer found + if not printer: + continue job_values['printer_id'] = printer.id if jobs: diff --git a/base_report_to_printer/models/printing_tray.py b/base_report_to_printer/models/printing_tray.py index da12e70..83910c4 100644 --- a/base_report_to_printer/models/printing_tray.py +++ b/base_report_to_printer/models/printing_tray.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) 2013-2014 Camptocamp () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/base_report_to_printer/models/res_users.py b/base_report_to_printer/models/res_users.py index fcab87b..552d48b 100644 --- a/base_report_to_printer/models/res_users.py +++ b/base_report_to_printer/models/res_users.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (c) 2007 Ferran Pegueroles # Copyright (c) 2009 Albert Cervera i Areny # Copyright (C) 2011 Agile Business Group sagl () @@ -38,7 +37,7 @@ class ResUsers(models.Model): 'printing_action', 'printing_printer_id', ]) - + printer_tray_id = fields.Many2one( comodel_name='printing.tray', string='Default Printer Paper Source', @@ -49,4 +48,3 @@ class ResUsers(models.Model): def onchange_printing_printer_id(self): """ Reset the tray when the printer is changed """ self.printer_tray_id = False - diff --git a/base_report_to_printer/readme/CONFIGURE.rst b/base_report_to_printer/readme/CONFIGURE.rst new file mode 100644 index 0000000..8bd851d --- /dev/null +++ b/base_report_to_printer/readme/CONFIGURE.rst @@ -0,0 +1,4 @@ +To configure this module, you need to: + +#. Enable the "Printing / Print User" option under access + rights to give users the ability to view the print menu. diff --git a/base_report_to_printer/readme/CONTRIBUTORS.rst b/base_report_to_printer/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..4489cbd --- /dev/null +++ b/base_report_to_printer/readme/CONTRIBUTORS.rst @@ -0,0 +1,11 @@ +* Ferran Pegueroles +* Albert Cervera i Areny +* Davide Corio +* Lorenzo Battistini +* Yannick Vaucher +* Lionel Sausin +* Guewen Baconnier +* Dave Lasley +* Sylvain Garancher +* Jairo Llopis +* Graeme Gellatly diff --git a/base_report_to_printer/readme/DESCRIPTION.rst b/base_report_to_printer/readme/DESCRIPTION.rst new file mode 100644 index 0000000..e6d6278 --- /dev/null +++ b/base_report_to_printer/readme/DESCRIPTION.rst @@ -0,0 +1,24 @@ +This module allows users to send reports to a printer attached to the server. + +It adds an optional behaviour on reports to send it directly to a printer. + +* `Send to Client` is the default behaviour providing you a downloadable PDF +* `Send to Printer` prints the report on selected printer + +It detects trays on printers installation plus permits to select the +paper source on which you want to print directly. + +Report behaviour is defined by settings. + +You will find this option on default user config, on default report +config and on specific config per user per report. + +This allows you to dedicate a specific paper source for example for +preprinted paper such as payment slip. + +Settings can be configured: + +* globally +* per user +* per report +* per user and report diff --git a/base_report_to_printer/readme/HISTORY.rst b/base_report_to_printer/readme/HISTORY.rst new file mode 100644 index 0000000..a1e75d1 --- /dev/null +++ b/base_report_to_printer/readme/HISTORY.rst @@ -0,0 +1,4 @@ +12.0.1.0.0 (2018-02-04) +~~~~~~~~~~~~~~~~~~~~~~~ + +* [RELEASE] Port from V11. diff --git a/base_report_to_printer/readme/INSTALL.rst b/base_report_to_printer/readme/INSTALL.rst new file mode 100644 index 0000000..a77fc91 --- /dev/null +++ b/base_report_to_printer/readme/INSTALL.rst @@ -0,0 +1,10 @@ +To install this module, you need to: + +#. Install PyCups - https://pypi.python.org/pypi/pycups + +.. code-block:: bash + + sudo apt-get install cups + sudo apt-get install libcups2-dev + sudo apt-get install python3-dev + sudo pip install pycups diff --git a/base_report_to_printer/readme/USAGE.rst b/base_report_to_printer/readme/USAGE.rst new file mode 100644 index 0000000..3f37116 --- /dev/null +++ b/base_report_to_printer/readme/USAGE.rst @@ -0,0 +1,13 @@ +Guidelines for use: + + * To update the CUPS printers in *Settings > Printing > Update Printers + from CUPS* + * To print a report on a specific printer or tray, you can change + these in *Settings > Printing > Reports* to define default behaviour. + * To print a report on a specific printer and/or tray for a user, you can + change these in *Settings > Printing > Reports* in + *Specific actions per user* + * Users may also select a default action, printer or tray in their preferences. + +When no tray is configured for a report and a user, the +default tray setup on the CUPS server is used. diff --git a/base_report_to_printer/security/security.xml b/base_report_to_printer/security/security.xml index da9f53e..1bbe6af 100644 --- a/base_report_to_printer/security/security.xml +++ b/base_report_to_printer/security/security.xml @@ -85,6 +85,15 @@ + + Printing Job User + + + + + + + Printing Action User diff --git a/base_report_to_printer/static/description/index.html b/base_report_to_printer/static/description/index.html new file mode 100644 index 0000000..e212e3e --- /dev/null +++ b/base_report_to_printer/static/description/index.html @@ -0,0 +1,508 @@ + + + + + + +Report to printer + + + +
+

Report to printer

+ + +

Beta License: AGPL-3 OCA/report-print-send Translate me on Weblate Try me on Runbot

+

This module allows users to send reports to a printer attached to the server.

+

It adds an optional behaviour on reports to send it directly to a printer.

+
    +
  • Send to Client is the default behaviour providing you a downloadable PDF
  • +
  • Send to Printer prints the report on selected printer
  • +
+

It detects trays on printers installation plus permits to select the +paper source on which you want to print directly.

+

Report behaviour is defined by settings.

+

You will find this option on default user config, on default report +config and on specific config per user per report.

+

This allows you to dedicate a specific paper source for example for +preprinted paper such as payment slip.

+

Settings can be configured:

+
    +
  • globally
  • +
  • per user
  • +
  • per report
  • +
  • per user and report
  • +
+

Table of contents

+ +
+

Installation

+

To install this module, you need to:

+
    +
  1. Install PyCups - https://pypi.python.org/pypi/pycups
  2. +
+
+sudo apt-get install cups
+sudo apt-get install libcups2-dev
+sudo apt-get install python3-dev
+sudo pip install pycups
+
+
+
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Enable the “Printing / Print User” option under access +rights to give users the ability to view the print menu.
  2. +
+
+
+

Usage

+

Guidelines for use:

+
+
    +
  • To update the CUPS printers in Settings > Printing > Update Printers +from CUPS
  • +
  • To print a report on a specific printer or tray, you can change +these in Settings > Printing > Reports to define default behaviour.
  • +
  • To print a report on a specific printer and/or tray for a user, you can +change these in Settings > Printing > Reports in +Specific actions per user
  • +
  • Users may also select a default action, printer or tray in their preferences.
  • +
+
+

When no tray is configured for a report and a user, the +default tray setup on the CUPS server is used.

+
+
+

Changelog

+
+

12.0.1.0.0 (2018-02-04)

+
    +
  • [RELEASE] Port from V11.
  • +
+
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Agile Business Group & Domsense
  • +
  • Pegueroles SCP
  • +
  • NaN
  • +
  • LasLabs
  • +
  • Camptocamp
  • +
  • Open for Small Business Ltd
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/report-print-send project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/base_report_to_printer/static/src/js/qweb_action_manager.js b/base_report_to_printer/static/src/js/qweb_action_manager.js index 6328f4d..e0c25f6 100644 --- a/base_report_to_printer/static/src/js/qweb_action_manager.js +++ b/base_report_to_printer/static/src/js/qweb_action_manager.js @@ -1,48 +1,50 @@ -odoo.define('base_report_to_printer.print', function(require) { +odoo.define('base_report_to_printer.print', function (require) { 'use strict'; var ActionManager = require('web.ActionManager'); var core = require('web.core'); - var framework = require('web.framework'); - var rpc = require('web.rpc'); + var _t = core._t; ActionManager.include({ - ir_actions_report: function(action, options) { - action_val = _.clone(action); - var _t = core._t; + _triggerDownload: function (action, options, type) { var self = this; var _super = this._super; - - if (action_val.report_type === 'qweb-pdf') { - framework.blockUI(); - rpc.query({ + if (type === 'pdf') { + this._rpc({ model: 'ir.actions.report', method: 'print_action_for_report_name', - args: [action_val.report_name] + args: [action.report_name], }).then(function (print_action) { if (print_action && print_action.action === 'server') { - framework.unblockUI(); - rpc.query({ + self._rpc({ model: 'ir.actions.report', method: 'print_document', - args: [action_val.id, action_val.context.active_ids], - kwargs: {data: action_val.data || {}}, - context: action_val.context || {} + args: [action.id, action.context.active_ids], + kwargs: {data: action.data || {}}, + context: action.context || {}, }).then(function () { self.do_notify(_t('Report'), - _.str.sprintf(_t('Document sent to the printer %s'), print_action.printer_name)); + _.str.sprintf( + _t('Document sent to the printer %s'), + print_action.printer_name + ) + ); }).fail(function () { self.do_notify(_t('Report'), - _.str.sprintf(_t('Error when sending the document to the printer '), print_action.printer_name)); - - }); - } else { - return _super.apply(self, [action_val, options]); - } - }); + _.str.sprintf( + _t('Error when sending the document to the printer '), + print_action.printer_name + ) + ); + }); + } else { + return _super.apply(self, [action, options, type]); + } + }); } else { - return _super.apply(self, [action_val, options]); + return _super.apply(self, [action, options, type]); } - } + }, }); }); + diff --git a/base_report_to_printer/tests/__init__.py b/base_report_to_printer/tests/__init__.py index 0f52428..fb3073e 100644 --- a/base_report_to_printer/tests/__init__.py +++ b/base_report_to_printer/tests/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/base_report_to_printer/tests/test_printing_job.py b/base_report_to_printer/tests/test_printing_job.py index 612c038..438dfff 100644 --- a/base_report_to_printer/tests/test_printing_job.py +++ b/base_report_to_printer/tests/test_printing_job.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/base_report_to_printer/tests/test_printing_printer.py b/base_report_to_printer/tests/test_printing_printer.py index 84c437c..18656f2 100644 --- a/base_report_to_printer/tests/test_printing_printer.py +++ b/base_report_to_printer/tests/test_printing_printer.py @@ -30,6 +30,7 @@ class TestPrintingPrinter(TransactionCase): 'location': 'Location', 'uri': 'URI', } + self.report = self.env['ir.actions.report'].search([], limit=1) def new_record(self): return self.Model.create(self.printer_vals) @@ -66,7 +67,6 @@ class TestPrintingPrinter(TransactionCase): def test_print_options(self): """ It should generate the right options dictionnary """ - 'copies': '2', # TODO: None here used as report - tests here should be merged # with tests in test_printing_printer_tray from when modules merged report = self.env['ir.actions.report'].search([], limit=1) diff --git a/base_report_to_printer/tests/test_printing_printer_tray.py b/base_report_to_printer/tests/test_printing_printer_tray.py index 1be8da6..57afe07 100644 --- a/base_report_to_printer/tests/test_printing_printer_tray.py +++ b/base_report_to_printer/tests/test_printing_printer_tray.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -165,7 +164,6 @@ class TestPrintingPrinter(TransactionCase): self, os_unlink, cups): """ When a ENOENT error is encountered, the file has already been unlinked - This is not an issue, as we were trying to delete the file. The update can continue. """ diff --git a/base_report_to_printer/tests/test_printing_printer_wizard.py b/base_report_to_printer/tests/test_printing_printer_wizard.py index 45c4054..34207d2 100644 --- a/base_report_to_printer/tests/test_printing_printer_wizard.py +++ b/base_report_to_printer/tests/test_printing_printer_wizard.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -26,6 +25,7 @@ class TestPrintingPrinterWizard(TransactionCase): 'printer-make-and-model': 'Make and Model', 'printer-location': "location", 'device-uri': 'URI', + 'printer-uri-supported': 'uri' } def _record_vals(self, sys_name='sys_name'): @@ -52,6 +52,7 @@ class TestPrintingPrinterWizard(TransactionCase): cups.Connection().getPrinters.return_value = { 'sys_name': self.printer_vals, } + cups.Connection().getPPD3.return_value = (200, 0, '') self.Model.action_ok() cups.Connection().getPrinters.assert_called_once_with() @@ -68,6 +69,7 @@ class TestPrintingPrinterWizard(TransactionCase): cups.Connection().getPrinters.return_value = { 'sys_name': self.printer_vals, } + cups.Connection().getPPD3.return_value = (200, 0, '') self.Model.action_ok() rec_id = self.env['printing.printer'].search([ ('system_name', '=', 'sys_name') @@ -89,6 +91,7 @@ class TestPrintingPrinterWizard(TransactionCase): cups.Connection().getPrinters.return_value = { 'sys_name': self.printer_vals, } + cups.Connection().getPPD3.return_value = (200, 0, '') self.env['printing.printer'].create( self._record_vals() ) diff --git a/base_report_to_printer/tests/test_printing_report_xml_action.py b/base_report_to_printer/tests/test_printing_report_xml_action.py index ce81f1f..79370ea 100644 --- a/base_report_to_printer/tests/test_printing_report_xml_action.py +++ b/base_report_to_printer/tests/test_printing_report_xml_action.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 SYLEAM # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -47,12 +46,14 @@ class TestPrintingReportXmlAction(TransactionCase): self.assertEqual(xml_action.behaviour(), { 'action': xml_action.action, 'printer': xml_action.printer_id, + 'tray': False, }) xml_action = self.new_record({'printer_id': self.new_printer().id}) self.assertEqual(xml_action.behaviour(), { 'action': xml_action.action, 'printer': xml_action.printer_id, + 'tray': False, }) self.assertEqual(self.Model.behaviour(), {}) diff --git a/base_report_to_printer/tests/test_printing_server.py b/base_report_to_printer/tests/test_printing_server.py index 1bb8489..ee812f5 100644 --- a/base_report_to_printer/tests/test_printing_server.py +++ b/base_report_to_printer/tests/test_printing_server.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/base_report_to_printer/tests/test_printing_tray.py b/base_report_to_printer/tests/test_printing_tray.py index ca82837..d9bc5be 100644 --- a/base_report_to_printer/tests/test_printing_tray.py +++ b/base_report_to_printer/tests/test_printing_tray.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/base_report_to_printer/tests/test_report.py b/base_report_to_printer/tests/test_report.py index f7ea6b3..ed7313f 100644 --- a/base_report_to_printer/tests/test_report.py +++ b/base_report_to_printer/tests/test_report.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 LasLabs Inc. # Copyright 2017 Tecnativa - Jairo Llopis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/base_report_to_printer/tests/test_res_users.py b/base_report_to_printer/tests/test_res_users.py index 39b4de0..1a1525e 100644 --- a/base_report_to_printer/tests/test_res_users.py +++ b/base_report_to_printer/tests/test_res_users.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/base_report_to_printer/views/ir_actions_report.xml b/base_report_to_printer/views/ir_actions_report.xml index 91b4956..3ab8ffa 100644 --- a/base_report_to_printer/views/ir_actions_report.xml +++ b/base_report_to_printer/views/ir_actions_report.xml @@ -1,24 +1,24 @@ - - ir.actions.report.printing - ir.actions.report - - - - - - - - - + + ir.actions.report.form (in base_report_to_printer) + ir.actions.report + + + + + + + + + - - - - - - + + + + + + diff --git a/base_report_to_printer/views/printing_job.xml b/base_report_to_printer/views/printing_job.xml index 1df1053..1620c79 100644 --- a/base_report_to_printer/views/printing_job.xml +++ b/base_report_to_printer/views/printing_job.xml @@ -2,7 +2,7 @@ - printing.job.form + printing.job.form (in base_report_to_printer) printing.job
@@ -30,7 +30,7 @@ - printing.job.tree + printing.job.tree (in base_report_to_printer) printing.job diff --git a/base_report_to_printer/views/printing_printer.xml b/base_report_to_printer/views/printing_printer.xml index 506f169..c036cf8 100644 --- a/base_report_to_printer/views/printing_printer.xml +++ b/base_report_to_printer/views/printing_printer.xml @@ -8,7 +8,7 @@ /> - printing.printer.form + printing.printer.form (in base_report_to_printer) printing.printer @@ -58,7 +58,7 @@ - printing.printer.tree + printing.printer.tree (in base_report_to_printer) printing.printer @@ -71,7 +71,7 @@ - printing.printer.search + printing.printer.search (in base_report_to_printer) printing.printer diff --git a/base_report_to_printer/views/printing_report.xml b/base_report_to_printer/views/printing_report.xml index 5d5f62f..4338fee 100644 --- a/base_report_to_printer/views/printing_report.xml +++ b/base_report_to_printer/views/printing_report.xml @@ -2,7 +2,7 @@ - printing.report.xml.action.form + printing.report.xml.action.form (in base_report_to_printer) printing.report.xml.action @@ -17,7 +17,7 @@ - printing.report.xml.action.tree + printing.report.xml.action.tree (in base_report_to_printer) printing.report.xml.action diff --git a/base_report_to_printer/views/printing_server.xml b/base_report_to_printer/views/printing_server.xml index 7431b86..4c04816 100644 --- a/base_report_to_printer/views/printing_server.xml +++ b/base_report_to_printer/views/printing_server.xml @@ -2,7 +2,7 @@ - printing.server.form + printing.server.form (in base_report_to_printer) printing.server @@ -30,7 +30,7 @@ - printing.server.tree + printing.server.tree (in base_report_to_printer) printing.server @@ -42,7 +42,7 @@ - printing.server.search + printing.server.search (in base_report_to_printer) printing.server diff --git a/base_report_to_printer/views/res_users.xml b/base_report_to_printer/views/res_users.xml index a6792b7..926e666 100644 --- a/base_report_to_printer/views/res_users.xml +++ b/base_report_to_printer/views/res_users.xml @@ -1,32 +1,32 @@ - - res.users.form.printing.preferences - res.users - - - - - - - - - - + + res.users.form (in base_report_to_printer) + res.users + + + + + + + + + + - - res.users.form.printing - res.users - - -
- - - - -
-
-
+ + res.users.form.simple (in base_report_to_printer) + res.users + + +
+ + + + +
+
+
diff --git a/base_report_to_printer/wizards/__init__.py b/base_report_to_printer/wizards/__init__.py index 5a693f5..8958684 100644 --- a/base_report_to_printer/wizards/__init__.py +++ b/base_report_to_printer/wizards/__init__.py @@ -1,3 +1,2 @@ -# -*- coding: utf-8 -*- from . import printing_printer_update_wizard diff --git a/base_report_to_printer/wizards/printing_printer_update_wizard.py b/base_report_to_printer/wizards/printing_printer_update_wizard.py index f3c384d..8b0c141 100644 --- a/base_report_to_printer/wizards/printing_printer_update_wizard.py +++ b/base_report_to_printer/wizards/printing_printer_update_wizard.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (c) 2009 Albert Cervera i Areny # Copyright (C) 2011 Agile Business Group sagl () # Copyright (C) 2011 Domsense srl () diff --git a/base_report_to_printer/wizards/printing_printer_update_wizard_view.xml b/base_report_to_printer/wizards/printing_printer_update_wizard_view.xml index ffcf138..6b8b31a 100644 --- a/base_report_to_printer/wizards/printing_printer_update_wizard_view.xml +++ b/base_report_to_printer/wizards/printing_printer_update_wizard_view.xml @@ -5,7 +5,7 @@ printing.printer.update.wizard -