[FIX] error log + type

This commit is contained in:
unknown
2013-04-22 09:18:14 +02:00
parent 7f56881f74
commit 6a2cb72e26

View File

@@ -19,6 +19,10 @@
# #
############################################################################## ##############################################################################
# TODO replace customer supplier by package constant # TODO replace customer supplier by package constant
import traceback
import sys
import logging
from collections import defaultdict from collections import defaultdict
import re import re
from tools.translate import _ from tools.translate import _
@@ -27,6 +31,7 @@ from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from operator import attrgetter from operator import attrgetter
import datetime import datetime
_logger = logging.getLogger(__name__)
class ErrorTooManyPartner(Exception): class ErrorTooManyPartner(Exception):
""" """
@@ -173,7 +178,7 @@ class AccountStatementCompletionRule(orm.Model):
'type': inv_type} 'type': inv_type}
override_acc = line['master_account_id'] override_acc = line['master_account_id']
if override_acc: if override_acc:
res['account_id'] = override_acc.id res['account_id'] = override_acc
return res return res
# Should be private but data are initialised with no update XML # Should be private but data are initialised with no update XML
@@ -502,12 +507,22 @@ class AccountBankSatement(orm.Model):
msg_lines.append(repr(exc)) msg_lines.append(repr(exc))
except Exception, exc: except Exception, exc:
msg_lines.append(repr(exc)) msg_lines.append(repr(exc))
error_type, error_value, trbk = sys.exc_info()
st = "Error: %s\nDescription: %s\nTraceback:" % (error_type.__name__, error_value)
st += ''.join(traceback.format_tb(trbk, 30))
print st
_logger.error(st)
if res: if res:
#stat_line_obj.write(cr, uid, [line.id], vals, context=ctx) #stat_line_obj.write(cr, uid, [line.id], vals, context=ctx)
try: try:
stat_line_obj._update_line(cr, uid, res, context=context) stat_line_obj._update_line(cr, uid, res, context=context)
except osv.except_osv as exc: except Exception as exc:
msg_lines.append(repr(exc)) msg_lines.append(repr(exc))
error_type, error_value, trbk = sys.exc_info()
st = "Error: %s\nDescription: %s\nTraceback:" % (error_type.__name__, error_value)
st += ''.join(traceback.format_tb(trbk, 30))
print st
_logger.error(st)
# we can commit as it is not needed to be atomic # we can commit as it is not needed to be atomic
# commiting here adds a nice perfo boost # commiting here adds a nice perfo boost
if not compl_lines % 500: if not compl_lines % 500: