mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
base_calendar passed away
This commit is contained in:
committed by
Sylvain GARANCHER
parent
3f8838ccda
commit
d02f5e616c
@@ -29,7 +29,8 @@
|
|||||||
'author': 'Agile Business Group & Domsense, Pegueroles SCP, NaN',
|
'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',
|
||||||
|
],
|
||||||
'data': [
|
'data': [
|
||||||
'security/security.xml',
|
'security/security.xml',
|
||||||
'printing_data.xml',
|
'printing_data.xml',
|
||||||
|
|||||||
@@ -22,56 +22,57 @@
|
|||||||
# 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 base64
|
# TODO check if we have to remove
|
||||||
|
# import base64
|
||||||
|
|
||||||
from openerp import pooler
|
# from openerp import pooler
|
||||||
from openerp.addons.base_calendar import base_calendar
|
# from openerp.addons.base_calendar import base_calendar
|
||||||
|
|
||||||
|
|
||||||
class virtual_report_spool(base_calendar.virtual_report_spool):
|
# class virtual_report_spool(base_calendar.virtual_report_spool):
|
||||||
|
|
||||||
def exp_report(self, db, uid, object, ids, datas=None, context=None):
|
# def exp_report(self, db, uid, object, ids, datas=None, context=None):
|
||||||
res = super(virtual_report_spool, self).exp_report(db, uid, object, ids, datas, context)
|
# res = super(virtual_report_spool, self).exp_report(db, uid, object, ids, datas, context)
|
||||||
self._reports[res]['report_name'] = object
|
# self._reports[res]['report_name'] = object
|
||||||
return res
|
# return res
|
||||||
|
|
||||||
def exp_report_get(self, db, uid, report_id):
|
# def exp_report_get(self, db, uid, report_id):
|
||||||
|
|
||||||
cr = pooler.get_db(db).cursor()
|
# cr = pooler.get_db(db).cursor()
|
||||||
try:
|
# try:
|
||||||
pool = pooler.get_pool(cr.dbname)
|
# pool = pooler.get_pool(cr.dbname)
|
||||||
# First of all load report defaults: name, action and printer
|
# # First of all load report defaults: name, action and printer
|
||||||
report_obj = pool.get('ir.actions.report.xml')
|
# report_obj = pool.get('ir.actions.report.xml')
|
||||||
report = report_obj.search(
|
# report = report_obj.search(
|
||||||
cr, uid, [('report_name', '=', self._reports[report_id]['report_name'])])
|
# cr, uid, [('report_name', '=', self._reports[report_id]['report_name'])])
|
||||||
if report:
|
# if report:
|
||||||
report = report_obj.browse(cr, uid, report[0])
|
# report = report_obj.browse(cr, uid, report[0])
|
||||||
data = report.behaviour()[report.id]
|
# data = report.behaviour()[report.id]
|
||||||
action = data['action']
|
# action = data['action']
|
||||||
printer = data['printer']
|
# printer = data['printer']
|
||||||
if action != 'client':
|
# if action != 'client':
|
||||||
if (self._reports and self._reports.get(report_id, 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('result', False)
|
||||||
and self._reports[report_id].get('format', False)):
|
# and self._reports[report_id].get('format', False)):
|
||||||
report_obj.print_direct(
|
# report_obj.print_direct(
|
||||||
cr, uid, report.id, base64.encodestring(self._reports[report_id]['result']),
|
# cr, uid, report.id, base64.encodestring(self._reports[report_id]['result']),
|
||||||
self._reports[report_id]['format'], printer)
|
# self._reports[report_id]['format'], printer)
|
||||||
# FIXME "Warning" removed as it breaks the workflow
|
# # 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
|
# # 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
|
# # in this case it must be with a by pass parameter to allow massive impression
|
||||||
# raise osv.except_osv(
|
# # raise osv.except_osv(
|
||||||
# _('Printing...'),
|
# # _('Printing...'),
|
||||||
# _('Document sent to printer %s') % (printer,))
|
# # _('Document sent to printer %s') % (printer,))
|
||||||
|
|
||||||
except:
|
# except:
|
||||||
cr.rollback()
|
# cr.rollback()
|
||||||
raise
|
# raise
|
||||||
finally:
|
# finally:
|
||||||
cr.close()
|
# cr.close()
|
||||||
|
|
||||||
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()
|
# virtual_report_spool()
|
||||||
|
|
||||||
# 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