base_calendar passed away

This commit is contained in:
Guewen Baconnier
2014-11-12 17:29:24 +01:00
committed by Sylvain GARANCHER
parent 3f8838ccda
commit d02f5e616c
2 changed files with 46 additions and 44 deletions

View File

@@ -29,7 +29,8 @@
'author': 'Agile Business Group & Domsense, Pegueroles SCP, NaN',
'website': 'http://www.agilebg.com',
'license': 'AGPL-3',
"depends": ['base', 'base_calendar'],
"depends": ['base',
],
'data': [
'security/security.xml',
'printing_data.xml',

View File

@@ -22,56 +22,57 @@
# 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.addons.base_calendar import base_calendar
# from openerp import pooler
# 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):
res = super(virtual_report_spool, self).exp_report(db, uid, object, ids, datas, context)
self._reports[res]['report_name'] = object
return res
# def exp_report(self, db, uid, object, ids, datas=None, context=None):
# res = super(virtual_report_spool, self).exp_report(db, uid, object, ids, datas, context)
# self._reports[res]['report_name'] = object
# return res
def exp_report_get(self, db, uid, report_id):
# def exp_report_get(self, db, uid, report_id):
cr = pooler.get_db(db).cursor()
try:
pool = pooler.get_pool(cr.dbname)
# First of all load report defaults: name, action and printer
report_obj = pool.get('ir.actions.report.xml')
report = report_obj.search(
cr, uid, [('report_name', '=', self._reports[report_id]['report_name'])])
if report:
report = report_obj.browse(cr, uid, report[0])
data = report.behaviour()[report.id]
action = data['action']
printer = data['printer']
if action != 'client':
if (self._reports and self._reports.get(report_id, False)
and self._reports[report_id].get('result', False)
and self._reports[report_id].get('format', False)):
report_obj.print_direct(
cr, uid, report.id, base64.encodestring(self._reports[report_id]['result']),
self._reports[report_id]['format'], printer)
# 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 impression
# raise osv.except_osv(
# _('Printing...'),
# _('Document sent to printer %s') % (printer,))
# cr = pooler.get_db(db).cursor()
# try:
# pool = pooler.get_pool(cr.dbname)
# # First of all load report defaults: name, action and printer
# report_obj = pool.get('ir.actions.report.xml')
# report = report_obj.search(
# cr, uid, [('report_name', '=', self._reports[report_id]['report_name'])])
# if report:
# report = report_obj.browse(cr, uid, report[0])
# data = report.behaviour()[report.id]
# action = data['action']
# printer = data['printer']
# if action != 'client':
# if (self._reports and self._reports.get(report_id, False)
# and self._reports[report_id].get('result', False)
# and self._reports[report_id].get('format', False)):
# report_obj.print_direct(
# cr, uid, report.id, base64.encodestring(self._reports[report_id]['result']),
# self._reports[report_id]['format'], printer)
# # 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 impression
# # raise osv.except_osv(
# # _('Printing...'),
# # _('Document sent to printer %s') % (printer,))
except:
cr.rollback()
raise
finally:
cr.close()
# except:
# cr.rollback()
# raise
# finally:
# cr.close()
res = super(virtual_report_spool, self).exp_report_get(db, uid, report_id)
return res
# res = super(virtual_report_spool, self).exp_report_get(db, uid, report_id)
# 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: