From 56a5655680ec4254406bc9d6adceba156414a255 Mon Sep 17 00:00:00 2001 From: Andrew Schrafel Date: Thu, 14 Mar 2013 22:30:25 -0400 Subject: [PATCH] base_report_to_printer V7 upgrade --- base_report_to_printer/__openerp__.py | 49 +++------- base_report_to_printer/printing.py | 8 +- base_report_to_printer/printing_data.xml | 0 base_report_to_printer/printing_view.xml | 92 +++++++++---------- base_report_to_printer/security/security.xml | 8 +- .../wizard/update_printers.py | 0 .../wizard/update_printers.xml | 2 +- 7 files changed, 68 insertions(+), 91 deletions(-) mode change 100755 => 100644 base_report_to_printer/printing.py mode change 100755 => 100644 base_report_to_printer/printing_data.xml mode change 100755 => 100644 base_report_to_printer/printing_view.xml mode change 100755 => 100644 base_report_to_printer/security/security.xml mode change 100755 => 100644 base_report_to_printer/wizard/update_printers.py diff --git a/base_report_to_printer/__openerp__.py b/base_report_to_printer/__openerp__.py index dc2af49..03b6ffb 100644 --- a/base_report_to_printer/__openerp__.py +++ b/base_report_to_printer/__openerp__.py @@ -25,45 +25,26 @@ 'name': "Report to printer", 'version': '0.1', 'category': 'Generic Modules/Base', - 'description': """ -Extracted from printjob ( http://apps.openerp.com/addon/1727 ), this module allows to send reports to a printer attached to the server. Settings can be configured globaly, per user, per report and per user and report. - -Configuration -============= - -.. image:: http://planet.domsense.com/wp-content/uploads/2011/09/printing-menu.png - :width: 400 px - -First of all, you have to load CUPS printers in OpenERP. You can use a wizard that retrieves them automatically. You just have to click on Update Printers from CUPS and printers will appear within the available printers list. - -In the next step you will configure the reports to send to the printers. - -.. image:: http://planet.domsense.com/wp-content/uploads/2011/09/reports.png - :width: 400 px - -Through the report form you can define the system’s behaviour while producing the report. - -.. image:: http://planet.domsense.com/wp-content/uploads/2011/09/report-configuration.png - :width: 400 px - -You can set a global behaviour, or differentiate it according to the user who’s printing. In the example, the global behaviour defines to send the report to client directly (Send to Client), therefore without sending it to the printer. But if user elbati is printing, the report will be sent to the selected printer (Send to Printer). - -You can also define a default behaviour associated to the user, in order to establish whether a certain user, when not differently set, wants to send the reports always to a specific printer or not. - -After finishing the configuration, you will just have to click on printing button associated to the report (or launch the report by a wizard or whatever) and the system will automatically send the report to the previously set printer -""", - 'author': ['Agile Business Group', 'Pegueroles SCP', 'NaN'], + 'description': """This module allows users to send reports to a printer attached to the server. Settings can be configured globaly, per user, per report and per user and report. + Before you can use this module: + You must have lpr installed for this module to work as-is. + To install lpr on ubuntu enter this command at the CLI - sudo apt-get install cups-bsd + type ls | lpr at the command prompt to confirm your server can print + + After installing enable the "Printing / Print Operator" option under access rights to give users the ability to view the print menu. + Then goto the user profile and set the users printing action and default printer. + """, + 'author': 'Agile Business Group & Domsense, Pegueroles SCP, NaN', 'website': 'http://www.agilebg.com', 'license': 'AGPL-3', "depends" : ['base', 'base_calendar'], - "init_xml" : [], - "update_xml" : [ + 'data': [ 'printing_data.xml', 'printing_view.xml', 'wizard/update_printers.xml', 'security/security.xml', - ], - "demo_xml" : [], - "active": False, - "installable": False + ], + 'installable': True, + 'auto_install': False, + 'application': True, } diff --git a/base_report_to_printer/printing.py b/base_report_to_printer/printing.py old mode 100755 new mode 100644 index 10c2b33..a4a9710 --- a/base_report_to_printer/printing.py +++ b/base_report_to_printer/printing.py @@ -246,9 +246,11 @@ class report_xml(osv.osv): printer_system_name = printer.system_name if format == 'raw': # -l is the same as -o raw - cmd = "lpr -l -P %s %s" % (printer_system_name,file_name) + cmd = "lpr -l -P %s %s" % (printer_system_name,file_name) + #cmd = "lp -d %s %s" % (printer_system_name,file_name) else: - cmd = "lpr -P %s %s" % (printer_system_name,file_name) + cmd = "lpr -P %s %s" % (printer_system_name,file_name) + #cmd = "lp -d %s %s" % (printer_system_name,file_name) logger = logging.getLogger('base_report_to_printer') logger.info("Printing job : '%s'" % cmd) os.system(cmd) @@ -365,6 +367,8 @@ class virtual_report_spool(base_calendar.virtual_report_spool): and self._reports[report_id].get('format', False)): report_obj.print_direct(cr, uid, base64.encodestring(self._reports[report_id]['result']), self._reports[report_id]['format'], printer) + raise osv.except_osv(_('Printing...'), _('Document sent to printer %s') % (printer,)) + except: cr.rollback() raise diff --git a/base_report_to_printer/printing_data.xml b/base_report_to_printer/printing_data.xml old mode 100755 new mode 100644 diff --git a/base_report_to_printer/printing_view.xml b/base_report_to_printer/printing_view.xml old mode 100755 new mode 100644 index 6735d41..1cc8348 --- a/base_report_to_printer/printing_view.xml +++ b/base_report_to_printer/printing_view.xml @@ -2,57 +2,55 @@ - - - - - - printing.printer.form - printing.printer - form - -
- - - - -