mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
base_calendar passed away
Migrate ir_report.py to new API Migrate printing.py to new API Migrate res_users.py to new API Migrate report_xml_action.py to new API Migrate wizard/update_printers.py to new API Better view for wizard Recursion when calling a method with old-style api signature from browse Remove the Lock because it is useless on multiprocess Replace it by a database lock so the different processes are all aware of the lock and the last update timestamp. browse is called often enough to call the update routine (even too much) Implements the print on the new 'report' model Restore the print capability on deprecated reports Update copyrights Improve form view, add search view for printers Update translations, add a string to URI so it is uppercased missing api decorator We need the report in print_document and print options (needed in printer_tray) Move the 'skip_update' right in the browse, it prevents a loop See https://github.com/odoo/odoo/issues/3644 Also, it helps to have the value set/read in context close to each other. Avoid to hits the database too many times to check if the list of printers needs to be refreshed. Keep the last update datetime in cache and invalidate this datetime if is is older than POLL_INTERVAL. Thus, one process won't hit the DB more than 1 time every POLL_INTERVAL (10 seconds currently) to check if it needs to update the list. Refresh the list of printers every 15 seconds instead of 10 Extract a method so it will be easier to override in printer_tray Error on installation of the module Invalidate the cache when the table is created so the table_exists() method returns a fresh value after creation of the table Use a cron instead of threads to update printers status The implementation with threads was blocking the loading of the server in multiprocess. Using a cron will lower the frequency of the updates but at least it is simple and reliable. Fixes #14 Do not write the printer status if it has not changed Avoid unnecessary UPDATE every minute Clean the XML file (remove eval, reindent) Give access to models to all users for reading So they are able to print
This commit is contained in:
committed by
Carlos Roca
parent
e3ba669b76
commit
84d395cf7c
50
base_report_to_printer/README.rst
Normal file
50
base_report_to_printer/README.rst
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
Report to printer
|
||||||
|
-----------------
|
||||||
|
This module allows users to send reports to a printer attached to the server.
|
||||||
|
|
||||||
|
|
||||||
|
It adds an optional behaviour on reports to send it directly to a printer.
|
||||||
|
|
||||||
|
* `Send to Client` is the default behavious providing you a downloadable PDF
|
||||||
|
* `Send to Printer` prints the report on selected printer
|
||||||
|
|
||||||
|
Report behaviour is defined by settings.
|
||||||
|
|
||||||
|
|
||||||
|
Settings can be configured:
|
||||||
|
|
||||||
|
* globaly
|
||||||
|
* per user
|
||||||
|
* per report
|
||||||
|
* per user and report
|
||||||
|
|
||||||
|
|
||||||
|
After installing enable the "Printing / Print Operator" option under access
|
||||||
|
rights to give users the ability to view the print menu.
|
||||||
|
|
||||||
|
|
||||||
|
To show all available printers for your server, uses
|
||||||
|
`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>
|
||||||
|
* Lionel Sausin <ls@numerigraphe.com>
|
||||||
|
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
|
||||||
30
base_report_to_printer/__init__.py
Normal file
30
base_report_to_printer/__init__.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# -*- 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>)
|
||||||
|
# Copyright (C) 2013-2014 Camptocamp (<http://www.camptocamp.com>)
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
from . import printing
|
||||||
|
from . import report
|
||||||
|
from . import report_xml_action
|
||||||
|
from . import report_service
|
||||||
|
from . import users
|
||||||
|
from . import ir_report
|
||||||
|
from . import wizard
|
||||||
46
base_report_to_printer/__openerp__.py
Normal file
46
base_report_to_printer/__openerp__.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# -*- 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>)
|
||||||
|
# Copyright (C) 2013-2014 Camptocamp (<http://www.camptocamp.com>)
|
||||||
|
#
|
||||||
|
# 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.1',
|
||||||
|
'category': 'Generic Modules/Base',
|
||||||
|
'author': 'Agile Business Group & Domsense, Pegueroles SCP, NaN',
|
||||||
|
'website': 'http://www.agilebg.com',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
"depends": ['base',
|
||||||
|
'report',
|
||||||
|
],
|
||||||
|
'data': [
|
||||||
|
'security/security.xml',
|
||||||
|
'printing_data.xml',
|
||||||
|
'printing_view.xml',
|
||||||
|
'wizard/update_printers.xml',
|
||||||
|
],
|
||||||
|
'installable': True,
|
||||||
|
'auto_install': False,
|
||||||
|
'application': True,
|
||||||
|
'external_dependencies': {
|
||||||
|
'python': ['cups']
|
||||||
|
}
|
||||||
|
}
|
||||||
272
base_report_to_printer/i18n/base_report_to_printer.pot
Normal file
272
base_report_to_printer/i18n/base_report_to_printer.pot
Normal file
@@ -0,0 +1,272 @@
|
|||||||
|
# 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: 2014-11-17 12:50+0000\n"
|
||||||
|
"Last-Translator: <>\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"Language: \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
|
||||||
|
#: 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:ir.actions.report.xml,printing_action_ids:0
|
||||||
|
msgid "Actions"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Available"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:printing.printer.update.wizard:base_report_to_printer.printer_update_wizard
|
||||||
|
msgid "Cancel"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.action,create_uid:0 field:printing.printer,create_uid:0
|
||||||
|
#: field:printing.printer.polling,create_uid:0
|
||||||
|
#: field:printing.printer.update.wizard,create_uid:0
|
||||||
|
#: field:printing.report.xml.action,create_uid:0
|
||||||
|
msgid "Created by"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.action,create_date:0 field:printing.printer,create_date:0
|
||||||
|
#: field:printing.printer.polling,create_date:0
|
||||||
|
#: field:printing.printer.update.wizard,create_date:0
|
||||||
|
#: field:printing.report.xml.action,create_date:0
|
||||||
|
msgid "Created on"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,default:0
|
||||||
|
msgid "Default"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:res.users,printing_printer_id:0
|
||||||
|
msgid "Default Printer"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Error"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.action,id:0 field:printing.printer,id:0
|
||||||
|
#: field:printing.printer.polling,id:0
|
||||||
|
#: field:printing.printer.update.wizard,id:0
|
||||||
|
#: field:printing.report.xml.action,id:0
|
||||||
|
msgid "ID"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.action,write_uid:0 field:printing.printer,write_uid:0
|
||||||
|
#: field:printing.printer.polling,write_uid:0
|
||||||
|
#: field:printing.printer.update.wizard,write_uid:0
|
||||||
|
#: field:printing.report.xml.action,write_uid:0
|
||||||
|
msgid "Last Updated by"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.action,write_date:0 field:printing.printer,write_date:0
|
||||||
|
#: field:printing.printer.polling,write_date:0
|
||||||
|
#: field:printing.printer.update.wizard,write_date:0
|
||||||
|
#: field:printing.report.xml.action,write_date:0
|
||||||
|
msgid "Last Updated on"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer.polling,last_update:0
|
||||||
|
msgid "Last update"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,location:0
|
||||||
|
msgid "Location"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,model:0
|
||||||
|
msgid "Model"
|
||||||
|
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:res.users:base_report_to_printer.view_printing_users_form
|
||||||
|
msgid "Preferences"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:ir.actions.report.xml:base_report_to_printer.action_report_xml_form
|
||||||
|
msgid "Print"
|
||||||
|
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: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.ui.menu,name:base_report_to_printer.menu_printing_printer_form
|
||||||
|
#: view:printing.printer:base_report_to_printer.view_printing_printer_form
|
||||||
|
#: view:printing.printer:base_report_to_printer.view_printing_printer_search
|
||||||
|
#: view:printing.printer:base_report_to_printer.view_printing_printer_tree
|
||||||
|
msgid "Printers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.model,name:base_report_to_printer.model_printing_printer_polling
|
||||||
|
msgid "Printers Polling"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_main
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
#: view:res.users:base_report_to_printer.view_printing_users_prefs
|
||||||
|
msgid "Printing"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. 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
|
||||||
|
#: field:res.users,printing_action:0
|
||||||
|
msgid "Printing action"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.model,name:base_report_to_printer.model_report
|
||||||
|
#: field:printing.report.xml.action,report_id:0
|
||||||
|
msgid "Report"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.model,name:base_report_to_printer.model_printing_report_xml_action
|
||||||
|
#: view:printing.report.xml.action:base_report_to_printer.printing_report_xml_action_form
|
||||||
|
#: view:printing.report.xml.action:base_report_to_printer.printing_report_xml_action_tree
|
||||||
|
msgid "Report Printing Actions"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_reports
|
||||||
|
msgid "Reports"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:ir.actions.report.xml:base_report_to_printer.action_report_xml_form
|
||||||
|
msgid "Security"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Server Error"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:printing.printer:base_report_to_printer.view_printing_printer_form
|
||||||
|
msgid "Set Default"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.actions.act_window,name:base_report_to_printer.action_printing_printer_form
|
||||||
|
msgid "Show Printers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:ir.actions.report.xml:base_report_to_printer.action_report_xml_form
|
||||||
|
msgid "Specific actions per user"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,status:0
|
||||||
|
msgid "Status"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,status_message:0
|
||||||
|
msgid "Status message"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,system_name:0
|
||||||
|
msgid "System name"
|
||||||
|
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
|
||||||
|
#: view:printing.printer.update.wizard:base_report_to_printer.printer_update_wizard
|
||||||
|
msgid ""
|
||||||
|
"This process will create all the missing printers from the current CUPS "
|
||||||
|
"server."
|
||||||
|
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 "Unavailable"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Unknown"
|
||||||
|
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:base_report_to_printer.printer_update_wizard
|
||||||
|
msgid "Update Printers from CUPS"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,uri:0
|
||||||
|
msgid "URI"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.report.xml.action,user_id:0
|
||||||
|
msgid "User"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.model,name:base_report_to_printer.model_res_users
|
||||||
|
msgid "Users"
|
||||||
|
msgstr ""
|
||||||
276
base_report_to_printer/i18n/fr.po
Normal file
276
base_report_to_printer/i18n/fr.po
Normal file
@@ -0,0 +1,276 @@
|
|||||||
|
# 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: 2014-02-25 15:06+0000\n"
|
||||||
|
"Last-Translator: Guewen Baconnier @ Camptocamp <Unknown>\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Launchpad-Export-Date: 2014-05-06 07:28+0000\n"
|
||||||
|
"X-Generator: Launchpad (build 16996)\n"
|
||||||
|
|
||||||
|
#. 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
|
||||||
|
#: field:ir.actions.report.xml,printing_action_ids:0
|
||||||
|
msgid "Actions"
|
||||||
|
msgstr "Actions"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Available"
|
||||||
|
msgstr "Disponible"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:printing.printer.update.wizard:base_report_to_printer.printer_update_wizard
|
||||||
|
msgid "Cancel"
|
||||||
|
msgstr "Annuler"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.action,create_uid:0 field:printing.printer,create_uid:0
|
||||||
|
#: field:printing.printer.polling,create_uid:0
|
||||||
|
#: field:printing.printer.update.wizard,create_uid:0
|
||||||
|
#: field:printing.report.xml.action,create_uid:0
|
||||||
|
msgid "Created by"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.action,create_date:0 field:printing.printer,create_date:0
|
||||||
|
#: field:printing.printer.polling,create_date:0
|
||||||
|
#: field:printing.printer.update.wizard,create_date:0
|
||||||
|
#: field:printing.report.xml.action,create_date:0
|
||||||
|
msgid "Created on"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,default:0
|
||||||
|
msgid "Default"
|
||||||
|
msgstr "Par défaut"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:res.users,printing_printer_id:0
|
||||||
|
msgid "Default Printer"
|
||||||
|
msgstr "Imprimante par défaut"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Error"
|
||||||
|
msgstr "Erreur"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.action,id:0 field:printing.printer,id:0
|
||||||
|
#: field:printing.printer.polling,id:0
|
||||||
|
#: field:printing.printer.update.wizard,id:0
|
||||||
|
#: field:printing.report.xml.action,id:0
|
||||||
|
msgid "ID"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.action,write_uid:0 field:printing.printer,write_uid:0
|
||||||
|
#: field:printing.printer.polling,write_uid:0
|
||||||
|
#: field:printing.printer.update.wizard,write_uid:0
|
||||||
|
#: field:printing.report.xml.action,write_uid:0
|
||||||
|
msgid "Last Updated by"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.action,write_date:0 field:printing.printer,write_date:0
|
||||||
|
#: field:printing.printer.polling,write_date:0
|
||||||
|
#: field:printing.printer.update.wizard,write_date:0
|
||||||
|
#: field:printing.report.xml.action,write_date:0
|
||||||
|
msgid "Last Updated on"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer.polling,last_update:0
|
||||||
|
msgid "Last update"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,location:0
|
||||||
|
msgid "Location"
|
||||||
|
msgstr "Emplacement"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,model:0
|
||||||
|
msgid "Model"
|
||||||
|
msgstr "Modèle"
|
||||||
|
|
||||||
|
#. 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:res.users:base_report_to_printer.view_printing_users_form
|
||||||
|
msgid "Preferences"
|
||||||
|
msgstr "Préférences"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:ir.actions.report.xml:base_report_to_printer.action_report_xml_form
|
||||||
|
msgid "Print"
|
||||||
|
msgstr "Imprimer"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.model,name:base_report_to_printer.model_printing_action
|
||||||
|
msgid "Print Job Action"
|
||||||
|
msgstr "Action d'impression"
|
||||||
|
|
||||||
|
#. 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.ui.menu,name:base_report_to_printer.menu_printing_printer_form
|
||||||
|
#: view:printing.printer:base_report_to_printer.view_printing_printer_form
|
||||||
|
#: view:printing.printer:base_report_to_printer.view_printing_printer_search
|
||||||
|
#: view:printing.printer:base_report_to_printer.view_printing_printer_tree
|
||||||
|
msgid "Printers"
|
||||||
|
msgstr "Imprimantes"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.model,name:base_report_to_printer.model_printing_printer_polling
|
||||||
|
msgid "Printers Polling"
|
||||||
|
msgstr "Recherche d'imprimantes"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_main
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
#: view:res.users:base_report_to_printer.view_printing_users_prefs
|
||||||
|
msgid "Printing"
|
||||||
|
msgstr "Impression en cours"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:res.groups,name:base_report_to_printer.res_groups_printingprintoperator0
|
||||||
|
msgid "Printing / Print Operator"
|
||||||
|
msgstr "Opérateur d'impression"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:res.users,printing_action:0
|
||||||
|
msgid "Printing action"
|
||||||
|
msgstr "Action d'impression"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.model,name:base_report_to_printer.model_report
|
||||||
|
#: field:printing.report.xml.action,report_id:0
|
||||||
|
msgid "Report"
|
||||||
|
msgstr "Rapport"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.model,name:base_report_to_printer.model_printing_report_xml_action
|
||||||
|
#: view:printing.report.xml.action:base_report_to_printer.printing_report_xml_action_form
|
||||||
|
#: view:printing.report.xml.action:base_report_to_printer.printing_report_xml_action_tree
|
||||||
|
msgid "Report Printing Actions"
|
||||||
|
msgstr "Actions d'impression de rapports"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.ui.menu,name:base_report_to_printer.menu_printing_reports
|
||||||
|
msgid "Reports"
|
||||||
|
msgstr "Rapport"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:ir.actions.report.xml:base_report_to_printer.action_report_xml_form
|
||||||
|
msgid "Security"
|
||||||
|
msgstr "Sécurité"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Server Error"
|
||||||
|
msgstr "Erreur serveur"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:printing.printer:base_report_to_printer.view_printing_printer_form
|
||||||
|
msgid "Set Default"
|
||||||
|
msgstr "Définir par défaut"
|
||||||
|
|
||||||
|
#. 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:ir.actions.report.xml:base_report_to_printer.action_report_xml_form
|
||||||
|
msgid "Specific actions per user"
|
||||||
|
msgstr "Action spécifique par utilisateur"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,status:0
|
||||||
|
msgid "Status"
|
||||||
|
msgstr "État"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,status_message:0
|
||||||
|
msgid "Status message"
|
||||||
|
msgstr "Message d'état"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,system_name:0
|
||||||
|
msgid "System name"
|
||||||
|
msgstr "Nom système"
|
||||||
|
|
||||||
|
#. 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 actions et les imprimantes par utilisateur"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:printing.printer.update.wizard:base_report_to_printer.printer_update_wizard
|
||||||
|
msgid ""
|
||||||
|
"This process will create all the missing printers from the current CUPS "
|
||||||
|
"server."
|
||||||
|
msgstr ""
|
||||||
|
"Cette opération va créer les imprimantes manquantes à partir du serveur CUPS "
|
||||||
|
"courant."
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.action,type:0
|
||||||
|
msgid "Type"
|
||||||
|
msgstr "Type"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Unavailable"
|
||||||
|
msgstr "Non disponible"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: selection:printing.printer,status:0
|
||||||
|
msgid "Unknown"
|
||||||
|
msgstr "Inconnu"
|
||||||
|
|
||||||
|
#. 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:base_report_to_printer.printer_update_wizard
|
||||||
|
msgid "Update Printers from CUPS"
|
||||||
|
msgstr "Mettre à jour les imprimantes depuis CUPS"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,uri:0
|
||||||
|
msgid "URI"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.report.xml.action,user_id:0
|
||||||
|
msgid "User"
|
||||||
|
msgstr "Utilisateur"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.model,name:base_report_to_printer.model_res_users
|
||||||
|
msgid "Users"
|
||||||
|
msgstr "Utilisateurs"
|
||||||
230
base_report_to_printer/i18n/it.po
Normal file
230
base_report_to_printer/i18n/it.po
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
# 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: 2014-02-25 15:09+0000\n"
|
||||||
|
"Last-Translator: Yannick Vaucher @ Camptocamp <Unknown>\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Launchpad-Export-Date: 2014-05-06 07:28+0000\n"
|
||||||
|
"X-Generator: Launchpad (build 16996)\n"
|
||||||
|
|
||||||
|
#. 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,system_name:0
|
||||||
|
msgid "System Name"
|
||||||
|
msgstr "Nome di sistema"
|
||||||
|
|
||||||
|
#. 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
|
||||||
|
#: view:ir.actions.report.xml:0
|
||||||
|
msgid "Print"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:res.users,printing_action:0
|
||||||
|
msgid "Printing Action"
|
||||||
|
msgstr "Azione di stampa"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.action,type:0
|
||||||
|
msgid "Type"
|
||||||
|
msgstr "Tipo"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: field:printing.printer,model:0
|
||||||
|
msgid "Model"
|
||||||
|
msgstr "Model"
|
||||||
|
|
||||||
|
#. 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_res_users
|
||||||
|
msgid "Users"
|
||||||
|
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 "Azioni di stampa report"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: view:ir.actions.report.xml:0
|
||||||
|
msgid "Specific actions per user"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. 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
|
||||||
|
#: field:printing.printer,status:0
|
||||||
|
msgid "Status"
|
||||||
|
msgstr "Stato"
|
||||||
|
|
||||||
|
#. module: base_report_to_printer
|
||||||
|
#: model:ir.actions.act_window,name:base_report_to_printer.action_printing_printer_form
|
||||||
|
msgid "Show Printers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. 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.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
|
||||||
|
#: view:ir.actions.report.xml:0
|
||||||
|
msgid "Security"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. 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.printer.update.wizard:0
|
||||||
|
msgid "Cancel"
|
||||||
|
msgstr "Annulla"
|
||||||
|
|
||||||
|
#. 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:190
|
||||||
|
#, python-format
|
||||||
|
msgid "Use user's defaults"
|
||||||
|
msgstr "Utilizza i default dell'utente"
|
||||||
98
base_report_to_printer/ir_report.py
Normal file
98
base_report_to_printer/ir_report.py
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
# -*- 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>)
|
||||||
|
# Copyright (C) 2013-2014 Camptocamp (<http://www.camptocamp.com>)
|
||||||
|
#
|
||||||
|
# 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 logging
|
||||||
|
|
||||||
|
from openerp import models, fields, api
|
||||||
|
|
||||||
|
_logger = logging.getLogger('base_report_to_printer')
|
||||||
|
|
||||||
|
|
||||||
|
class ReportXml(models.Model):
|
||||||
|
"""
|
||||||
|
Reports
|
||||||
|
"""
|
||||||
|
|
||||||
|
_inherit = 'ir.actions.report.xml'
|
||||||
|
|
||||||
|
property_printing_action = fields.Many2one(
|
||||||
|
comodel_name='printing.action',
|
||||||
|
string='Action',
|
||||||
|
company_dependent=True,
|
||||||
|
)
|
||||||
|
printing_printer_id = fields.Many2one(
|
||||||
|
comodel_name='printing.printer',
|
||||||
|
string='Printer'
|
||||||
|
)
|
||||||
|
printing_action_ids = fields.One2many(
|
||||||
|
comodel_name='printing.report.xml.action',
|
||||||
|
inverse_name='report_id',
|
||||||
|
string='Actions',
|
||||||
|
help='This field allows configuring action and printer on a per '
|
||||||
|
'user basis'
|
||||||
|
)
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def behaviour(self):
|
||||||
|
result = {}
|
||||||
|
printer_obj = self.env['printing.printer']
|
||||||
|
printing_act_obj = self.env['printing.report.xml.action']
|
||||||
|
# Set hardcoded default action
|
||||||
|
default_action = 'client'
|
||||||
|
# Retrieve system wide printer
|
||||||
|
default_printer = printer_obj.get_default()
|
||||||
|
|
||||||
|
# Retrieve user default values
|
||||||
|
user = self.env.user
|
||||||
|
if user.printing_action:
|
||||||
|
default_action = user.printing_action
|
||||||
|
if user.printing_printer_id:
|
||||||
|
default_printer = user.printing_printer_id
|
||||||
|
|
||||||
|
for report in self:
|
||||||
|
action = default_action
|
||||||
|
printer = default_printer
|
||||||
|
|
||||||
|
# Retrieve report default values
|
||||||
|
report_action = report.property_printing_action
|
||||||
|
if report_action and report_action.type != 'user_default':
|
||||||
|
action = report_action.type
|
||||||
|
if report.printing_printer_id:
|
||||||
|
printer = report.printing_printer_id
|
||||||
|
|
||||||
|
# Retrieve report-user specific values
|
||||||
|
print_action = printing_act_obj.search(
|
||||||
|
[('report_id', '=', report.id),
|
||||||
|
('user_id', '=', self.env.uid),
|
||||||
|
('action', '!=', 'user_default')],
|
||||||
|
limit=1)
|
||||||
|
if print_action:
|
||||||
|
user_action = print_action.behaviour()
|
||||||
|
action = user_action['action']
|
||||||
|
if user_action['printer']:
|
||||||
|
printer = user_action['printer']
|
||||||
|
|
||||||
|
result[report.id] = {'action': action,
|
||||||
|
'printer': printer,
|
||||||
|
}
|
||||||
|
return result
|
||||||
172
base_report_to_printer/printing.py
Normal file
172
base_report_to_printer/printing.py
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
# -*- 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>)
|
||||||
|
# Copyright (C) 2013-2014 Camptocamp (<http://www.camptocamp.com>)
|
||||||
|
#
|
||||||
|
# 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 logging
|
||||||
|
import os
|
||||||
|
|
||||||
|
from tempfile import mkstemp
|
||||||
|
|
||||||
|
import cups
|
||||||
|
|
||||||
|
from openerp import models, fields, api
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class PrintingPrinter(models.Model):
|
||||||
|
"""
|
||||||
|
Printers
|
||||||
|
"""
|
||||||
|
|
||||||
|
_name = 'printing.printer'
|
||||||
|
_description = 'Printer'
|
||||||
|
_order = 'name'
|
||||||
|
|
||||||
|
name = fields.Char(required=True, select=True)
|
||||||
|
system_name = fields.Char(required=True, select=True)
|
||||||
|
default = fields.Boolean(readonly=True)
|
||||||
|
status = fields.Selection([('unavailable', 'Unavailable'),
|
||||||
|
('printing', 'Printing'),
|
||||||
|
('unknown', 'Unknown'),
|
||||||
|
('available', 'Available'),
|
||||||
|
('error', 'Error'),
|
||||||
|
('server-error', 'Server Error')],
|
||||||
|
required=True,
|
||||||
|
readonly=True,
|
||||||
|
default='unknown')
|
||||||
|
status_message = fields.Char(readonly=True)
|
||||||
|
model = fields.Char(readonly=True)
|
||||||
|
location = fields.Char(readonly=True)
|
||||||
|
uri = fields.Char(string='URI', readonly=True)
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def update_printers_status(self):
|
||||||
|
printer_recs = self.search([])
|
||||||
|
try:
|
||||||
|
connection = cups.Connection()
|
||||||
|
printers = connection.getPrinters()
|
||||||
|
except:
|
||||||
|
printer_recs.write({'status': 'server-error'})
|
||||||
|
else:
|
||||||
|
for printer in printer_recs:
|
||||||
|
cups_printer = printers.get(printer.system_name)
|
||||||
|
if cups_printer:
|
||||||
|
printer.update_from_cups(connection, cups_printer)
|
||||||
|
else:
|
||||||
|
# not in cups list
|
||||||
|
printer.status = 'unavailable'
|
||||||
|
return True
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def _prepare_update_from_cups(self, cups_connection, cups_printer):
|
||||||
|
mapping = {
|
||||||
|
3: 'available',
|
||||||
|
4: 'printing',
|
||||||
|
5: 'error'
|
||||||
|
}
|
||||||
|
vals = {
|
||||||
|
'model': cups_printer.get('printer-make-and-model', False),
|
||||||
|
'location': cups_printer.get('printer-location', False),
|
||||||
|
'uri': cups_printer.get('device-uri', False),
|
||||||
|
'status': mapping.get(cups_printer['printer-state'], 'unknown'),
|
||||||
|
}
|
||||||
|
return vals
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def update_from_cups(self, cups_connection, cups_printer):
|
||||||
|
""" Update a printer from the information returned by cups.
|
||||||
|
|
||||||
|
:param cups_connection: connection to CUPS, may be used when the
|
||||||
|
method is overriden (e.g. in printer_tray)
|
||||||
|
:param cups_printer: dict of information returned by CUPS for the
|
||||||
|
current printer
|
||||||
|
"""
|
||||||
|
self.ensure_one()
|
||||||
|
vals = self._prepare_update_from_cups(cups_connection, cups_printer)
|
||||||
|
if any(self[name] != value for name, value in vals.iteritems()):
|
||||||
|
self.write(vals)
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def print_options(self, report, format):
|
||||||
|
""" Hook to set print options """
|
||||||
|
options = {}
|
||||||
|
if format == 'raw':
|
||||||
|
options['raw'] = True
|
||||||
|
return options
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def print_document(self, report, content, format):
|
||||||
|
""" Print a file
|
||||||
|
|
||||||
|
Format could be pdf, qweb-pdf, raw, ...
|
||||||
|
|
||||||
|
"""
|
||||||
|
self.ensure_one()
|
||||||
|
fd, file_name = mkstemp()
|
||||||
|
try:
|
||||||
|
os.write(fd, content)
|
||||||
|
finally:
|
||||||
|
os.close(fd)
|
||||||
|
connection = cups.Connection()
|
||||||
|
|
||||||
|
options = self.print_options(report, format)
|
||||||
|
|
||||||
|
connection.printFile(self.system_name,
|
||||||
|
file_name,
|
||||||
|
file_name,
|
||||||
|
options=options)
|
||||||
|
_logger.info("Printing job: '%s'" % file_name)
|
||||||
|
return True
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def set_default(self):
|
||||||
|
if not self:
|
||||||
|
return
|
||||||
|
self.ensure_one()
|
||||||
|
default_printers = self.search([('default', '=', True)])
|
||||||
|
default_printers.write({'default': False})
|
||||||
|
self.write({'default': True})
|
||||||
|
return True
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def get_default(self):
|
||||||
|
return self.search([('default', '=', True)], limit=1)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Actions
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
def _available_action_types(self):
|
||||||
|
return [('server', 'Send to Printer'),
|
||||||
|
('client', 'Send to Client'),
|
||||||
|
('user_default', "Use user's defaults"),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class PrintingAction(models.Model):
|
||||||
|
_name = 'printing.action'
|
||||||
|
_description = 'Print Job Action'
|
||||||
|
|
||||||
|
name = fields.Char(required=True)
|
||||||
|
type = fields.Selection(_available_action_types, required=True)
|
||||||
34
base_report_to_printer/printing_data.xml
Normal file
34
base_report_to_printer/printing_data.xml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<openerp>
|
||||||
|
<data noupdate="1">
|
||||||
|
<!-- 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>
|
||||||
|
|
||||||
|
<record forcecreate="True" id="ir_cron_update_printers" model="ir.cron">
|
||||||
|
<field name="name">Update Printers Status</field>
|
||||||
|
<field eval="True" name="active"/>
|
||||||
|
<field name="user_id" ref="base.user_root"/>
|
||||||
|
<field name="interval_number">1</field>
|
||||||
|
<field name="interval_type">minutes</field>
|
||||||
|
<field name="numbercall">-1</field>
|
||||||
|
<field eval="False" name="doall"/>
|
||||||
|
<field eval="'printing.printer'" name="model"/>
|
||||||
|
<field eval="'update_printers_status'" name="function"/>
|
||||||
|
<field eval="'()'" name="args"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
158
base_report_to_printer/printing_view.xml
Normal file
158
base_report_to_printer/printing_view.xml
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<menuitem name="Printing" id="menu_printing_main" parent="base.menu_administration" groups="res_groups_printingprintoperator0"/>
|
||||||
|
|
||||||
|
<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="arch" type="xml">
|
||||||
|
<form string="Printers">
|
||||||
|
<sheet>
|
||||||
|
<div class="oe_title">
|
||||||
|
<h1>
|
||||||
|
<label for="name"/>
|
||||||
|
<field name="name"/>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
<group>
|
||||||
|
<field name="system_name"/>
|
||||||
|
</group>
|
||||||
|
<group col="3" colspan="4">
|
||||||
|
<field name="default"/>
|
||||||
|
<button name="set_default" string="Set Default" type="object"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="uri"/>
|
||||||
|
<field name="model"/>
|
||||||
|
<field name="location"/>
|
||||||
|
<field name="status"/>
|
||||||
|
<field name="status_message"/>
|
||||||
|
</group>
|
||||||
|
</sheet>
|
||||||
|
</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="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.ui.view" id="view_printing_printer_search">
|
||||||
|
<field name="name">printing.printer.search</field>
|
||||||
|
<field name="model">printing.printer</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search string="Printers">
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="system_name"/>
|
||||||
|
<field name="location"/>
|
||||||
|
<field name="status"/>
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="action_printing_printer_form">
|
||||||
|
<field name="name">Show Printers</field>
|
||||||
|
<field name="type">ir.actions.act_window</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_main"
|
||||||
|
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="inherit_id" ref="base.act_report_xml_view" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<page string="Security" position="after">
|
||||||
|
<page string="Print">
|
||||||
|
<group>
|
||||||
|
<field name="property_printing_action"/>
|
||||||
|
<field name="printing_printer_id"/>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<separator string="Specific actions per user"/>
|
||||||
|
<field name="printing_action_ids"/>
|
||||||
|
</page>
|
||||||
|
</page>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- res.users -->
|
||||||
|
<record model="ir.ui.view" id="view_printing_users_form">
|
||||||
|
<field name="name">res.users.form.printing</field>
|
||||||
|
<field name="model">res.users</field>
|
||||||
|
<field name="inherit_id" ref="base.view_users_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<page string="Preferences">
|
||||||
|
<group name="printing">
|
||||||
|
<field name="printing_action"/>
|
||||||
|
<field name="printing_printer_id"/>
|
||||||
|
</group>
|
||||||
|
</page>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- "My Preferences -->
|
||||||
|
<record model="ir.ui.view" id="view_printing_users_prefs">
|
||||||
|
<field name="name">res.users.form.printing</field>
|
||||||
|
<field name="model">res.users</field>
|
||||||
|
<field name="inherit_id" ref="base.view_users_form_simple_modif" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<footer position="before">
|
||||||
|
<group string="Printing" name="printing">
|
||||||
|
<field name="printing_action"/>
|
||||||
|
<field name="printing_printer_id"/>
|
||||||
|
</group>
|
||||||
|
</footer>
|
||||||
|
</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="arch" type="xml">
|
||||||
|
<form string="Report Printing Actions">
|
||||||
|
<group col="2">
|
||||||
|
<field name="user_id"/>
|
||||||
|
<field name="action"/>
|
||||||
|
<field name="printer_id" select="1"/>
|
||||||
|
</group>
|
||||||
|
</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="arch" type="xml">
|
||||||
|
<tree string="Report Printing Actions">
|
||||||
|
<field name="user_id"/>
|
||||||
|
<field name="action" />
|
||||||
|
<field name="printer_id" />
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- Add a shorcut to "Actions/Report" in the Printing menu -->
|
||||||
|
<menuitem id="menu_printing_reports"
|
||||||
|
parent="menu_printing_main"
|
||||||
|
action="base.ir_action_report_xml"/>
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
39
base_report_to_printer/report.py
Normal file
39
base_report_to_printer/report.py
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Author: Guewen Baconnier
|
||||||
|
# Copyright 2014 Camptocamp SA
|
||||||
|
#
|
||||||
|
# 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 Affero 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/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
from openerp import models
|
||||||
|
|
||||||
|
|
||||||
|
class Report(models.Model):
|
||||||
|
_inherit = 'report'
|
||||||
|
|
||||||
|
def get_pdf(self, cr, uid, ids, report_name, html=None,
|
||||||
|
data=None, context=None):
|
||||||
|
result = super(Report, self).get_pdf(cr, uid, ids, report_name,
|
||||||
|
html=html, data=data,
|
||||||
|
context=context)
|
||||||
|
report = self._get_report_from_name(cr, uid, report_name)
|
||||||
|
data = report.behaviour()[report.id]
|
||||||
|
action = data['action']
|
||||||
|
printer = data['printer']
|
||||||
|
if action != 'client' and result:
|
||||||
|
printer.print_document(report, result, report.report_type)
|
||||||
|
return result
|
||||||
86
base_report_to_printer/report_service.py
Normal file
86
base_report_to_printer/report_service.py
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
# -*- 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>)
|
||||||
|
# Copyright (C) 2013-2014 Camptocamp (<http://www.camptocamp.com>)
|
||||||
|
#
|
||||||
|
# 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 openerp
|
||||||
|
|
||||||
|
from openerp.service.report import self_reports
|
||||||
|
|
||||||
|
original_exp_report = openerp.service.report.exp_report
|
||||||
|
|
||||||
|
|
||||||
|
def exp_report(db, uid, object, ids, datas=None, context=None):
|
||||||
|
""" Export Report """
|
||||||
|
# We can't use the named args because a monkey patch in 'calendar'
|
||||||
|
# doesn't use them and use a different name for 'datas'
|
||||||
|
res = original_exp_report(db, uid, object, ids, datas, context)
|
||||||
|
self_reports[res]['report_name'] = object
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
openerp.service.report.exp_report = exp_report
|
||||||
|
|
||||||
|
|
||||||
|
original_exp_report_get = openerp.service.report.exp_report_get
|
||||||
|
|
||||||
|
|
||||||
|
def exp_report_get(db, uid, report_id):
|
||||||
|
registry = openerp.registry(db)
|
||||||
|
cr = registry.cursor()
|
||||||
|
try:
|
||||||
|
# First of all load report defaults: name, action and printer
|
||||||
|
report_obj = registry['ir.actions.report.xml']
|
||||||
|
report_name = self_reports[report_id]['report_name']
|
||||||
|
report = report_obj.search(cr, uid,
|
||||||
|
[('report_name', '=', report_name)])
|
||||||
|
if report:
|
||||||
|
report = report_obj.browse(cr, uid, report[0])
|
||||||
|
data = report.behaviour()[report.id]
|
||||||
|
action = data['action']
|
||||||
|
printer = data['printer']
|
||||||
|
if action != 'client':
|
||||||
|
if (self_reports and self_reports.get(report_id)
|
||||||
|
and self_reports[report_id].get('result')
|
||||||
|
and self_reports[report_id].get('format')):
|
||||||
|
printer.print_document(report,
|
||||||
|
self_reports[report_id]['result'],
|
||||||
|
self_reports[report_id]['format'])
|
||||||
|
# FIXME "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
|
||||||
|
# prints
|
||||||
|
# raise osv.except_osv(
|
||||||
|
# _('Printing...'),
|
||||||
|
# _('Document sent to printer %s') % (printer,))
|
||||||
|
|
||||||
|
except:
|
||||||
|
cr.rollback()
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
cr.close()
|
||||||
|
|
||||||
|
return original_exp_report_get(db, uid, report_id)
|
||||||
|
|
||||||
|
|
||||||
|
openerp.service.report.exp_report_get = exp_report_get
|
||||||
52
base_report_to_printer/report_xml_action.py
Normal file
52
base_report_to_printer/report_xml_action.py
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# -*- 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>)
|
||||||
|
# Copyright (C) 2013-2014 Camptocamp (<http://www.camptocamp.com>)
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
from openerp import models, fields, api
|
||||||
|
|
||||||
|
from .printing import _available_action_types
|
||||||
|
|
||||||
|
|
||||||
|
class ReportXmlAction(models.Model):
|
||||||
|
_name = 'printing.report.xml.action'
|
||||||
|
_description = 'Report Printing Actions'
|
||||||
|
|
||||||
|
report_id = fields.Many2one(comodel_name='ir.actions.report.xml',
|
||||||
|
string='Report',
|
||||||
|
required=True,
|
||||||
|
ondelete='cascade')
|
||||||
|
user_id = fields.Many2one(comodel_name='res.users',
|
||||||
|
string='User',
|
||||||
|
required=True,
|
||||||
|
ondelete='cascade')
|
||||||
|
action = fields.Selection(_available_action_types,
|
||||||
|
required=True)
|
||||||
|
printer_id = fields.Many2one(comodel_name='printing.printer',
|
||||||
|
string='Printer')
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def behaviour(self):
|
||||||
|
if not self:
|
||||||
|
return {}
|
||||||
|
return {'action': self.action,
|
||||||
|
'printer': self.printer_id,
|
||||||
|
}
|
||||||
62
base_report_to_printer/security/security.xml
Normal file
62
base_report_to_printer/security/security.xml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" ?>
|
||||||
|
<openerp>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="res_groups_printingprintoperator0" model="res.groups">
|
||||||
|
<field name="name">Printing / Print Operator</field>
|
||||||
|
</record>
|
||||||
|
<record id="ir_model_access_printingprintergroup1" model="ir.model.access">
|
||||||
|
<field name="name">printing_printer group</field>
|
||||||
|
<field name="model_id" ref="model_printing_printer"/>
|
||||||
|
<field name="group_id" ref="res_groups_printingprintoperator0"/>
|
||||||
|
<field eval="1" name="perm_read"/>
|
||||||
|
<field eval="1" name="perm_unlink"/>
|
||||||
|
<field eval="1" name="perm_write"/>
|
||||||
|
<field eval="1" name="perm_create"/>
|
||||||
|
</record>
|
||||||
|
<record id="ir_model_access_printing_action" model="ir.model.access">
|
||||||
|
<field name="name">printing_printer group</field>
|
||||||
|
<field name="model_id" ref="model_printing_action"/>
|
||||||
|
<field name="group_id" ref="res_groups_printingprintoperator0"/>
|
||||||
|
<field eval="1" name="perm_read"/>
|
||||||
|
<field eval="1" name="perm_unlink"/>
|
||||||
|
<field eval="1" name="perm_write"/>
|
||||||
|
<field eval="1" name="perm_create"/>
|
||||||
|
</record>
|
||||||
|
<record id="ir_model_access_printingreportxmlaction" model="ir.model.access">
|
||||||
|
<field name="name">printing_printer group</field>
|
||||||
|
<field name="model_id" ref="model_printing_report_xml_action"/>
|
||||||
|
<field name="group_id" ref="res_groups_printingprintoperator0"/>
|
||||||
|
<field eval="1" name="perm_read"/>
|
||||||
|
<field eval="1" name="perm_unlink"/>
|
||||||
|
<field eval="1" name="perm_write"/>
|
||||||
|
<field eval="1" name="perm_create"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<record id="ir_model_access_printingprinterall0" model="ir.model.access">
|
||||||
|
<field name="name">printing_printer all</field>
|
||||||
|
<field name="model_id" ref="model_printing_printer"/>
|
||||||
|
<field eval="1" name="perm_read"/>
|
||||||
|
<field eval="0" name="perm_unlink"/>
|
||||||
|
<field eval="0" name="perm_write"/>
|
||||||
|
<field eval="0" name="perm_create"/>
|
||||||
|
</record>
|
||||||
|
<record id="ir_model_access_printing_action_all0" model="ir.model.access">
|
||||||
|
<field name="name">printing_action all</field>
|
||||||
|
<field name="model_id" ref="model_printing_action"/>
|
||||||
|
<field eval="1" name="perm_read"/>
|
||||||
|
<field eval="0" name="perm_unlink"/>
|
||||||
|
<field eval="0" name="perm_write"/>
|
||||||
|
<field eval="0" name="perm_create"/>
|
||||||
|
</record>
|
||||||
|
<record id="ir_model_access_printing_report_xml_action_all0" model="ir.model.access">
|
||||||
|
<field name="name">printing_report_xml_action all</field>
|
||||||
|
<field name="model_id" ref="model_printing_report_xml_action"/>
|
||||||
|
<field eval="1" name="perm_read"/>
|
||||||
|
<field eval="0" name="perm_unlink"/>
|
||||||
|
<field eval="0" name="perm_write"/>
|
||||||
|
<field eval="0" name="perm_create"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
43
base_report_to_printer/users.py
Normal file
43
base_report_to_printer/users.py
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# -*- 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>)
|
||||||
|
# Copyright (C) 2013-2014 Camptocamp (<http://www.camptocamp.com>)
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
from openerp import models, fields
|
||||||
|
|
||||||
|
from .printing import _available_action_types
|
||||||
|
|
||||||
|
|
||||||
|
class res_users(models.Model):
|
||||||
|
"""
|
||||||
|
Users
|
||||||
|
"""
|
||||||
|
_name = 'res.users'
|
||||||
|
_inherit = 'res.users'
|
||||||
|
|
||||||
|
def _user_available_action_types(self):
|
||||||
|
return [(code, string) for code, string
|
||||||
|
in _available_action_types(self)
|
||||||
|
if code != 'user_default']
|
||||||
|
|
||||||
|
printing_action = fields.Selection(_user_available_action_types)
|
||||||
|
printing_printer_id = fields.Many2one(comodel_name='printing.printer',
|
||||||
|
string='Default Printer')
|
||||||
22
base_report_to_printer/wizard/__init__.py
Normal file
22
base_report_to_printer/wizard/__init__.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# -*- 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>)
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
from . import update_printers
|
||||||
66
base_report_to_printer/wizard/update_printers.py
Normal file
66
base_report_to_printer/wizard/update_printers.py
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
# -*- 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>)
|
||||||
|
# Copyright (C) 2014 Camptocamp SA (<http://www.camptocamp.com>)
|
||||||
|
#
|
||||||
|
# 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 cups
|
||||||
|
|
||||||
|
from openerp import models, api
|
||||||
|
|
||||||
|
|
||||||
|
class PrintingPrinterUpdateWizard(models.TransientModel):
|
||||||
|
_name = 'printing.printer.update.wizard'
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def action_ok(self):
|
||||||
|
self.ensure_one()
|
||||||
|
# Update Printers
|
||||||
|
printer_obj = self.env['printing.printer']
|
||||||
|
try:
|
||||||
|
connection = cups.Connection()
|
||||||
|
printers = connection.getPrinters()
|
||||||
|
except:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
printer_recs = printer_obj.search(
|
||||||
|
[('system_name', 'in', printers.keys())]
|
||||||
|
)
|
||||||
|
for printer in printer_recs:
|
||||||
|
del printers[printer.system_name]
|
||||||
|
|
||||||
|
for name, printer in printers.iteritems():
|
||||||
|
values = {
|
||||||
|
'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),
|
||||||
|
}
|
||||||
|
self.env['printing.printer'].create(values)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'name': 'Printers',
|
||||||
|
'view_type': 'form',
|
||||||
|
'view_mode': 'tree,form',
|
||||||
|
'res_model': 'printing.printer',
|
||||||
|
'type': 'ir.actions.act_window',
|
||||||
|
'target': 'current',
|
||||||
|
}
|
||||||
28
base_report_to_printer/wizard/update_printers.xml
Normal file
28
base_report_to_printer/wizard/update_printers.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<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="arch" type="xml">
|
||||||
|
<form string="Update Printers from CUPS">
|
||||||
|
<label string="This process will create all missing printers from the current CUPS server." colspan="2"/>
|
||||||
|
<footer>
|
||||||
|
<button name="action_ok" string="Ok" type="object" class="oe_highlight"/>
|
||||||
|
or
|
||||||
|
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||||
|
</footer>
|
||||||
|
</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_main"/>
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
Reference in New Issue
Block a user