mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[MRG] Portage of base_report_to_printer
This commit is contained in:
@@ -1,4 +0,0 @@
|
|||||||
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>
|
|
||||||
@@ -21,5 +21,5 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
import printing
|
from . import printing
|
||||||
import wizard
|
from . import wizard
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 Ferran Pegueroles <ferran@pegueroles.com>
|
# Copyright (c) 2007 Ferran Pegueroles <ferran@pegueroles.com>
|
||||||
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.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 Agile Business Group sagl (<http://www.agilebg.com>)
|
||||||
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
|
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
|
||||||
|
# Copyright (C) 2013 Camptocamp (<http://www.camptocamp.com>)
|
||||||
# All Rights Reserved
|
# All Rights Reserved
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
@@ -26,44 +27,70 @@
|
|||||||
'version': '0.1',
|
'version': '0.1',
|
||||||
'category': 'Generic Modules/Base',
|
'category': 'Generic Modules/Base',
|
||||||
'description': """
|
'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.
|
Report to printer
|
||||||
|
-----------------
|
||||||
|
This module allows users to send reports to a printer attached to the server.
|
||||||
|
|
||||||
Configuration
|
|
||||||
=============
|
|
||||||
|
|
||||||
.. image:: http://planet.domsense.com/wp-content/uploads/2011/09/printing-menu.png
|
It adds an optional behaviour on reports to send it directly to a printer.
|
||||||
: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.
|
* `Send to Client` is the default behavious providing you a downloadable PDF
|
||||||
|
* `Send to Printer` prints the report on selected printer
|
||||||
|
|
||||||
In the next step you will configure the reports to send to the printers.
|
Report behaviour is defined by settings.
|
||||||
|
|
||||||
.. 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.
|
Settings can be configured:
|
||||||
|
|
||||||
.. image:: http://planet.domsense.com/wp-content/uploads/2011/09/report-configuration.png
|
* globaly
|
||||||
:width: 400 px
|
* per user
|
||||||
|
* per report
|
||||||
|
* per user and report
|
||||||
|
|
||||||
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 installing enable the "Printing / Print Operator" option under access
|
||||||
|
rights to give users the ability to view the print menu.
|
||||||
|
|
||||||
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
|
|
||||||
""",
|
To show all available printers for your server, uses
|
||||||
'author': ['Agile Business Group', 'Pegueroles SCP', 'NaN'],
|
`Settings/Configuration/Printing/Update Printers from CUPS` wizard.
|
||||||
|
|
||||||
|
|
||||||
|
Then goto the user profile and set the users printing action and default
|
||||||
|
printer.
|
||||||
|
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
This module requires pycups
|
||||||
|
https://pypi.python.org/pypi/pycups
|
||||||
|
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
------------
|
||||||
|
|
||||||
|
* 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>
|
||||||
|
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
|
||||||
|
|
||||||
|
""",
|
||||||
|
'author': 'Agile Business Group & Domsense, Pegueroles SCP, NaN',
|
||||||
'website': 'http://www.agilebg.com',
|
'website': 'http://www.agilebg.com',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
"depends" : ['base', 'base_calendar'],
|
"depends" : ['base', 'base_calendar'],
|
||||||
"init_xml" : [],
|
'data': [
|
||||||
"update_xml" : [
|
'security/security.xml',
|
||||||
'printing_data.xml',
|
'printing_data.xml',
|
||||||
'printing_view.xml',
|
'printing_view.xml',
|
||||||
'wizard/update_printers.xml',
|
'wizard/update_printers.xml',
|
||||||
'security/security.xml',
|
],
|
||||||
],
|
'installable': True,
|
||||||
"demo_xml" : [],
|
'auto_install': False,
|
||||||
"active": False,
|
'application': True,
|
||||||
"installable": False
|
'external_dependencies': {
|
||||||
|
'python': ['cups']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: OpenERP Server 6.0.3\n"
|
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2011-09-26 09:06+0000\n"
|
"POT-Creation-Date: 2013-11-05 14:48+0000\n"
|
||||||
"PO-Revision-Date: 2011-09-26 09:06+0000\n"
|
"PO-Revision-Date: 2013-11-05 14:48+0000\n"
|
||||||
"Last-Translator: <>\n"
|
"Last-Translator: <>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
@@ -15,11 +15,6 @@ msgstr ""
|
|||||||
"Content-Transfer-Encoding: \n"
|
"Content-Transfer-Encoding: \n"
|
||||||
"Plural-Forms: \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
|
#. module: base_report_to_printer
|
||||||
#: selection:printing.printer,status:0
|
#: selection:printing.printer,status:0
|
||||||
msgid "Unavailable"
|
msgid "Unavailable"
|
||||||
@@ -35,46 +30,40 @@ msgstr ""
|
|||||||
msgid "Unknown"
|
msgid "Unknown"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
|
||||||
#: field:printing.printer,status:0
|
|
||||||
msgid "Status"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: field:printing.printer,system_name:0
|
#: field:printing.printer,system_name:0
|
||||||
msgid "System Name"
|
msgid "System Name"
|
||||||
msgstr ""
|
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
|
#. module: base_report_to_printer
|
||||||
#: field:printing.printer,location:0
|
#: field:printing.printer,location:0
|
||||||
msgid "Location"
|
msgid "Location"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. 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
|
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_printer_form
|
||||||
#: view:printing.printer:0
|
#: view:printing.printer:0
|
||||||
msgid "Printers"
|
msgid "Printers"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:ir.actions.report.xml:0
|
||||||
|
msgid "Print"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: field:res.users,printing_action:0
|
#: field:res.users,printing_action:0
|
||||||
msgid "Printing Action"
|
msgid "Printing Action"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: model:ir.module.module,description:base_report_to_printer.module_meta_information
|
#: field:printing.action,type:0
|
||||||
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."
|
msgid "Type"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: field:printing.action,type:0
|
#: field:printing.printer,model:0
|
||||||
msgid "Type"
|
msgid "Model"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
@@ -89,12 +78,22 @@ msgstr ""
|
|||||||
msgid "Printer"
|
msgid "Printer"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.model,name:base_report_to_printer.model_res_users
|
||||||
|
msgid "Users"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: model:ir.model,name:base_report_to_printer.model_printing_report_xml_action
|
#: model:ir.model,name:base_report_to_printer.model_printing_report_xml_action
|
||||||
#: view:printing.report.xml.action:0
|
#: view:printing.report.xml.action:0
|
||||||
msgid "Report Printing Actions"
|
msgid "Report Printing Actions"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:ir.actions.report.xml:0
|
||||||
|
msgid "Specific actions per user"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: model:ir.model,name:base_report_to_printer.model_printing_action
|
#: model:ir.model,name:base_report_to_printer.model_printing_action
|
||||||
msgid "Print Job Action"
|
msgid "Print Job Action"
|
||||||
@@ -111,18 +110,13 @@ msgid "Report"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_config
|
#: field:printing.printer,status:0
|
||||||
msgid "Configuration"
|
msgid "Status"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: model:ir.module.module,shortdesc:base_report_to_printer.module_meta_information
|
#: model:ir.actions.act_window,name:base_report_to_printer.action_printing_printer_form
|
||||||
msgid "Report to printer"
|
msgid "Show Printers"
|
||||||
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 ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
@@ -148,7 +142,7 @@ msgid "Default Printer"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: code:addons/base_report_to_printer/printing.py:189
|
#: code:addons/base_report_to_printer/printing.py:186
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Send to Client"
|
msgid "Send to Client"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -158,11 +152,6 @@ msgstr ""
|
|||||||
msgid "URI"
|
msgid "URI"
|
||||||
msgstr ""
|
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
|
#. module: base_report_to_printer
|
||||||
#: model:ir.actions.act_window,name:base_report_to_printer.action_printer_update_wizard
|
#: 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
|
#: model:ir.ui.menu,name:base_report_to_printer.menu_printer_update_wizard
|
||||||
@@ -171,7 +160,7 @@ msgid "Update Printers from CUPS"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: code:addons/base_report_to_printer/printing.py:188
|
#: code:addons/base_report_to_printer/printing.py:185
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Send to Printer"
|
msgid "Send to Printer"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -194,8 +183,8 @@ msgid "Action"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: field:printing.printer,model:0
|
#: view:ir.actions.report.xml:0
|
||||||
msgid "Model"
|
msgid "Security"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
@@ -218,29 +207,19 @@ msgstr ""
|
|||||||
msgid "Actions"
|
msgid "Actions"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
|
||||||
#: view:printing.job:0
|
|
||||||
msgid "Print Jobs"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: view:printing.printer.update.wizard:0
|
#: view:printing.printer.update.wizard:0
|
||||||
msgid "Cancel"
|
msgid "Cancel"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: model:ir.model,name:base_report_to_printer.model_res_users
|
#: model:res.groups,name:base_report_to_printer.res_groups_printingprintoperator0
|
||||||
msgid "res.users"
|
msgid "Printing / Print Operator"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: code:addons/base_report_to_printer/printing.py:190
|
#: code:addons/base_report_to_printer/printing.py:187
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Use user's defaults"
|
msgid "Use user's defaults"
|
||||||
msgstr ""
|
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 ""
|
|
||||||
|
|
||||||
|
|||||||
225
base_report_to_printer/i18n/fr.po
Normal file
225
base_report_to_printer/i18n/fr.po
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
# Translation of OpenERP Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * base_report_to_printer
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2013-11-05 14:48+0000\n"
|
||||||
|
"PO-Revision-Date: 2013-11-05 14:48+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
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Unavailable"
|
||||||
|
msgstr "Non disponible"
|
||||||
|
|
||||||
|
#. 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 "Cette opération va créer les imprimantes manquantes à partir du server CUPS courant."
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Unknown"
|
||||||
|
msgstr "Inconnu"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,system_name:0
|
||||||
|
msgid "System Name"
|
||||||
|
msgstr "Nom sytème"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,location:0
|
||||||
|
msgid "Location"
|
||||||
|
msgstr "Emplacement"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_printer_form
|
||||||
|
#: view:printing.printer:0
|
||||||
|
msgid "Printers"
|
||||||
|
msgstr "Imprimantes"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:ir.actions.report.xml:0
|
||||||
|
msgid "Print"
|
||||||
|
msgstr "Imprimer"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:res.users,printing_action:0
|
||||||
|
msgid "Printing Action"
|
||||||
|
msgstr "Activité d'impression"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.action,type:0
|
||||||
|
msgid "Type"
|
||||||
|
msgstr "Type"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,model:0
|
||||||
|
msgid "Model"
|
||||||
|
msgstr "Modèle"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Available"
|
||||||
|
msgstr "Disponible"
|
||||||
|
|
||||||
|
#. 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 "Imprimante"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.model,name:base_report_to_printer.model_res_users
|
||||||
|
msgid "Users"
|
||||||
|
msgstr "Utilisateurs"
|
||||||
|
|
||||||
|
#. 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 "Rapport d'activité d'impression"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:ir.actions.report.xml:0
|
||||||
|
msgid "Specific actions per user"
|
||||||
|
msgstr "Action spécifique par utilisateur"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.model,name:base_report_to_printer.model_printing_action
|
||||||
|
msgid "Print Job Action"
|
||||||
|
msgstr "Action de Job d'impression"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.report.xml.action,user_id:0
|
||||||
|
msgid "User"
|
||||||
|
msgstr "Utilisateur"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.report.xml.action,report_id:0
|
||||||
|
msgid "Report"
|
||||||
|
msgstr "Rapport"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,status:0
|
||||||
|
msgid "Status"
|
||||||
|
msgstr "Statut"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.actions.act_window,name:base_report_to_printer.action_printing_printer_form
|
||||||
|
msgid "Show Printers"
|
||||||
|
msgstr "Afficher les imprimantes"
|
||||||
|
|
||||||
|
#. 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 "Nom"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:printing.printer:0
|
||||||
|
msgid "Set Default"
|
||||||
|
msgstr "Définitir par défaut"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,default:0
|
||||||
|
#: field:res.users,printing_printer_id:0
|
||||||
|
msgid "Default Printer"
|
||||||
|
msgstr "Imprimante par défaut"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: code:addons/base_report_to_printer/printing.py:186
|
||||||
|
#, python-format
|
||||||
|
msgid "Send to Client"
|
||||||
|
msgstr "Envoyer au client"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,uri:0
|
||||||
|
msgid "URI"
|
||||||
|
msgstr "URI"
|
||||||
|
|
||||||
|
#. 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 "Mettre à jour les imprimantes depuis CUPS"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: code:addons/base_report_to_printer/printing.py:185
|
||||||
|
#, python-format
|
||||||
|
msgid "Send to Printer"
|
||||||
|
msgstr "Envoyer à l'imprimante"
|
||||||
|
|
||||||
|
#. 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 "Impression en cours"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Error"
|
||||||
|
msgstr "Erreur"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:ir.actions.report.xml,property_printing_action:0
|
||||||
|
#: field:printing.report.xml.action,action:0
|
||||||
|
msgid "Action"
|
||||||
|
msgstr "Action"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:ir.actions.report.xml:0
|
||||||
|
msgid "Security"
|
||||||
|
msgstr "Sécurité"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,status_message:0
|
||||||
|
msgid "Status Message"
|
||||||
|
msgstr "Message de Statut"
|
||||||
|
|
||||||
|
#. 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 "Ce champs permet de configurer les action et les imprimante par utilisateur"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Server Error"
|
||||||
|
msgstr "Erreur serveur"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:ir.actions.report.xml,printing_action_ids:0
|
||||||
|
msgid "Actions"
|
||||||
|
msgstr "Actions"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:printing.printer.update.wizard:0
|
||||||
|
msgid "Cancel"
|
||||||
|
msgstr "Annuler"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:res.groups,name:base_report_to_printer.res_groups_printingprintoperator0
|
||||||
|
msgid "Printing / Print Operator"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: code:addons/base_report_to_printer/printing.py:187
|
||||||
|
#, python-format
|
||||||
|
msgid "Use user's defaults"
|
||||||
|
msgstr "Utiliser la configuration par défaut de l'utilisateur"
|
||||||
|
|
||||||
@@ -4,22 +4,17 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: OpenERP Server 6.0.3\n"
|
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2011-09-26 09:06+0000\n"
|
"POT-Creation-Date: 2013-11-05 14:48+0000\n"
|
||||||
"PO-Revision-Date: 2011-09-26 11:14+0100\n"
|
"PO-Revision-Date: 2013-11-05 14:48+0000\n"
|
||||||
"Last-Translator: Lorenzo Battistini <lorenzo.battistini@agilebg.com>\n"
|
"Last-Translator: <>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: \n"
|
||||||
"Plural-Forms: \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
|
#. module: base_report_to_printer
|
||||||
#: selection:printing.printer,status:0
|
#: selection:printing.printer,status:0
|
||||||
msgid "Unavailable"
|
msgid "Unavailable"
|
||||||
@@ -35,48 +30,42 @@ msgstr "Questo processo creerà tutte le stampante mancanti dal server CUPS corr
|
|||||||
msgid "Unknown"
|
msgid "Unknown"
|
||||||
msgstr "Sconosciuto"
|
msgstr "Sconosciuto"
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
|
||||||
#: field:printing.printer,status:0
|
|
||||||
msgid "Status"
|
|
||||||
msgstr "Stato"
|
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: field:printing.printer,system_name:0
|
#: field:printing.printer,system_name:0
|
||||||
msgid "System Name"
|
msgid "System Name"
|
||||||
msgstr "Nome di sistema"
|
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
|
#. module: base_report_to_printer
|
||||||
#: field:printing.printer,location:0
|
#: field:printing.printer,location:0
|
||||||
msgid "Location"
|
msgid "Location"
|
||||||
msgstr "Locazione"
|
msgstr "Locazione"
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. 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
|
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_printer_form
|
||||||
#: view:printing.printer:0
|
#: view:printing.printer:0
|
||||||
msgid "Printers"
|
msgid "Printers"
|
||||||
msgstr "Stampanti"
|
msgstr "Stampanti"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:ir.actions.report.xml:0
|
||||||
|
msgid "Print"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: field:res.users,printing_action:0
|
#: field:res.users,printing_action:0
|
||||||
msgid "Printing Action"
|
msgid "Printing Action"
|
||||||
msgstr "Azione di stampa"
|
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
|
#. module: base_report_to_printer
|
||||||
#: field:printing.action,type:0
|
#: field:printing.action,type:0
|
||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr "Tipo"
|
msgstr "Tipo"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,model:0
|
||||||
|
msgid "Model"
|
||||||
|
msgstr "Model"
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: selection:printing.printer,status:0
|
#: selection:printing.printer,status:0
|
||||||
msgid "Available"
|
msgid "Available"
|
||||||
@@ -89,41 +78,46 @@ msgstr "Disponibile"
|
|||||||
msgid "Printer"
|
msgid "Printer"
|
||||||
msgstr "Stampante"
|
msgstr "Stampante"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.model,name:base_report_to_printer.model_res_users
|
||||||
|
msgid "Users"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: model:ir.model,name:base_report_to_printer.model_printing_report_xml_action
|
#: model:ir.model,name:base_report_to_printer.model_printing_report_xml_action
|
||||||
#: view:printing.report.xml.action:0
|
#: view:printing.report.xml.action:0
|
||||||
msgid "Report Printing Actions"
|
msgid "Report Printing Actions"
|
||||||
msgstr "Azioni di stampa report"
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:ir.actions.report.xml:0
|
||||||
|
msgid "Specific actions per user"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: model:ir.model,name:base_report_to_printer.model_printing_action
|
#: model:ir.model,name:base_report_to_printer.model_printing_action
|
||||||
msgid "Print Job Action"
|
msgid "Print Job Action"
|
||||||
msgstr "Azione di stampa"
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: field:printing.report.xml.action,user_id:0
|
#: field:printing.report.xml.action,user_id:0
|
||||||
msgid "User"
|
msgid "User"
|
||||||
msgstr "Utente"
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: field:printing.report.xml.action,report_id:0
|
#: field:printing.report.xml.action,report_id:0
|
||||||
msgid "Report"
|
msgid "Report"
|
||||||
msgstr "Report"
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_config
|
#: field:printing.printer,status:0
|
||||||
msgid "Configuration"
|
msgid "Status"
|
||||||
msgstr "Configurazione"
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: model:ir.module.module,shortdesc:base_report_to_printer.module_meta_information
|
#: model:ir.actions.act_window,name:base_report_to_printer.action_printing_printer_form
|
||||||
msgid "Report to printer"
|
msgid "Show Printers"
|
||||||
msgstr "Report alla stampante"
|
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 "printjob.printer.update.wizard"
|
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: view:printing.printer.update.wizard:0
|
#: view:printing.printer.update.wizard:0
|
||||||
@@ -148,7 +142,7 @@ msgid "Default Printer"
|
|||||||
msgstr "Stampante di default"
|
msgstr "Stampante di default"
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: code:addons/base_report_to_printer/printing.py:189
|
#: code:addons/base_report_to_printer/printing.py:186
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Send to Client"
|
msgid "Send to Client"
|
||||||
msgstr "Invia al client"
|
msgstr "Invia al client"
|
||||||
@@ -156,12 +150,7 @@ msgstr "Invia al client"
|
|||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: field:printing.printer,uri:0
|
#: field:printing.printer,uri:0
|
||||||
msgid "URI"
|
msgid "URI"
|
||||||
msgstr "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 "printing.printer.update.wizard"
|
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: model:ir.actions.act_window,name:base_report_to_printer.action_printer_update_wizard
|
#: model:ir.actions.act_window,name:base_report_to_printer.action_printer_update_wizard
|
||||||
@@ -171,7 +160,7 @@ msgid "Update Printers from CUPS"
|
|||||||
msgstr "Aggiorna stampanti da CUPS"
|
msgstr "Aggiorna stampanti da CUPS"
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: code:addons/base_report_to_printer/printing.py:188
|
#: code:addons/base_report_to_printer/printing.py:185
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Send to Printer"
|
msgid "Send to Printer"
|
||||||
msgstr "Invia alla stampante"
|
msgstr "Invia alla stampante"
|
||||||
@@ -194,9 +183,9 @@ msgid "Action"
|
|||||||
msgstr "Azione"
|
msgstr "Azione"
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: field:printing.printer,model:0
|
#: view:ir.actions.report.xml:0
|
||||||
msgid "Model"
|
msgid "Security"
|
||||||
msgstr "Model"
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: field:printing.printer,status_message:0
|
#: field:printing.printer,status_message:0
|
||||||
@@ -218,29 +207,19 @@ msgstr "Errore server"
|
|||||||
msgid "Actions"
|
msgid "Actions"
|
||||||
msgstr "Azioni"
|
msgstr "Azioni"
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
|
||||||
#: view:printing.job:0
|
|
||||||
msgid "Print Jobs"
|
|
||||||
msgstr "Stampe"
|
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: view:printing.printer.update.wizard:0
|
#: view:printing.printer.update.wizard:0
|
||||||
msgid "Cancel"
|
msgid "Cancel"
|
||||||
msgstr "Annulla"
|
msgstr "Annulla"
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: model:ir.model,name:base_report_to_printer.model_res_users
|
#: model:res.groups,name:base_report_to_printer.res_groups_printingprintoperator0
|
||||||
msgid "res.users"
|
msgid "Printing / Print Operator"
|
||||||
msgstr "res.users"
|
msgstr ""
|
||||||
|
|
||||||
#. module: base_report_to_printer
|
#. module: base_report_to_printer
|
||||||
#: code:addons/base_report_to_printer/printing.py:190
|
#: code:addons/base_report_to_printer/printing.py:187
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Use user's defaults"
|
msgid "Use user's defaults"
|
||||||
msgstr "Utilizza i default dell'utente"
|
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"
|
|
||||||
|
|
||||||
|
|||||||
144
base_report_to_printer/printing.py
Executable file → Normal file
144
base_report_to_printer/printing.py
Executable file → Normal file
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 Ferran Pegueroles <ferran@pegueroles.com>
|
# Copyright (c) 2007 Ferran Pegueroles <ferran@pegueroles.com>
|
||||||
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.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 Agile Business Group sagl (<http://www.agilebg.com>)
|
||||||
@@ -23,31 +23,25 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
import base64
|
import base64
|
||||||
import threading
|
|
||||||
from tempfile import mkstemp
|
from tempfile import mkstemp
|
||||||
|
import logging
|
||||||
|
|
||||||
import cups
|
import cups
|
||||||
import thread
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
|
|
||||||
import netsvc
|
from openerp import pooler
|
||||||
import tools
|
from openerp.osv import orm, fields
|
||||||
import time
|
from openerp.tools.translate import _
|
||||||
from osv import fields
|
from openerp.addons.base_calendar import base_calendar
|
||||||
from osv import osv
|
|
||||||
import pooler
|
|
||||||
import tools
|
|
||||||
from tools.translate import _
|
|
||||||
from base_calendar import base_calendar
|
|
||||||
import logging
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Printers
|
# Printers
|
||||||
#
|
#
|
||||||
class printing_printer(osv.osv):
|
class printing_printer(orm.Model):
|
||||||
_name = "printing.printer"
|
_name = "printing.printer"
|
||||||
_description = "Printer"
|
_description = "Printer"
|
||||||
|
|
||||||
@@ -60,13 +54,14 @@ class printing_printer(osv.osv):
|
|||||||
'model': fields.char('Model', size=500, readonly=True),
|
'model': fields.char('Model', size=500, readonly=True),
|
||||||
'location': fields.char('Location', size=500, readonly=True),
|
'location': fields.char('Location', size=500, readonly=True),
|
||||||
'uri': fields.char('URI', size=500, readonly=True),
|
'uri': fields.char('URI', size=500, readonly=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
_order = "name"
|
_order = "name"
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'default': lambda *a: False,
|
'default': lambda *a: False,
|
||||||
'status': lambda *a: 'unknown',
|
'status': lambda *a: 'unknown',
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, pool, cr):
|
def __init__(self, pool, cr):
|
||||||
super(printing_printer, self).__init__(pool, cr)
|
super(printing_printer, self).__init__(pool, cr)
|
||||||
@@ -74,7 +69,7 @@ class printing_printer(osv.osv):
|
|||||||
self.last_update = None
|
self.last_update = None
|
||||||
self.updating = False
|
self.updating = False
|
||||||
|
|
||||||
def update_printers_status(self, db_name, uid, context):
|
def update_printers_status(self, db_name, uid, context=None):
|
||||||
db, pool = pooler.get_db_and_pool(db_name)
|
db, pool = pooler.get_db_and_pool(db_name)
|
||||||
cr = db.cursor()
|
cr = db.cursor()
|
||||||
|
|
||||||
@@ -90,13 +85,15 @@ class printing_printer(osv.osv):
|
|||||||
4 : 'printing',
|
4 : 'printing',
|
||||||
5 : 'error'
|
5 : 'error'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if context is None:
|
||||||
|
context = {}
|
||||||
try:
|
try:
|
||||||
# Skip update to avoid the thread being created again
|
# Skip update to avoid the thread being created again
|
||||||
ctx = context.copy()
|
ctx = context.copy()
|
||||||
ctx['skip_update'] = True
|
ctx['skip_update'] = True
|
||||||
ids = self.pool.get('printing.printer').search(cr, uid, [], context=ctx)
|
ids = self.search(cr, uid, [], context=ctx)
|
||||||
for printer in self.pool.get('printing.printer').browse(cr, uid, ids, context=ctx):
|
for printer in self.browse(cr, uid, ids, context=ctx):
|
||||||
vals = {}
|
vals = {}
|
||||||
if server_error:
|
if server_error:
|
||||||
status = 'server-error'
|
status = 'server-error'
|
||||||
@@ -112,7 +109,7 @@ class printing_printer(osv.osv):
|
|||||||
status = 'unavailable'
|
status = 'unavailable'
|
||||||
|
|
||||||
vals['status'] = status
|
vals['status'] = status
|
||||||
self.pool.get('printing.printer').write(cr, uid, [printer.id], vals, context)
|
self.write(cr, uid, [printer.id], vals, context=context)
|
||||||
cr.commit()
|
cr.commit()
|
||||||
except:
|
except:
|
||||||
cr.rollback()
|
cr.rollback()
|
||||||
@@ -174,16 +171,13 @@ class printing_printer(osv.osv):
|
|||||||
self.write(cr, uid, default_ids, {'default':False}, context)
|
self.write(cr, uid, default_ids, {'default':False}, context)
|
||||||
self.write(cr, uid, ids[0], {'default':True}, context)
|
self.write(cr, uid, ids[0], {'default':True}, context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_default(self,cr,uid,context):
|
def get_default(self,cr,uid,context):
|
||||||
printer_ids = self.search(cr, uid,[('default','=',True)])
|
printer_ids = self.search(cr, uid,[('default','=',True)])
|
||||||
if printer_ids:
|
if printer_ids:
|
||||||
return printer_ids[0]
|
return printer_ids[0]
|
||||||
return False
|
return False
|
||||||
|
|
||||||
printing_printer()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Actions
|
# Actions
|
||||||
@@ -194,23 +188,22 @@ def _available_action_types(self, cr, uid, context=None):
|
|||||||
('server',_('Send to Printer')),
|
('server',_('Send to Printer')),
|
||||||
('client',_('Send to Client')),
|
('client',_('Send to Client')),
|
||||||
('user_default',_("Use user's defaults")),
|
('user_default',_("Use user's defaults")),
|
||||||
]
|
]
|
||||||
|
|
||||||
class printing_action(osv.osv):
|
class printing_action(orm.Model):
|
||||||
_name = 'printing.action'
|
_name = 'printing.action'
|
||||||
_description = 'Print Job Action'
|
_description = 'Print Job Action'
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Name', size=256, required=True),
|
'name': fields.char('Name', size=256, required=True),
|
||||||
'type': fields.selection(_available_action_types, 'Type', required=True),
|
'type': fields.selection(_available_action_types, 'Type', required=True),
|
||||||
}
|
}
|
||||||
printing_action()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Users
|
# Users
|
||||||
#
|
#
|
||||||
|
|
||||||
class res_users(osv.osv):
|
class res_users(orm.Model):
|
||||||
_name = "res.users"
|
_name = "res.users"
|
||||||
_inherit = "res.users"
|
_inherit = "res.users"
|
||||||
|
|
||||||
@@ -222,17 +215,26 @@ class res_users(osv.osv):
|
|||||||
_columns = {
|
_columns = {
|
||||||
'printing_action': fields.selection(_user_available_action_types, 'Printing Action'),
|
'printing_action': fields.selection(_user_available_action_types, 'Printing Action'),
|
||||||
'printing_printer_id': fields.many2one('printing.printer', 'Default Printer'),
|
'printing_printer_id': fields.many2one('printing.printer', 'Default Printer'),
|
||||||
}
|
}
|
||||||
|
|
||||||
res_users()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Reports
|
# Reports
|
||||||
#
|
#
|
||||||
|
|
||||||
class report_xml(osv.osv):
|
class report_xml(orm.Model):
|
||||||
|
|
||||||
def print_direct(self, cr, uid, result, format, printer):
|
|
||||||
|
def set_print_options(self, cr, uid, report_id, format, context=None):
|
||||||
|
"""
|
||||||
|
Hook to set print options
|
||||||
|
"""
|
||||||
|
options = {}
|
||||||
|
if format == 'raw':
|
||||||
|
options['raw'] = True
|
||||||
|
return options
|
||||||
|
|
||||||
|
def print_direct(self, cr, uid, report_id, result, format, printer, context=None):
|
||||||
|
user_obj = self.pool.get('res.users')
|
||||||
fd, file_name = mkstemp()
|
fd, file_name = mkstemp()
|
||||||
try:
|
try:
|
||||||
os.write(fd, base64.decodestring(result))
|
os.write(fd, base64.decodestring(result))
|
||||||
@@ -244,14 +246,13 @@ class report_xml(osv.osv):
|
|||||||
printer_system_name = printer
|
printer_system_name = printer
|
||||||
else:
|
else:
|
||||||
printer_system_name = printer.system_name
|
printer_system_name = printer.system_name
|
||||||
if format == 'raw':
|
connection = cups.Connection()
|
||||||
# -l is the same as -o raw
|
|
||||||
cmd = "lpr -l -P %s %s" % (printer_system_name,file_name)
|
options = self.set_print_options(cr, uid, report_id, format, context=context)
|
||||||
else:
|
|
||||||
cmd = "lpr -P %s %s" % (printer_system_name,file_name)
|
connection.printFile(printer_system_name, file_name, file_name, options=options)
|
||||||
logger = logging.getLogger('base_report_to_printer')
|
logger = logging.getLogger('base_report_to_printer')
|
||||||
logger.info("Printing job : '%s'" % cmd)
|
logger.info("Printing job : '%s'" % file_name)
|
||||||
os.system(cmd)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
_inherit = 'ir.actions.report.xml'
|
_inherit = 'ir.actions.report.xml'
|
||||||
@@ -264,22 +265,21 @@ class report_xml(osv.osv):
|
|||||||
string='Action',
|
string='Action',
|
||||||
view_load=True,
|
view_load=True,
|
||||||
method=True,
|
method=True,
|
||||||
),
|
),
|
||||||
'printing_printer_id': fields.many2one('printing.printer', 'Printer'),
|
'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'),
|
'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):
|
def behaviour(self, cr, uid, ids, context=None):
|
||||||
if context is None:
|
|
||||||
context={}
|
|
||||||
result = {}
|
result = {}
|
||||||
|
printer_obj = self.pool.get('printing.printer')
|
||||||
|
printing_act_obj = self.pool.get('printing.report.xml.action')
|
||||||
# Set hardcoded default action
|
# Set hardcoded default action
|
||||||
default_action = 'client'
|
default_action = 'client'
|
||||||
# Retrieve system wide printer
|
# Retrieve system wide printer
|
||||||
default_printer = self.pool.get('printing.printer').get_default(cr,uid,context)
|
default_printer = printer_obj.get_default(cr, uid, context=context)
|
||||||
if default_printer:
|
if default_printer:
|
||||||
default_printer = self.pool.get('printing.printer').browse(cr,uid,default_printer,context).system_name
|
default_printer = printer_obj.browse(cr, uid, default_printer, context=context)
|
||||||
|
|
||||||
|
|
||||||
# Retrieve user default values
|
# Retrieve user default values
|
||||||
@@ -287,7 +287,7 @@ class report_xml(osv.osv):
|
|||||||
if user.printing_action:
|
if user.printing_action:
|
||||||
default_action = user.printing_action
|
default_action = user.printing_action
|
||||||
if user.printing_printer_id:
|
if user.printing_printer_id:
|
||||||
default_printer = user.printing_printer_id.system_name
|
default_printer = user.printing_printer_id
|
||||||
|
|
||||||
for report in self.browse(cr, uid, ids, context):
|
for report in self.browse(cr, uid, ids, context):
|
||||||
action = default_action
|
action = default_action
|
||||||
@@ -300,8 +300,12 @@ class report_xml(osv.osv):
|
|||||||
printer = report.printing_printer_id
|
printer = report.printing_printer_id
|
||||||
|
|
||||||
# Retrieve report-user specific values
|
# Retrieve report-user specific values
|
||||||
user_action = self.pool.get('printing.report.xml.action').behaviour(cr, uid, report.id, context)
|
act_ids = printing_act_obj.search(cr, uid,
|
||||||
if user_action and user_action['action'] != 'user_default':
|
[('report_id', '=', report.id),
|
||||||
|
('user_id', '=', uid),
|
||||||
|
('action', '!=', 'user_default')], context=context)
|
||||||
|
if act_ids:
|
||||||
|
user_action = printing_act_obj.behaviour(cr, uid, act_ids[0], context=context)
|
||||||
action = user_action['action']
|
action = user_action['action']
|
||||||
if user_action['printer']:
|
if user_action['printer']:
|
||||||
printer = user_action['printer']
|
printer = user_action['printer']
|
||||||
@@ -309,13 +313,11 @@ class report_xml(osv.osv):
|
|||||||
result[report.id] = {
|
result[report.id] = {
|
||||||
'action': action,
|
'action': action,
|
||||||
'printer': printer,
|
'printer': printer,
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
report_xml()
|
class report_xml_action(orm.Model):
|
||||||
|
|
||||||
class report_xml_action(osv.osv):
|
|
||||||
_name = 'printing.report.xml.action'
|
_name = 'printing.report.xml.action'
|
||||||
_description = 'Report Printing Actions'
|
_description = 'Report Printing Actions'
|
||||||
_columns = {
|
_columns = {
|
||||||
@@ -323,21 +325,18 @@ class report_xml_action(osv.osv):
|
|||||||
'user_id': fields.many2one('res.users', 'User', required=True, ondelete='cascade'),
|
'user_id': fields.many2one('res.users', 'User', required=True, ondelete='cascade'),
|
||||||
'action': fields.selection(_available_action_types, 'Action', required=True),
|
'action': fields.selection(_available_action_types, 'Action', required=True),
|
||||||
'printer_id': fields.many2one('printing.printer', 'Printer'),
|
'printer_id': fields.many2one('printing.printer', 'Printer'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def behaviour(self, cr, uid, report_id, context=None):
|
|
||||||
if context is None:
|
def behaviour(self, cr, uid, act_id, context=None):
|
||||||
context={}
|
|
||||||
result = {}
|
result = {}
|
||||||
ids = self.search(cr, uid, [('report_id','=',report_id),('user_id','=',uid)], context=context)
|
if not act_id:
|
||||||
if not ids:
|
|
||||||
return False
|
return False
|
||||||
action = self.browse(cr, uid, ids[0], context)
|
action = self.browse(cr, uid, act_id, context=context)
|
||||||
return {
|
return {
|
||||||
'action': action.action,
|
'action': action.action,
|
||||||
'printer': action.printer_id.system_name,
|
'printer': action.printer_id,
|
||||||
}
|
}
|
||||||
report_xml_action()
|
|
||||||
|
|
||||||
class virtual_report_spool(base_calendar.virtual_report_spool):
|
class virtual_report_spool(base_calendar.virtual_report_spool):
|
||||||
|
|
||||||
@@ -363,8 +362,13 @@ class virtual_report_spool(base_calendar.virtual_report_spool):
|
|||||||
if action != 'client':
|
if action != 'client':
|
||||||
if (self._reports and self._reports.get(report_id, False) and self._reports[report_id].get('result', False)
|
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)):
|
and self._reports[report_id].get('format', False)):
|
||||||
report_obj.print_direct(cr, uid, base64.encodestring(self._reports[report_id]['result']),
|
report_obj.print_direct(cr, uid, report.id, base64.encodestring(self._reports[report_id]['result']),
|
||||||
self._reports[report_id]['format'], printer)
|
self._reports[report_id]['format'], printer)
|
||||||
|
# XXX "Warning" removed as it breaks the workflow
|
||||||
|
# it would be interesting to have a dialog box to confirm if we really want to print
|
||||||
|
# in this case it must be with a by pass parameter to allow massive impression
|
||||||
|
#raise osv.except_osv(_('Printing...'), _('Document sent to printer %s') % (printer,))
|
||||||
|
|
||||||
except:
|
except:
|
||||||
cr.rollback()
|
cr.rollback()
|
||||||
raise
|
raise
|
||||||
|
|||||||
34
base_report_to_printer/printing_data.xml
Executable file → Normal file
34
base_report_to_printer/printing_data.xml
Executable file → Normal file
@@ -1,20 +1,20 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<openerp>
|
<openerp>
|
||||||
<data>
|
<data>
|
||||||
<!-- printing.action -->
|
<!-- printing.action -->
|
||||||
<record model="printing.action" id="printing_action_1">
|
<record model="printing.action" id="printing_action_1">
|
||||||
<field name="name">Send to Printer</field>
|
<field name="name">Send to Printer</field>
|
||||||
<field name="type">server</field>
|
<field name="type">server</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="printing.action" id="printing_action_2">
|
<record model="printing.action" id="printing_action_2">
|
||||||
<field name="name">Send to Client</field>
|
<field name="name">Send to Client</field>
|
||||||
<field name="type">client</field>
|
<field name="type">client</field>
|
||||||
</record>
|
</record>
|
||||||
<!-- properties -->
|
<!-- properties -->
|
||||||
<record forcecreate="True" id="property_printing_action" model="ir.property">
|
<record forcecreate="True" id="property_printing_action" model="ir.property">
|
||||||
<field name="name">property_printing_action</field>
|
<field name="name">property_printing_action</field>
|
||||||
<field name="fields_id" search="[('model','=','ir.actions.report.xml'),('name','=','property_printing_action')]"/>
|
<field name="fields_id" search="[('model','=','ir.actions.report.xml'),('name','=','property_printing_action')]"/>
|
||||||
<field name="value" eval="'printing.action,'+str(printing_action_2)"/>
|
<field name="value" eval="'printing.action,'+str(printing_action_2)"/>
|
||||||
</record>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|||||||
195
base_report_to_printer/printing_view.xml
Executable file → Normal file
195
base_report_to_printer/printing_view.xml
Executable file → Normal file
@@ -1,113 +1,114 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<openerp>
|
<openerp>
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
|
<menuitem name="Printing" id="menu_printing_main" parent="base.menu_config" groups="res_groups_printingprintoperator0"/>
|
||||||
|
|
||||||
<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">
|
<record model="ir.ui.view" id="view_printing_printer_form">
|
||||||
<field name="name">printing.printer.form</field>
|
<field name="name">printing.printer.form</field>
|
||||||
<field name="model">printing.printer</field>
|
<field name="model">printing.printer</field>
|
||||||
<field name="type">form</field>
|
<field name="arch" type="xml">
|
||||||
<field name="arch" type="xml">
|
<form string="Printers">
|
||||||
<form string="Printers">
|
<field name="name" select="1"/>
|
||||||
<field name="name" select="1"/>
|
<field name="system_name" select="1"/>
|
||||||
<field name="system_name" select="1"/>
|
<group col="3" colspan="2">
|
||||||
<group col="3" colspan="2">
|
<field name="default" select="1"/>
|
||||||
<field name="default" select="1"/>
|
<button name="set_default" string="Set Default" type="object"/>
|
||||||
<button name="set_default" string="Set Default" type="object"/>
|
</group>
|
||||||
</group>
|
<field name="uri" select="2"/>
|
||||||
<field name="uri" select="2"/>
|
<field name="model" select="2"/>
|
||||||
<field name="model" select="2"/>
|
<field name="location" select="2"/>
|
||||||
<field name="location" select="2"/>
|
<field name="status" select="1"/>
|
||||||
<field name="status" select="1"/>
|
<field name="status_message" select="2"/>
|
||||||
<field name="status_message" select="2"/>
|
</form>
|
||||||
</form>
|
</field>
|
||||||
</field>
|
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.ui.view" id="view_printing_printer_tree">
|
<record model="ir.ui.view" id="view_printing_printer_tree">
|
||||||
<field name="name">printing.printer.tree</field>
|
<field name="name">printing.printer.tree</field>
|
||||||
<field name="model">printing.printer</field>
|
<field name="model">printing.printer</field>
|
||||||
<field name="type">tree</field>
|
<field name="arch" type="xml">
|
||||||
<field name="arch" type="xml">
|
<tree string="Printers" colors="green:status=='available'; orange:status=='printing'; red:1;">
|
||||||
<tree string="Printers" colors="green:status=='available'; orange:status=='printing'; red:1;">
|
<field name="default"/>
|
||||||
<field name="default"/>
|
<field name="name"/>
|
||||||
<field name="name"/>
|
<field name="system_name"/>
|
||||||
<field name="system_name"/>
|
<field name="status"/>
|
||||||
<field name="status"/>
|
</tree>
|
||||||
</tree>
|
</field>
|
||||||
</field>
|
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.actions.act_window" id="action_printing_printer_form">
|
<record model="ir.actions.act_window" id="action_printing_printer_form">
|
||||||
<field name="name">Printers</field>
|
<field name="name">Show Printers</field>
|
||||||
<field name="res_model">printing.printer</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
<field name="view_type">form</field>
|
<field name="res_model">printing.printer</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_type">form</field>
|
||||||
<field name="auto_refresh">20</field>
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="auto_refresh">20</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<menuitem name="Printers"
|
<menuitem name="Printers"
|
||||||
id="menu_printing_printer_form"
|
id="menu_printing_printer_form"
|
||||||
parent="menu_printing_config"
|
parent="menu_printing_main"
|
||||||
icon="STOCK_PRINT"
|
action="action_printing_printer_form"/>
|
||||||
action="action_printing_printer_form"/>
|
|
||||||
|
|
||||||
<record model="ir.ui.view" id="action_report_xml_form">
|
<record model="ir.ui.view" id="action_report_xml_form">
|
||||||
<field name="name">ir.actions.report.xml.printing</field>
|
<field name="name">ir.actions.report.xml.printing</field>
|
||||||
<field name="model">ir.actions.report.xml</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="inherit_id" ref="base.act_report_xml_view" />
|
<field name="arch" type="xml">
|
||||||
<field name="arch" type="xml">
|
<page string="Security" position="after">
|
||||||
<field name="groups_id" position="before">
|
<page string="Print">
|
||||||
<field name="property_printing_action"/>
|
<group>
|
||||||
<field name="printing_printer_id"/>
|
<field name="property_printing_action"/>
|
||||||
<field name="printing_action_ids" colspan="4"/>
|
<field name="printing_printer_id"/>
|
||||||
</field>
|
</group>
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<!-- res.users -->
|
<separator string="Specific actions per user"/>
|
||||||
<record model="ir.ui.view" id="view_printing_users_form">
|
<field name="printing_action_ids"/>
|
||||||
<field name="name">res.users.form.printing</field>
|
</page>
|
||||||
<field name="type">form</field>
|
</page>
|
||||||
<field name="model">res.users</field>
|
</field>
|
||||||
<field name="inherit_id" ref="base.view_users_form" />
|
</record>
|
||||||
<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 -->
|
<!-- res.users -->
|
||||||
<record model="ir.ui.view" id="printing_report_xml_action_form">
|
<record model="ir.ui.view" id="view_printing_users_form">
|
||||||
<field name="name">printing.report.xml.action.form</field>
|
<field name="name">res.users.form.printing</field>
|
||||||
<field name="model">printing.report.xml.action</field>
|
<field name="model">res.users</field>
|
||||||
<field name="type">form</field>
|
<field name="inherit_id" ref="base.view_users_form" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Report Printing Actions">
|
<field name="lang" position="after">
|
||||||
<field name="user_id"/>
|
<group>
|
||||||
<label string=""/>
|
<field name="printing_action"/>
|
||||||
<field name="action"/>
|
<field name="printing_printer_id"/>
|
||||||
<field name="printer_id" select="1"/>
|
</group>
|
||||||
</form>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.ui.view" id="printing_report_xml_action_tree">
|
|
||||||
<field name="name">printing.report.xml.action.tree</field>
|
<!-- printing.report.xml.action -->
|
||||||
<field name="model">printing.report.xml.action</field>
|
<record model="ir.ui.view" id="printing_report_xml_action_form">
|
||||||
<field name="type">tree</field>
|
<field name="name">printing.report.xml.action.form</field>
|
||||||
<field name="arch" type="xml">
|
<field name="model">printing.report.xml.action</field>
|
||||||
<tree string="Report Printing Actions">
|
<field name="arch" type="xml">
|
||||||
<field name="user_id"/>
|
<form string="Report Printing Actions">
|
||||||
<field name="action" />
|
<field name="user_id"/>
|
||||||
<field name="printer_id" />
|
<label string=""/>
|
||||||
</tree>
|
<field name="action"/>
|
||||||
</field>
|
<field name="printer_id" select="1"/>
|
||||||
</record>
|
</form>
|
||||||
</data>
|
</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="arch" type="xml">
|
||||||
|
<tree string="Report Printing Actions">
|
||||||
|
<field name="user_id"/>
|
||||||
|
<field name="action" />
|
||||||
|
<field name="printer_id" />
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|||||||
8
base_report_to_printer/security/security.xml
Executable file → Normal file
8
base_report_to_printer/security/security.xml
Executable file → Normal file
@@ -31,13 +31,7 @@
|
|||||||
<field eval="1" name="perm_create"/>
|
<field eval="1" name="perm_create"/>
|
||||||
<field name="group_id" ref="res_groups_printingprintoperator0"/>
|
<field name="group_id" ref="res_groups_printingprintoperator0"/>
|
||||||
</record>
|
</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>
|
||||||
<data>
|
<data>
|
||||||
<record id="ir_model_access_printingprinterall0" model="ir.model.access">
|
<record id="ir_model_access_printingprinterall0" model="ir.model.access">
|
||||||
|
|||||||
@@ -20,4 +20,4 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
import update_printers
|
from . import update_printers
|
||||||
|
|||||||
20
base_report_to_printer/wizard/update_printers.py
Executable file → Normal file
20
base_report_to_printer/wizard/update_printers.py
Executable file → Normal file
@@ -21,21 +21,16 @@
|
|||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import time
|
|
||||||
import subprocess
|
|
||||||
import cups
|
import cups
|
||||||
|
|
||||||
import netsvc
|
from openerp.osv import orm
|
||||||
from osv import fields
|
|
||||||
from osv import osv
|
|
||||||
from tools.translate import _
|
|
||||||
|
|
||||||
|
|
||||||
class printing_printer_update_wizard(osv.osv_memory):
|
class printing_printer_update_wizard(orm.TransientModel):
|
||||||
_name = "printing.printer.update.wizard"
|
_name = "printing.printer.update.wizard"
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
}
|
}
|
||||||
|
|
||||||
def action_cancel(self, cr, uid, ids, context=None):
|
def action_cancel(self, cr, uid, ids, context=None):
|
||||||
return {}
|
return {}
|
||||||
@@ -49,9 +44,9 @@ class printing_printer_update_wizard(osv.osv_memory):
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
ids = self.pool.get('printing.printer').search(cr, uid, [('system_name','in',printers.keys())], context=context)
|
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):
|
for printer in self.pool.get('printing.printer').browse(cr, uid, ids, context=context):
|
||||||
del printers[printer.system_name]
|
del printers[printer.system_name]
|
||||||
|
|
||||||
for name in printers:
|
for name in printers:
|
||||||
printer = printers[name]
|
printer = printers[name]
|
||||||
self.pool.get('printing.printer').create(cr, uid, {
|
self.pool.get('printing.printer').create(cr, uid, {
|
||||||
@@ -60,7 +55,7 @@ class printing_printer_update_wizard(osv.osv_memory):
|
|||||||
'model': printer.get('printer-make-and-model', False),
|
'model': printer.get('printer-make-and-model', False),
|
||||||
'location': printer.get('printer-location', False),
|
'location': printer.get('printer-location', False),
|
||||||
'uri': printer.get('device-uri', False),
|
'uri': printer.get('device-uri', False),
|
||||||
}, context)
|
}, context)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'name': 'Printers',
|
'name': 'Printers',
|
||||||
@@ -69,8 +64,7 @@ class printing_printer_update_wizard(osv.osv_memory):
|
|||||||
'res_model': 'printing.printer',
|
'res_model': 'printing.printer',
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
'target': 'current',
|
'target': 'current',
|
||||||
}
|
}
|
||||||
|
|
||||||
printing_printer_update_wizard()
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|||||||
@@ -1,26 +1,27 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
<openerp>
|
<openerp>
|
||||||
<data>
|
<data>
|
||||||
<record id="printer_update_wizard" model="ir.ui.view">
|
<record id="printer_update_wizard" model="ir.ui.view">
|
||||||
<field name="name">printing.printer.update.wizard</field>
|
<field name="name">printing.printer.update.wizard</field>
|
||||||
<field name="model">printing.printer.update.wizard</field>
|
<field name="model">printing.printer.update.wizard</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Update Printers from CUPS" col="2">
|
<form string="Update Printers from CUPS" col="2">
|
||||||
<label string="This process will create all missing printers from the current CUPS server." colspan="2"/>
|
<label string="This process will create all missing printers from the current CUPS server." colspan="2"/>
|
||||||
<separator string="" colspan="2"/>
|
<separator string="" colspan="2"/>
|
||||||
<button name="action_cancel" icon="gtk-cancel" string="Cancel" special="cancel"/>
|
<button name="action_cancel" icon="gtk-cancel" string="Cancel" special="cancel"/>
|
||||||
<button name="action_ok" type="object" icon="gtk-ok" string="Ok"/>
|
<button name="action_ok" type="object" icon="gtk-ok" string="Ok"/>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="action_printer_update_wizard" model="ir.actions.act_window">
|
<record id="action_printer_update_wizard" model="ir.actions.act_window">
|
||||||
<field name="name">Update Printers from CUPS</field>
|
<field name="name">Update Printers from CUPS</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
<field name="res_model">printing.printer.update.wizard</field>
|
<field name="res_model">printing.printer.update.wizard</field>
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
<field name="view_mode">form</field>
|
<field name="view_mode">form</field>
|
||||||
<field name="target">new</field>
|
<field name="target">new</field>
|
||||||
</record>
|
</record>
|
||||||
<menuitem action="action_printer_update_wizard" id="menu_printer_update_wizard" parent="menu_printing_config"/>
|
<menuitem action="action_printer_update_wizard" id="menu_printer_update_wizard" parent="menu_printing_main"/>
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|||||||
Reference in New Issue
Block a user