mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[IMP] base_report_to_printer - remove class calls and use orm.Model and orm.TransientModel instead of osv aliases
This commit is contained in:
@@ -35,8 +35,7 @@ from threading import Lock
|
|||||||
import netsvc
|
import netsvc
|
||||||
import tools
|
import tools
|
||||||
import time
|
import time
|
||||||
from osv import fields
|
from openero.osv import orm, fields
|
||||||
from osv import osv
|
|
||||||
import pooler
|
import pooler
|
||||||
import tools
|
import tools
|
||||||
from tools.translate import _
|
from tools.translate import _
|
||||||
@@ -47,7 +46,7 @@ import logging
|
|||||||
#
|
#
|
||||||
# Printers
|
# Printers
|
||||||
#
|
#
|
||||||
class printing_printer(osv.osv):
|
class printing_printer(orm.Model):
|
||||||
_name = "printing.printer"
|
_name = "printing.printer"
|
||||||
_description = "Printer"
|
_description = "Printer"
|
||||||
|
|
||||||
@@ -182,9 +181,6 @@ class printing_printer(osv.osv):
|
|||||||
return printer_ids[0]
|
return printer_ids[0]
|
||||||
return False
|
return False
|
||||||
|
|
||||||
printing_printer()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Actions
|
# Actions
|
||||||
@@ -197,7 +193,7 @@ def _available_action_types(self, cr, uid, context=None):
|
|||||||
('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'
|
||||||
|
|
||||||
@@ -205,13 +201,12 @@ class printing_action(osv.osv):
|
|||||||
'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"
|
||||||
|
|
||||||
@@ -225,13 +220,11 @@ class res_users(osv.osv):
|
|||||||
'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 print_direct(self, cr, uid, result, format, printer):
|
||||||
fd, file_name = mkstemp()
|
fd, file_name = mkstemp()
|
||||||
@@ -316,9 +309,7 @@ class report_xml(osv.osv):
|
|||||||
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 = {
|
||||||
@@ -368,7 +359,7 @@ class virtual_report_spool(base_calendar.virtual_report_spool):
|
|||||||
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, base64.encodestring(self._reports[report_id]['result']),
|
||||||
self._reports[report_id]['format'], printer)
|
self._reports[report_id]['format'], printer)
|
||||||
raise osv.except_osv(_('Printing...'), _('Document sent to printer %s') % (printer,))
|
raise orm.except_orm(_('Printing...'), _('Document sent to printer %s') % (printer,))
|
||||||
|
|
||||||
except:
|
except:
|
||||||
cr.rollback()
|
cr.rollback()
|
||||||
@@ -379,6 +370,4 @@ class virtual_report_spool(base_calendar.virtual_report_spool):
|
|||||||
res = super(virtual_report_spool, self).exp_report_get(db, uid, report_id)
|
res = super(virtual_report_spool, self).exp_report_get(db, uid, report_id)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
virtual_report_spool()
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|||||||
@@ -26,12 +26,11 @@ import subprocess
|
|||||||
import cups
|
import cups
|
||||||
|
|
||||||
import netsvc
|
import netsvc
|
||||||
from osv import fields
|
from openerp.osv import orm, fields
|
||||||
from osv import osv
|
|
||||||
from tools.translate import _
|
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 = {
|
||||||
@@ -71,6 +70,5 @@ class printing_printer_update_wizard(osv.osv_memory):
|
|||||||
'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:
|
||||||
|
|||||||
Reference in New Issue
Block a user