Browse Source

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

pull/15/head
Stéphane Bidoul 9 years ago
parent
commit
bdd4e838c2
  1. 6
      account_bank_statement_import/account_bank_statement_import.py
  2. 4
      account_bank_statement_import/tests/test_import_file.py
  3. 7
      bank_statement_parse_camt/account_bank_statement_import.py
  4. 7
      bank_statement_parse_nl_ing_mt940/account_bank_statement_import.py
  5. 7
      bank_statement_parse_nl_rabo_mt940/account_bank_statement_import.py

6
account_bank_statement_import/account_bank_statement_import.py

@ -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,

4
account_bank_statement_import/tests/test_import_file.py

@ -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())
)

7
bank_statement_parse_camt/account_bank_statement_import.py

@ -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)

7
bank_statement_parse_nl_ing_mt940/account_bank_statement_import.py

@ -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)

7
bank_statement_parse_nl_rabo_mt940/account_bank_statement_import.py

@ -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)
Loading…
Cancel
Save