[IMP] lower case _LOGGER and log some more exception details

This commit is contained in:
Stéphane Bidoul
2015-07-20 18:57:34 +02:00
parent eb2693c1d7
commit bdd4e838c2
5 changed files with 17 additions and 14 deletions

View File

@@ -7,7 +7,7 @@ from openerp import api, models, fields
from openerp.tools.translate import _
from openerp.exceptions import Warning
_LOGGER = logging.getLogger(__name__)
_logger = logging.getLogger(__name__)
class AccountBankStatementLine(models.Model):
@@ -231,7 +231,7 @@ class AccountBankStatementImport(models.TransientModel):
journal_currency_id = journal_obj.currency.id
if currency_id != journal_currency_id:
# ALso log message with id's for technical analysis:
_LOGGER.warn(
_logger.warn(
_('Statement currency id is %d,'
' but journal currency id = %d.'),
currency_id,
@@ -245,7 +245,7 @@ class AccountBankStatementImport(models.TransientModel):
company_currency_id = self.env.user.company_id.currency_id.id
if currency_id != company_currency_id:
# ALso log message with id's for technical analysis:
_LOGGER.warn(
_logger.warn(
_('Statement currency id is %d,'
' but company currency id = %d.'),
currency_id,

View File

@@ -26,7 +26,7 @@ from openerp.tests.common import TransactionCase
from openerp.modules.module import get_module_resource
_LOGGER = logging.getLogger(__name__)
_logger = logging.getLogger(__name__)
class TestStatementFile(TransactionCase):
@@ -69,7 +69,7 @@ class TestStatementFile(TransactionCase):
"select name, date, amount, ref, bank_account_id"
" from account_bank_statement_line"
" where statement_id=%d" % statement_obj.id)
_LOGGER.error(
_logger.error(
"Transaction not found in %s" %
str(self.cr.fetchall())
)

View File

@@ -23,7 +23,7 @@ from openerp import models
from .camt import CamtParser as Parser
_LOGGER = logging.getLogger(__name__)
_logger = logging.getLogger(__name__)
class AccountBankStatementImport(models.TransientModel):
@@ -34,10 +34,11 @@ class AccountBankStatementImport(models.TransientModel):
"""Parse a CAMT053 XML file."""
parser = Parser()
try:
_LOGGER.debug("Try parsing with camt.")
_logger.debug("Try parsing with camt.")
return parser.parse(data_file)
except ValueError:
# Not a camt file, returning super will call next candidate:
_LOGGER.debug("Statement file was not a camt file.")
_logger.debug("Statement file was not a camt file.",
exc_info=True)
return super(AccountBankStatementImport, self)._parse_file(
cr, uid, data_file, context=context)

View File

@@ -23,7 +23,7 @@ from openerp import models
from .mt940 import MT940Parser as Parser
_LOGGER = logging.getLogger(__name__)
_logger = logging.getLogger(__name__)
class AccountBankStatementImport(models.TransientModel):
@@ -34,10 +34,11 @@ class AccountBankStatementImport(models.TransientModel):
"""Parse a MT940 IBAN ING file."""
parser = Parser()
try:
_LOGGER.debug("Try parsing with MT940 IBAN ING.")
_logger.debug("Try parsing with MT940 IBAN ING.")
return parser.parse(data_file)
except ValueError:
# Returning super will call next candidate:
_LOGGER.debug("Statement file was not a MT940 IBAN ING file.")
_logger.debug("Statement file was not a MT940 IBAN ING file.",
exc_info=True)
return super(AccountBankStatementImport, self)._parse_file(
cr, uid, data_file, context=context)

View File

@@ -24,7 +24,7 @@ from openerp import models
from .mt940 import MT940Parser as Parser
_LOGGER = logging.getLogger(__name__)
_logger = logging.getLogger(__name__)
class AccountBankStatementImport(models.TransientModel):
@@ -35,11 +35,12 @@ class AccountBankStatementImport(models.TransientModel):
"""Parse a MT940 RABO file."""
parser = Parser()
try:
_LOGGER.debug("Try parsing with MT940 RABO.")
_logger.debug("Try parsing with MT940 RABO.")
statements = parser.parse(data_file)
return statements
except ValueError:
# Returning super will call next candidate:
_LOGGER.debug("Statement file was not a MT940 RABO file.")
_logger.debug("Statement file was not a MT940 RABO file.",
exc_info=True)
return super(AccountBankStatementImport, self)._parse_file(
cr, uid, data_file, context=context)