mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[MRG] from 6.1 main branch
This commit is contained in:
4
base_report_to_printer/AUTHORS.txt
Normal file
4
base_report_to_printer/AUTHORS.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
Ferran Pegueroles <ferran@pegueroles.com>
|
||||
Albert Cervera i Areny <albert@nan-tic.com>
|
||||
Davide Corio <davide.corio@agilebg.com>
|
||||
Lorenzo Battistini <lorenzo.battistini@agilebg.com>
|
||||
25
base_report_to_printer/__init__.py
Normal file
25
base_report_to_printer/__init__.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2007 Ferran Pegueroles <ferran@pegueroles.com>
|
||||
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com>
|
||||
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
|
||||
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
|
||||
# All Rights Reserved
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import printing
|
||||
import wizard
|
||||
45
base_report_to_printer/__openerp__.py
Normal file
45
base_report_to_printer/__openerp__.py
Normal file
@@ -0,0 +1,45 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2007 Ferran Pegueroles <ferran@pegueroles.com>
|
||||
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com>
|
||||
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
|
||||
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
|
||||
# All Rights Reserved
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
{
|
||||
'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.
|
||||
|
||||
For more info: http://planet.domsense.com/en/2011/10/linking-openerp-to-cups-printers-base_report_to_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" : [
|
||||
'printing_data.xml',
|
||||
'printing_view.xml',
|
||||
'wizard/update_printers.xml',
|
||||
'security/security.xml',
|
||||
],
|
||||
"demo_xml" : [],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}
|
||||
246
base_report_to_printer/i18n/base_report_to_printer.pot
Normal file
246
base_report_to_printer/i18n/base_report_to_printer.pot
Normal file
@@ -0,0 +1,246 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * base_report_to_printer
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 6.0.3\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2011-09-26 09:06+0000\n"
|
||||
"PO-Revision-Date: 2011-09-26 09:06+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: sql_constraint:res.users:0
|
||||
msgid "You can not have two users with the same login !"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: selection:printing.printer,status:0
|
||||
msgid "Unavailable"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: view:printing.printer.update.wizard:0
|
||||
msgid "This process will create all missing printers from the current CUPS server."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: selection:printing.printer,status:0
|
||||
msgid "Unknown"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,status:0
|
||||
msgid "Status"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,system_name:0
|
||||
msgid "System Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: constraint:res.users:0
|
||||
msgid "The chosen company is not in the allowed companies for this user"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,location:0
|
||||
msgid "Location"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.actions.act_window,name:base_report_to_printer.action_printing_printer_form
|
||||
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_printer_form
|
||||
#: view:printing.printer:0
|
||||
msgid "Printers"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:res.users,printing_action:0
|
||||
msgid "Printing Action"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.module.module,description:base_report_to_printer.module_meta_information
|
||||
msgid "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."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.action,type:0
|
||||
msgid "Type"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: selection:printing.printer,status:0
|
||||
msgid "Available"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:ir.actions.report.xml,printing_printer_id:0
|
||||
#: model:ir.model,name:base_report_to_printer.model_printing_printer
|
||||
#: field:printing.report.xml.action,printer_id:0
|
||||
msgid "Printer"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.model,name:base_report_to_printer.model_printing_report_xml_action
|
||||
#: view:printing.report.xml.action:0
|
||||
msgid "Report Printing Actions"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.model,name:base_report_to_printer.model_printing_action
|
||||
msgid "Print Job Action"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.report.xml.action,user_id:0
|
||||
msgid "User"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.report.xml.action,report_id:0
|
||||
msgid "Report"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_config
|
||||
msgid "Configuration"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.module.module,shortdesc:base_report_to_printer.module_meta_information
|
||||
msgid "Report to printer"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.model,name:base_report_to_printer.model_printjob_printer_update_wizard
|
||||
msgid "printjob.printer.update.wizard"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: view:printing.printer.update.wizard:0
|
||||
msgid "Ok"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.action,name:0
|
||||
#: field:printing.printer,name:0
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: view:printing.printer:0
|
||||
msgid "Set Default"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,default:0
|
||||
#: field:res.users,printing_printer_id:0
|
||||
msgid "Default Printer"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: code:addons/base_report_to_printer/printing.py:189
|
||||
#, python-format
|
||||
msgid "Send to Client"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,uri:0
|
||||
msgid "URI"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.model,name:base_report_to_printer.model_printing_printer_update_wizard
|
||||
msgid "printing.printer.update.wizard"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.actions.act_window,name:base_report_to_printer.action_printer_update_wizard
|
||||
#: model:ir.ui.menu,name:base_report_to_printer.menu_printer_update_wizard
|
||||
#: view:printing.printer.update.wizard:0
|
||||
msgid "Update Printers from CUPS"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: code:addons/base_report_to_printer/printing.py:188
|
||||
#, python-format
|
||||
msgid "Send to Printer"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_main
|
||||
#: selection:printing.printer,status:0
|
||||
msgid "Printing"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: selection:printing.printer,status:0
|
||||
msgid "Error"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:ir.actions.report.xml,property_printing_action:0
|
||||
#: field:printing.report.xml.action,action:0
|
||||
msgid "Action"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,model:0
|
||||
msgid "Model"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,status_message:0
|
||||
msgid "Status Message"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: help:ir.actions.report.xml,printing_action_ids:0
|
||||
msgid "This field allows configuring action and printer on a per user basis"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: selection:printing.printer,status:0
|
||||
msgid "Server Error"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:ir.actions.report.xml,printing_action_ids:0
|
||||
msgid "Actions"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: view:printing.job:0
|
||||
msgid "Print Jobs"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: view:printing.printer.update.wizard:0
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.model,name:base_report_to_printer.model_res_users
|
||||
msgid "res.users"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: code:addons/base_report_to_printer/printing.py:190
|
||||
#, python-format
|
||||
msgid "Use user's defaults"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.model,name:base_report_to_printer.model_ir_actions_report_xml
|
||||
msgid "ir.actions.report.xml"
|
||||
msgstr ""
|
||||
|
||||
246
base_report_to_printer/i18n/it.po
Normal file
246
base_report_to_printer/i18n/it.po
Normal file
@@ -0,0 +1,246 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * base_report_to_printer
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 6.0.3\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2011-09-26 09:06+0000\n"
|
||||
"PO-Revision-Date: 2011-09-26 11:14+0100\n"
|
||||
"Last-Translator: Lorenzo Battistini <lorenzo.battistini@agilebg.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: sql_constraint:res.users:0
|
||||
msgid "You can not have two users with the same login !"
|
||||
msgstr "Non è possibile inserire due utenti con lo stesso nome di login!"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: selection:printing.printer,status:0
|
||||
msgid "Unavailable"
|
||||
msgstr "Non disponibile"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: view:printing.printer.update.wizard:0
|
||||
msgid "This process will create all missing printers from the current CUPS server."
|
||||
msgstr "Questo processo creerà tutte le stampante mancanti dal server CUPS corrente"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: selection:printing.printer,status:0
|
||||
msgid "Unknown"
|
||||
msgstr "Sconosciuto"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,status:0
|
||||
msgid "Status"
|
||||
msgstr "Stato"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,system_name:0
|
||||
msgid "System Name"
|
||||
msgstr "Nome di sistema"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: constraint:res.users:0
|
||||
msgid "The chosen company is not in the allowed companies for this user"
|
||||
msgstr "L'azienda selezionata non è tra quelle a cui è permesso l'accesso a questo utente"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,location:0
|
||||
msgid "Location"
|
||||
msgstr "Locazione"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.actions.act_window,name:base_report_to_printer.action_printing_printer_form
|
||||
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_printer_form
|
||||
#: view:printing.printer:0
|
||||
msgid "Printers"
|
||||
msgstr "Stampanti"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:res.users,printing_action:0
|
||||
msgid "Printing Action"
|
||||
msgstr "Azione di stampa"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.module.module,description:base_report_to_printer.module_meta_information
|
||||
msgid "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."
|
||||
msgstr "Estratto da printjob ( http://apps.openerp.com/addon/1727 ), questo modulo permetto di inviare i report alle stampanti collegate al server. Le impostazioni possono essere configurate globalmente, per utente, per report e per utente e report."
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.action,type:0
|
||||
msgid "Type"
|
||||
msgstr "Tipo"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: selection:printing.printer,status:0
|
||||
msgid "Available"
|
||||
msgstr "Disponibile"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:ir.actions.report.xml,printing_printer_id:0
|
||||
#: model:ir.model,name:base_report_to_printer.model_printing_printer
|
||||
#: field:printing.report.xml.action,printer_id:0
|
||||
msgid "Printer"
|
||||
msgstr "Stampante"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.model,name:base_report_to_printer.model_printing_report_xml_action
|
||||
#: view:printing.report.xml.action:0
|
||||
msgid "Report Printing Actions"
|
||||
msgstr "Azioni di stampa report"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.model,name:base_report_to_printer.model_printing_action
|
||||
msgid "Print Job Action"
|
||||
msgstr "Azione di stampa"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.report.xml.action,user_id:0
|
||||
msgid "User"
|
||||
msgstr "Utente"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.report.xml.action,report_id:0
|
||||
msgid "Report"
|
||||
msgstr "Report"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_config
|
||||
msgid "Configuration"
|
||||
msgstr "Configurazione"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.module.module,shortdesc:base_report_to_printer.module_meta_information
|
||||
msgid "Report to printer"
|
||||
msgstr "Report alla stampante"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.model,name:base_report_to_printer.model_printjob_printer_update_wizard
|
||||
msgid "printjob.printer.update.wizard"
|
||||
msgstr "printjob.printer.update.wizard"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: view:printing.printer.update.wizard:0
|
||||
msgid "Ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.action,name:0
|
||||
#: field:printing.printer,name:0
|
||||
msgid "Name"
|
||||
msgstr "Nome"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: view:printing.printer:0
|
||||
msgid "Set Default"
|
||||
msgstr "Imposta default"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,default:0
|
||||
#: field:res.users,printing_printer_id:0
|
||||
msgid "Default Printer"
|
||||
msgstr "Stampante di default"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: code:addons/base_report_to_printer/printing.py:189
|
||||
#, python-format
|
||||
msgid "Send to Client"
|
||||
msgstr "Invia al client"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,uri:0
|
||||
msgid "URI"
|
||||
msgstr "URI"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.model,name:base_report_to_printer.model_printing_printer_update_wizard
|
||||
msgid "printing.printer.update.wizard"
|
||||
msgstr "printing.printer.update.wizard"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.actions.act_window,name:base_report_to_printer.action_printer_update_wizard
|
||||
#: model:ir.ui.menu,name:base_report_to_printer.menu_printer_update_wizard
|
||||
#: view:printing.printer.update.wizard:0
|
||||
msgid "Update Printers from CUPS"
|
||||
msgstr "Aggiorna stampanti da CUPS"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: code:addons/base_report_to_printer/printing.py:188
|
||||
#, python-format
|
||||
msgid "Send to Printer"
|
||||
msgstr "Invia alla stampante"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_main
|
||||
#: selection:printing.printer,status:0
|
||||
msgid "Printing"
|
||||
msgstr "Stampa"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: selection:printing.printer,status:0
|
||||
msgid "Error"
|
||||
msgstr "Errore"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:ir.actions.report.xml,property_printing_action:0
|
||||
#: field:printing.report.xml.action,action:0
|
||||
msgid "Action"
|
||||
msgstr "Azione"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,model:0
|
||||
msgid "Model"
|
||||
msgstr "Model"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:printing.printer,status_message:0
|
||||
msgid "Status Message"
|
||||
msgstr "Messaggio di stato"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: help:ir.actions.report.xml,printing_action_ids:0
|
||||
msgid "This field allows configuring action and printer on a per user basis"
|
||||
msgstr "Questo campo permette di configurare azioni e stampanti sulla base degli utenti"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: selection:printing.printer,status:0
|
||||
msgid "Server Error"
|
||||
msgstr "Errore server"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: field:ir.actions.report.xml,printing_action_ids:0
|
||||
msgid "Actions"
|
||||
msgstr "Azioni"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: view:printing.job:0
|
||||
msgid "Print Jobs"
|
||||
msgstr "Stampe"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: view:printing.printer.update.wizard:0
|
||||
msgid "Cancel"
|
||||
msgstr "Annulla"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.model,name:base_report_to_printer.model_res_users
|
||||
msgid "res.users"
|
||||
msgstr "res.users"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: code:addons/base_report_to_printer/printing.py:190
|
||||
#, python-format
|
||||
msgid "Use user's defaults"
|
||||
msgstr "Utilizza i default dell'utente"
|
||||
|
||||
#. module: base_report_to_printer
|
||||
#: model:ir.model,name:base_report_to_printer.model_ir_actions_report_xml
|
||||
msgid "ir.actions.report.xml"
|
||||
msgstr "ir.actions.report.xml"
|
||||
|
||||
379
base_report_to_printer/printing.py
Executable file
379
base_report_to_printer/printing.py
Executable file
@@ -0,0 +1,379 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2007 Ferran Pegueroles <ferran@pegueroles.com>
|
||||
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com>
|
||||
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
|
||||
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
|
||||
# All Rights Reserved
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import os
|
||||
import base64
|
||||
import threading
|
||||
from tempfile import mkstemp
|
||||
|
||||
import cups
|
||||
import thread
|
||||
from threading import Thread
|
||||
from threading import Lock
|
||||
|
||||
import netsvc
|
||||
import tools
|
||||
import time
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
import pooler
|
||||
import tools
|
||||
from tools.translate import _
|
||||
from base_calendar import base_calendar
|
||||
import logging
|
||||
|
||||
|
||||
#
|
||||
# Printers
|
||||
#
|
||||
class printing_printer(osv.osv):
|
||||
_name = "printing.printer"
|
||||
_description = "Printer"
|
||||
|
||||
_columns = {
|
||||
'name' : fields.char('Name',size=64,required=True,select="1"),
|
||||
'system_name': fields.char('System Name',size=64,required=True,select="1"),
|
||||
'default':fields.boolean('Default Printer',required=True,readonly=True),
|
||||
'status': fields.selection([('unavailable','Unavailable'),('printing','Printing'),('unknown','Unknown'),('available','Available'),('error','Error'),('server-error','Server Error')], 'Status', required=True, readonly=True),
|
||||
'status_message': fields.char('Status Message', size=500, readonly=True),
|
||||
'model': fields.char('Model', size=500, readonly=True),
|
||||
'location': fields.char('Location', size=500, readonly=True),
|
||||
'uri': fields.char('URI', size=500, readonly=True),
|
||||
}
|
||||
_order = "name"
|
||||
|
||||
_defaults = {
|
||||
'default': lambda *a: False,
|
||||
'status': lambda *a: 'unknown',
|
||||
}
|
||||
|
||||
def __init__(self, pool, cr):
|
||||
super(printing_printer, self).__init__(pool, cr)
|
||||
self.lock = Lock()
|
||||
self.last_update = None
|
||||
self.updating = False
|
||||
|
||||
def update_printers_status(self, db_name, uid, context):
|
||||
db, pool = pooler.get_db_and_pool(db_name)
|
||||
cr = db.cursor()
|
||||
|
||||
try:
|
||||
connection = cups.Connection()
|
||||
printers = connection.getPrinters()
|
||||
server_error = False
|
||||
except:
|
||||
server_error = True
|
||||
|
||||
mapping = {
|
||||
3 : 'available',
|
||||
4 : 'printing',
|
||||
5 : 'error'
|
||||
}
|
||||
|
||||
try:
|
||||
# Skip update to avoid the thread being created again
|
||||
ctx = context.copy()
|
||||
ctx['skip_update'] = True
|
||||
ids = self.pool.get('printing.printer').search(cr, uid, [], context=ctx)
|
||||
for printer in self.pool.get('printing.printer').browse(cr, uid, ids, context=ctx):
|
||||
vals = {}
|
||||
if server_error:
|
||||
status = 'server-error'
|
||||
elif printer.system_name in printers:
|
||||
info = printers[printer.system_name]
|
||||
status = mapping.get( info['printer-state'], 'unknown' )
|
||||
vals = {
|
||||
'model': info.get('printer-make-and-model', False),
|
||||
'location': info.get('printer-location', False),
|
||||
'uri': info.get('device-uri', False),
|
||||
}
|
||||
else:
|
||||
status = 'unavailable'
|
||||
|
||||
vals['status'] = status
|
||||
self.pool.get('printing.printer').write(cr, uid, [printer.id], vals, context)
|
||||
cr.commit()
|
||||
except:
|
||||
cr.rollback()
|
||||
raise
|
||||
finally:
|
||||
cr.close()
|
||||
with self.lock:
|
||||
self.updating = False
|
||||
self.last_update = time.time()
|
||||
|
||||
|
||||
def start_printer_update(self, cr, uid, context):
|
||||
self.lock.acquire()
|
||||
if self.updating:
|
||||
self.lock.release()
|
||||
return
|
||||
self.updating = True
|
||||
self.lock.release()
|
||||
thread = Thread(target=self.update_printers_status, args=(cr.dbname, uid, context.copy()))
|
||||
thread.start()
|
||||
|
||||
def update(self, cr, uid, context=None):
|
||||
if not context or context.get('skip_update'):
|
||||
return
|
||||
self.lock.acquire()
|
||||
last_update = self.last_update
|
||||
updating = self.updating
|
||||
self.lock.release()
|
||||
now = time.time()
|
||||
# Only update printer status if current status is more than 10 seconds old.
|
||||
if not last_update or now - last_update > 10:
|
||||
self.start_printer_update(cr, uid, context)
|
||||
# Wait up to five seconds for printer status update
|
||||
for x in range(0,5):
|
||||
time.sleep(1)
|
||||
self.lock.acquire()
|
||||
updating = self.updating
|
||||
self.lock.release()
|
||||
if not updating:
|
||||
break
|
||||
return True
|
||||
|
||||
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
|
||||
self.update(cr, uid, context)
|
||||
return super(printing_printer,self).search(cr, uid, args, offset, limit, order, context, count)
|
||||
|
||||
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
|
||||
self.update(cr, uid, context)
|
||||
return super(printing_printer,self).read(cr, uid, ids, fields, context, load)
|
||||
|
||||
def browse(self, cr, uid, ids, context=None):
|
||||
self.update(cr, uid, context)
|
||||
return super(printing_printer,self).browse(cr, uid, ids, context)
|
||||
|
||||
def set_default(self, cr, uid, ids, context):
|
||||
if not ids:
|
||||
return
|
||||
default_ids= self.search(cr, uid,[('default','=',True)])
|
||||
self.write(cr, uid, default_ids, {'default':False}, context)
|
||||
self.write(cr, uid, ids[0], {'default':True}, context)
|
||||
return True
|
||||
|
||||
def get_default(self,cr,uid,context):
|
||||
printer_ids = self.search(cr, uid,[('default','=',True)])
|
||||
if printer_ids:
|
||||
return printer_ids[0]
|
||||
return False
|
||||
|
||||
printing_printer()
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Actions
|
||||
#
|
||||
|
||||
def _available_action_types(self, cr, uid, context=None):
|
||||
return [
|
||||
('server',_('Send to Printer')),
|
||||
('client',_('Send to Client')),
|
||||
('user_default',_("Use user's defaults")),
|
||||
]
|
||||
|
||||
class printing_action(osv.osv):
|
||||
_name = 'printing.action'
|
||||
_description = 'Print Job Action'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=256, required=True),
|
||||
'type': fields.selection(_available_action_types, 'Type', required=True),
|
||||
}
|
||||
printing_action()
|
||||
|
||||
#
|
||||
# Users
|
||||
#
|
||||
|
||||
class res_users(osv.osv):
|
||||
_name = "res.users"
|
||||
_inherit = "res.users"
|
||||
|
||||
def _user_available_action_types(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context={}
|
||||
return [x for x in _available_action_types(self, cr, uid, context) if x[0] != 'user_default']
|
||||
|
||||
_columns = {
|
||||
'printing_action': fields.selection(_user_available_action_types, 'Printing Action'),
|
||||
'printing_printer_id': fields.many2one('printing.printer', 'Default Printer'),
|
||||
}
|
||||
|
||||
res_users()
|
||||
|
||||
#
|
||||
# Reports
|
||||
#
|
||||
|
||||
class report_xml(osv.osv):
|
||||
|
||||
def print_direct(self, cr, uid, result, format, printer):
|
||||
fd, file_name = mkstemp()
|
||||
try:
|
||||
os.write(fd, base64.decodestring(result))
|
||||
finally:
|
||||
os.close(fd)
|
||||
printer_system_name = ''
|
||||
if printer:
|
||||
if isinstance(printer, (basestring)):
|
||||
printer_system_name = printer
|
||||
else:
|
||||
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)
|
||||
else:
|
||||
cmd = "lpr -P %s %s" % (printer_system_name,file_name)
|
||||
logger = logging.getLogger('base_report_to_printer')
|
||||
logger.info("Printing job : '%s'" % cmd)
|
||||
os.system(cmd)
|
||||
return True
|
||||
|
||||
_inherit = 'ir.actions.report.xml'
|
||||
_columns = {
|
||||
'property_printing_action': fields.property(
|
||||
#'ir.actions.report.xml',
|
||||
'printing.action',
|
||||
type='many2one',
|
||||
relation='printing.action',
|
||||
string='Action',
|
||||
view_load=True,
|
||||
method=True,
|
||||
),
|
||||
'printing_printer_id': fields.many2one('printing.printer', 'Printer'),
|
||||
'printing_action_ids': fields.one2many('printing.report.xml.action', 'report_id', 'Actions', help='This field allows configuring action and printer on a per user basis'),
|
||||
}
|
||||
|
||||
def behaviour(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context={}
|
||||
result = {}
|
||||
|
||||
# Set hardcoded default action
|
||||
default_action = 'client'
|
||||
# Retrieve system wide printer
|
||||
default_printer = self.pool.get('printing.printer').get_default(cr,uid,context)
|
||||
if default_printer:
|
||||
default_printer = self.pool.get('printing.printer').browse(cr,uid,default_printer,context).system_name
|
||||
|
||||
|
||||
# Retrieve user default values
|
||||
user = self.pool.get('res.users').browse(cr, uid, context)
|
||||
if user.printing_action:
|
||||
default_action = user.printing_action
|
||||
if user.printing_printer_id:
|
||||
default_printer = user.printing_printer_id.system_name
|
||||
|
||||
for report in self.browse(cr, uid, ids, context):
|
||||
action = default_action
|
||||
printer = default_printer
|
||||
|
||||
# Retrieve report default values
|
||||
if report.property_printing_action and report.property_printing_action.type != 'user_default':
|
||||
action = report.property_printing_action.type
|
||||
if report.printing_printer_id:
|
||||
printer = report.printing_printer_id
|
||||
|
||||
# Retrieve report-user specific values
|
||||
user_action = self.pool.get('printing.report.xml.action').behaviour(cr, uid, report.id, context)
|
||||
if user_action and user_action['action'] != 'user_default':
|
||||
action = user_action['action']
|
||||
if user_action['printer']:
|
||||
printer = user_action['printer']
|
||||
|
||||
result[report.id] = {
|
||||
'action': action,
|
||||
'printer': printer,
|
||||
}
|
||||
return result
|
||||
|
||||
|
||||
report_xml()
|
||||
|
||||
class report_xml_action(osv.osv):
|
||||
_name = 'printing.report.xml.action'
|
||||
_description = 'Report Printing Actions'
|
||||
_columns = {
|
||||
'report_id': fields.many2one('ir.actions.report.xml', 'Report', required=True, ondelete='cascade'),
|
||||
'user_id': fields.many2one('res.users', 'User', required=True, ondelete='cascade'),
|
||||
'action': fields.selection(_available_action_types, 'Action', required=True),
|
||||
'printer_id': fields.many2one('printing.printer', 'Printer'),
|
||||
}
|
||||
|
||||
def behaviour(self, cr, uid, report_id, context=None):
|
||||
if context is None:
|
||||
context={}
|
||||
result = {}
|
||||
ids = self.search(cr, uid, [('report_id','=',report_id),('user_id','=',uid)], context=context)
|
||||
if not ids:
|
||||
return False
|
||||
action = self.browse(cr, uid, ids[0], context)
|
||||
return {
|
||||
'action': action.action,
|
||||
'printer': action.printer_id.system_name,
|
||||
}
|
||||
report_xml_action()
|
||||
|
||||
class virtual_report_spool(base_calendar.virtual_report_spool):
|
||||
|
||||
def exp_report(self, db, uid, object, ids, datas=None, context=None):
|
||||
res = super(virtual_report_spool, self).exp_report(db, uid, object, ids, datas, context)
|
||||
self._reports[res]['report_name'] = object
|
||||
return res
|
||||
|
||||
def exp_report_get(self, db, uid, report_id):
|
||||
|
||||
cr = pooler.get_db(db).cursor()
|
||||
try:
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
# First of all load report defaults: name, action and printer
|
||||
report_obj = pool.get('ir.actions.report.xml')
|
||||
report = report_obj.search(cr,uid,[('report_name','=',self._reports[report_id]['report_name'])])
|
||||
if report:
|
||||
report = report_obj.browse(cr,uid,report[0])
|
||||
name = report.name
|
||||
data = report.behaviour()[report.id]
|
||||
action = data['action']
|
||||
printer = data['printer']
|
||||
if action != 'client':
|
||||
if (self._reports and self._reports.get(report_id, False) and self._reports[report_id].get('result', False)
|
||||
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)
|
||||
except:
|
||||
cr.rollback()
|
||||
raise
|
||||
finally:
|
||||
cr.close()
|
||||
|
||||
res = super(virtual_report_spool, self).exp_report_get(db, uid, report_id)
|
||||
return res
|
||||
|
||||
virtual_report_spool()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
20
base_report_to_printer/printing_data.xml
Executable file
20
base_report_to_printer/printing_data.xml
Executable file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- printing.action -->
|
||||
<record model="printing.action" id="printing_action_1">
|
||||
<field name="name">Send to Printer</field>
|
||||
<field name="type">server</field>
|
||||
</record>
|
||||
<record model="printing.action" id="printing_action_2">
|
||||
<field name="name">Send to Client</field>
|
||||
<field name="type">client</field>
|
||||
</record>
|
||||
<!-- properties -->
|
||||
<record forcecreate="True" id="property_printing_action" model="ir.property">
|
||||
<field name="name">property_printing_action</field>
|
||||
<field name="fields_id" search="[('model','=','ir.actions.report.xml'),('name','=','property_printing_action')]"/>
|
||||
<field name="value" eval="'printing.action,'+str(printing_action_2)"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
113
base_report_to_printer/printing_view.xml
Executable file
113
base_report_to_printer/printing_view.xml
Executable file
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<menuitem name="Printing" id="menu_printing_main" icon="STOCK_PRINT" parent="base.menu_custom"/>
|
||||
|
||||
<menuitem name="Configuration" id="menu_printing_config" parent="menu_printing_main" />
|
||||
|
||||
<record model="ir.ui.view" id="view_printing_printer_form">
|
||||
<field name="name">printing.printer.form</field>
|
||||
<field name="model">printing.printer</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Printers">
|
||||
<field name="name" select="1"/>
|
||||
<field name="system_name" select="1"/>
|
||||
<group col="3" colspan="2">
|
||||
<field name="default" select="1"/>
|
||||
<button name="set_default" string="Set Default" type="object"/>
|
||||
</group>
|
||||
<field name="uri" select="2"/>
|
||||
<field name="model" select="2"/>
|
||||
<field name="location" select="2"/>
|
||||
<field name="status" select="1"/>
|
||||
<field name="status_message" select="2"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_printing_printer_tree">
|
||||
<field name="name">printing.printer.tree</field>
|
||||
<field name="model">printing.printer</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Printers" colors="green:status=='available'; orange:status=='printing'; red:1;">
|
||||
<field name="default"/>
|
||||
<field name="name"/>
|
||||
<field name="system_name"/>
|
||||
<field name="status"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_printing_printer_form">
|
||||
<field name="name">Printers</field>
|
||||
<field name="res_model">printing.printer</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="auto_refresh">20</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Printers"
|
||||
id="menu_printing_printer_form"
|
||||
parent="menu_printing_config"
|
||||
icon="STOCK_PRINT"
|
||||
action="action_printing_printer_form"/>
|
||||
|
||||
<record model="ir.ui.view" id="action_report_xml_form">
|
||||
<field name="name">ir.actions.report.xml.printing</field>
|
||||
<field name="model">ir.actions.report.xml</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.act_report_xml_view" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="groups_id" position="before">
|
||||
<field name="property_printing_action"/>
|
||||
<field name="printing_printer_id"/>
|
||||
<field name="printing_action_ids" colspan="4"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- res.users -->
|
||||
<record model="ir.ui.view" id="view_printing_users_form">
|
||||
<field name="name">res.users.form.printing</field>
|
||||
<field name="type">form</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="context_tz" position="after">
|
||||
<field name="printing_action" />
|
||||
<field name="printing_printer_id" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- printing.report.xml.action -->
|
||||
<record model="ir.ui.view" id="printing_report_xml_action_form">
|
||||
<field name="name">printing.report.xml.action.form</field>
|
||||
<field name="model">printing.report.xml.action</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Report Printing Actions">
|
||||
<field name="user_id"/>
|
||||
<label string=""/>
|
||||
<field name="action"/>
|
||||
<field name="printer_id" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="printing_report_xml_action_tree">
|
||||
<field name="name">printing.report.xml.action.tree</field>
|
||||
<field name="model">printing.report.xml.action</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Report Printing Actions">
|
||||
<field name="user_id"/>
|
||||
<field name="action" />
|
||||
<field name="printer_id" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
52
base_report_to_printer/security/security.xml
Executable file
52
base_report_to_printer/security/security.xml
Executable file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<record id="res_groups_printingprintoperator0" model="res.groups">
|
||||
<field eval=""""Printing / Print Operator"""" name="name"/>
|
||||
</record>
|
||||
<record id="ir_model_access_printingprintergroup1" model="ir.model.access">
|
||||
<field name="model_id" ref="model_printing_printer"/>
|
||||
<field eval="1" name="perm_read"/>
|
||||
<field eval=""""printing_printer group"""" name="name"/>
|
||||
<field eval="1" name="perm_unlink"/>
|
||||
<field eval="1" name="perm_write"/>
|
||||
<field eval="1" name="perm_create"/>
|
||||
<field name="group_id" ref="res_groups_printingprintoperator0"/>
|
||||
</record>
|
||||
<record id="ir_model_access_printing_action" model="ir.model.access">
|
||||
<field name="model_id" ref="model_printing_action"/>
|
||||
<field eval="1" name="perm_read"/>
|
||||
<field eval=""""printing_printer group"""" name="name"/>
|
||||
<field eval="1" name="perm_unlink"/>
|
||||
<field eval="1" name="perm_write"/>
|
||||
<field eval="1" name="perm_create"/>
|
||||
<field name="group_id" ref="res_groups_printingprintoperator0"/>
|
||||
</record>
|
||||
<record id="ir_model_access_printingreportxmlaction" model="ir.model.access">
|
||||
<field name="model_id" ref="model_printing_report_xml_action"/>
|
||||
<field eval="1" name="perm_read"/>
|
||||
<field eval=""""printing_printer group"""" name="name"/>
|
||||
<field eval="1" name="perm_unlink"/>
|
||||
<field eval="1" name="perm_write"/>
|
||||
<field eval="1" name="perm_create"/>
|
||||
<field name="group_id" ref="res_groups_printingprintoperator0"/>
|
||||
</record>
|
||||
<record id="menu_printing_printer_form" model="ir.ui.menu">
|
||||
<field eval="[(6,0,[ref('res_groups_printingprintoperator0')])]" name="groups_id"/>
|
||||
<field eval=""""Printers"""" name="name"/>
|
||||
<field eval="10" name="sequence"/>
|
||||
<field name="parent_id" ref="menu_printing_config"/>
|
||||
<field eval=""""STOCK_PRINT"""" name="icon"/>
|
||||
</record>
|
||||
</data>
|
||||
<data>
|
||||
<record id="ir_model_access_printingprinterall0" model="ir.model.access">
|
||||
<field name="model_id" ref="model_printing_printer"/>
|
||||
<field eval="1" name="perm_read"/>
|
||||
<field eval=""""printing_printer all"""" name="name"/>
|
||||
<field eval="0" name="perm_unlink"/>
|
||||
<field eval="0" name="perm_write"/>
|
||||
<field eval="0" name="perm_create"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
23
base_report_to_printer/wizard/__init__.py
Normal file
23
base_report_to_printer/wizard/__init__.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com>
|
||||
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
|
||||
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
|
||||
# All Rights Reserved
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import update_printers
|
||||
76
base_report_to_printer/wizard/update_printers.py
Executable file
76
base_report_to_printer/wizard/update_printers.py
Executable file
@@ -0,0 +1,76 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com>
|
||||
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
|
||||
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
|
||||
# All Rights Reserved
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
import subprocess
|
||||
import cups
|
||||
|
||||
import netsvc
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
class printing_printer_update_wizard(osv.osv_memory):
|
||||
_name = "printing.printer.update.wizard"
|
||||
|
||||
_columns = {
|
||||
}
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
return {}
|
||||
|
||||
def action_ok(self, cr, uid, ids, context=None):
|
||||
# Update Printers
|
||||
try:
|
||||
connection = cups.Connection()
|
||||
printers = connection.getPrinters()
|
||||
except:
|
||||
return {}
|
||||
|
||||
ids = self.pool.get('printing.printer').search(cr, uid, [('system_name','in',printers.keys())], context=context)
|
||||
for printer in self.pool.get('printing.printer').browse(cr, uid, ids, context):
|
||||
del printers[printer.system_name]
|
||||
|
||||
for name in printers:
|
||||
printer = printers[name]
|
||||
self.pool.get('printing.printer').create(cr, uid, {
|
||||
'name': printer['printer-info'],
|
||||
'system_name': name,
|
||||
'model': printer.get('printer-make-and-model', False),
|
||||
'location': printer.get('printer-location', False),
|
||||
'uri': printer.get('device-uri', False),
|
||||
}, context)
|
||||
|
||||
return {
|
||||
'name': 'Printers',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'printing.printer',
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'current',
|
||||
}
|
||||
|
||||
printing_printer_update_wizard()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
26
base_report_to_printer/wizard/update_printers.xml
Normal file
26
base_report_to_printer/wizard/update_printers.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="printer_update_wizard" model="ir.ui.view">
|
||||
<field name="name">printing.printer.update.wizard</field>
|
||||
<field name="model">printing.printer.update.wizard</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Update Printers from CUPS" col="2">
|
||||
<label string="This process will create all missing printers from the current CUPS server." colspan="2"/>
|
||||
<separator string="" colspan="2"/>
|
||||
<button name="action_cancel" icon="gtk-cancel" string="Cancel" special="cancel"/>
|
||||
<button name="action_ok" type="object" icon="gtk-ok" string="Ok"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_printer_update_wizard" model="ir.actions.act_window">
|
||||
<field name="name">Update Printers from CUPS</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">printing.printer.update.wizard</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<menuitem action="action_printer_update_wizard" id="menu_printer_update_wizard" parent="menu_printing_config"/>
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user