Browse Source

[FIX] Solving pylint/flake and test errors.

Also added dutch translation.
pull/15/head
Ronald Portier (Therp BV) 10 years ago
parent
commit
a91cbecc41
  1. 36
      account_bank_statement_import/account_bank_statement_import.py
  2. 56
      account_bank_statement_import/i18n/account_bank_statement_import.pot
  3. 236
      account_bank_statement_import/i18n/nl.po
  4. 2
      bank_statement_parse_nl_ing_mt940/demo/demo_data.xml
  5. 2
      bank_statement_parse_nl_ing_mt940/test_files/test-ing.940
  6. 2
      bank_statement_parse_nl_ing_mt940/tests/test_import_bank_statement.py

36
account_bank_statement_import/account_bank_statement_import.py

@ -11,6 +11,7 @@ _logger = logging.getLogger(__name__)
class AccountBankStatementLine(models.Model):
"""Extend model account.bank.statement.line."""
_inherit = "account.bank.statement.line"
# Ensure transactions can be imported only once (if the import format
@ -25,6 +26,7 @@ class AccountBankStatementLine(models.Model):
class AccountBankStatementImport(models.TransientModel):
"""Extend model account.bank.statement."""
_name = 'account.bank.statement.import'
_description = 'Import Bank Statement'
@ -153,8 +155,8 @@ class AccountBankStatementImport(models.TransientModel):
-o 'ref': string
"""
raise Warning(_(
'Could not make sense of the given file.\nDid you '
'install the module to support this type of file ?'
'Could not make sense of the given file.\n'
'Did you install the module to support this type of file?'
))
@api.model
@ -218,12 +220,14 @@ class AccountBankStatementImport(models.TransientModel):
if journal_id and currency_id:
journal_obj = self.env['account.journal'].browse(journal_id)
if journal_obj.currency:
if currency_id != journal_obj.currency.id:
journal_currency_id = journal_obj.currency.id
if currency_id != journal_currency_id:
# ALso log message with id's for technical analysis:
_logger.warn(_(
'Statement currency id is %d,'
' but journal currency id = %d.') %
(currency_id, journal_currency_id,)
_logger.warn(
_('Statement currency id is %d,'
' but journal currency id = %d.'),
currency_id,
journal_currency_id
)
raise Warning(_(
'The currency of the bank statement is not '
@ -233,10 +237,11 @@ 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(_(
'Statement currency id is %d,'
' but company currency id = %d.') %
(currency_id, company_currency_id,)
_logger.warn(
_('Statement currency id is %d,'
' but company currency id = %d.'),
currency_id,
company_currency_id
)
raise Warning(_(
'The currency of the bank statement is not '
@ -246,8 +251,9 @@ class AccountBankStatementImport(models.TransientModel):
@api.model
@api.returns('res.partner.bank')
def _create_bank_account(self, account_number, company_id=False,
currency_id=False):
def _create_bank_account(
self, account_number, company_id=False, currency_id=False):
"""Automagically create bank account, when not yet existing."""
try:
bank_type = self.env.ref('base.bank_normal')
bank_code = bank_type.code
@ -276,6 +282,7 @@ class AccountBankStatementImport(models.TransientModel):
@api.model
def _complete_statement(self, statement, journal_id, account_number):
"""Complete statement from information passed."""
statement['journal_id'] = journal_id
for line_vals in statement['transactions']:
unique_import_id = line_vals.get('unique_import_id', False)
@ -343,7 +350,8 @@ class AccountBankStatementImport(models.TransientModel):
if num_ignored > 0:
notifications += [{
'type': 'warning',
'message': _("%d transactions had already been imported and "
'message':
_("%d transactions had already been imported and "
"were ignored.") % num_ignored
if num_ignored > 1
else _("1 transaction had already been imported and "

56
account_bank_statement_import/i18n/account_bank_statement_import.pot

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-08 12:02+0000\n"
"PO-Revision-Date: 2015-06-08 12:02+0000\n"
"POT-Creation-Date: 2015-06-11 12:15+0000\n"
"PO-Revision-Date: 2015-06-11 12:15+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -16,13 +16,13 @@ msgstr ""
"Plural-Forms: \n"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:313
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:347
#, python-format
msgid "%d transactions had already been imported and were ignored."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:316
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:350
#, python-format
msgid "1 transaction had already been imported and was ignored."
msgstr ""
@ -53,7 +53,7 @@ msgid "Account Number must be unique"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:319
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:353
#, python-format
msgid "Already imported items"
msgstr ""
@ -74,18 +74,18 @@ msgid "Bank Statement Line"
msgstr ""
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "Cancel"
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:116
#, python-format
msgid "Can not determine journal for import."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:200
#, python-format
msgid "Cannot find in which journal import this statement. Please manually select a journal."
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "Cancel"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:129
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:154
#, python-format
msgid "Could not make sense of the given file.\n"
"Did you install the module to support this type of file ?"
@ -153,31 +153,55 @@ msgid "Sanitized Account Number"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:181
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:237
#, python-format
msgid "Statement currency id is %d, but company currency id = %d."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:224
#, python-format
msgid "Statement currency id is %d, but journal currency id = %d."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:179
#, python-format
msgid "Statement has invalid currency code %s"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:207
#, python-format
msgid "The account of this statement is linked to another journal."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:195
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:242
#, python-format
msgid "The currency of the bank statement is not the same as the company currency !"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:229
#, python-format
msgid "The currency of the bank statement is not the same as the currency of the journal !"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:136
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:163
#, python-format
msgid "This file doesn't contain any statement."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:144
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:168
#, python-format
msgid "This file doesn't contain any transaction."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:305
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:88
#, python-format
msgid "You have already imported that file."
msgstr ""

236
account_bank_statement_import/i18n/nl.po

@ -0,0 +1,236 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import
# Therp BV <therp.nl>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-11 12:15+0000\n"
"PO-Revision-Date: 2015-06-11 14:37+0200\n"
"Last-Translator: Therp BV <therp.nl>\n"
"Language: nl\n"
"Language-Team: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
"X-Generator: Gtranslator 2.91.6\n"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:347
#, python-format
msgid "%d transactions had already been imported and were ignored."
msgstr "%d Transacties zijn overgeslagen omdat ze al reeds waren geïmporteerd."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:350
#, python-format
msgid "1 transaction had already been imported and was ignored."
msgstr "1. Transactie was al geïmporteerd en is overgeslagen."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "1. Download your bank statements from your bank website."
msgstr "1. Download het bankafschrift bestand van de website van uw bank."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid ""
"2. Make sure you have installed the right module to support the file format."
msgstr ""
"2. Zorg ervoor dat de modules die het formaat van uw bestand ondersteunen "
"zijn geïnstalleerd."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "3. Select the file and click 'Import'."
msgstr "3. Selecteer het bestand en klik op \"Importeren\"."
#. module: account_bank_statement_import
#: sql_constraint:account.bank.statement.line:0
msgid "A bank account transactions can be imported only once !"
msgstr "De transacties kunnen slechts eenmalig worden geïmporteerd."
#. module: account_bank_statement_import
#: sql_constraint:res.partner.bank:0
msgid "Account Number must be unique"
msgstr "Rekeningnummer moet uniek zijn"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:353
#, python-format
msgid "Already imported items"
msgstr "Al eerder geïmporteerde regels"
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_res_partner_bank
msgid "Bank Accounts"
msgstr "Bankrekeningen"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,data_file:0
msgid "Bank Statement File"
msgstr "Bankafschriften bestand"
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_account_bank_statement_line
msgid "Bank Statement Line"
msgstr "Bankafschrift regel"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:116
#, python-format
msgid "Can not determine journal for import."
msgstr "Kan niet bepalen welk dagboek gebruikt moet worden."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "Cancel"
msgstr "Annuleren"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:154
#, python-format
msgid ""
"Could not make sense of the given file.\n"
"Did you install the module to support this type of file ?"
msgstr ""
"Kon het bestand niet interpreteren.\n"
"Heeft u de juiste modules voor dit type bestand geïnstalleerd?"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,create_uid:0
msgid "Created by"
msgstr "Aangemaakt door"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,create_date:0
msgid "Created on"
msgstr "Aangemaakt op"
#. module: account_bank_statement_import
#: help:account.bank.statement.import,data_file:0
msgid ""
"Get you bank statements in electronic format from your bank and select them "
"here."
msgstr ""
"Verkrijg de bankafschriften van uw bank in elektronische vorm en selecteer "
"ze hier."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "How to import your bank statement :"
msgstr "Hoe uw bankafschrift te importeren:"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,id:0
msgid "ID"
msgstr "ID"
#. module: account_bank_statement_import
#: model:ir.actions.act_window,name:account_bank_statement_import.action_account_bank_statement_import
#: model:ir.ui.menu,name:account_bank_statement_import.menu_account_bank_statement_import
msgid "Import"
msgstr "Import"
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Geïmporteerd bankafschrift"
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "Import Bank Statements"
msgstr "Importeer bankafschriften"
#. module: account_bank_statement_import
#: field:account.bank.statement.line,unique_import_id:0
msgid "Import ID"
msgstr "Import ID"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,write_uid:0
msgid "Last Updated by"
msgstr "Laatst bijgewerkt door"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,write_date:0
msgid "Last Updated on"
msgstr "Laatst bijgewerkt op"
#. module: account_bank_statement_import
#: field:res.partner.bank,sanitized_acc_number:0
msgid "Sanitized Account Number"
msgstr "Gestandaardiseerd rekeningnummer"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:237
#, python-format
msgid "Statement currency id is %d, but company currency id = %d."
msgstr "Valuta id van afschrift = %d, maar valuta id van bedrijf = %d."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:224
#, python-format
msgid "Statement currency id is %d, but journal currency id = %d."
msgstr "Valuta id van afschrift = %d, maar valuta id van dagboek = %d."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:179
#, python-format
msgid "Statement has invalid currency code %s"
msgstr "Bankafschrift heeft ongeldige valutacode %s"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:207
#, python-format
msgid "The account of this statement is linked to another journal."
msgstr ""
"Het rekeningnummer van dit afschrift is gekoppeld aan een ander dagboek."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:242
#, python-format
msgid ""
"The currency of the bank statement is not the same as the company currency !"
msgstr ""
"De valuta van het afschrift is niet gelijk aan de valuta van het bedrijf!"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:229
#, python-format
msgid ""
"The currency of the bank statement is not the same as the currency of the "
"journal !"
msgstr ""
"De valuta van het afschrift is niet hetzelfde als de valuta van het dagboek!"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:163
#, python-format
msgid "This file doesn't contain any statement."
msgstr "Dit bestand bevat geen enkel afschrift."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:168
#, python-format
msgid "This file doesn't contain any transaction."
msgstr "Dit bestand bevat geen enkele transactie."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:88
#, python-format
msgid "You have already imported that file."
msgstr "U heeft dit bestand al geïmporteerd."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "_Import"
msgstr ""
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "or"
msgstr ""

2
bank_statement_parse_nl_ing_mt940/demo/demo_data.xml

@ -14,7 +14,7 @@
<record id="mt940_ing_company_bank" model="res.partner.bank">
<field name="owner_name">Your Company</field>
<field name="acc_number">NL77ABNA0574908765</field>
<field name="acc_number">NL77INGB0574908765</field>
<field name="partner_id" ref="base.partner_root"></field>
<field name="company_id" ref="base.main_company"></field>
<field name="journal_id" ref="mt940_ing_bank_journal"></field>

2
bank_statement_parse_nl_ing_mt940/test_files/test-ing.940

@ -2,7 +2,7 @@
{2:I940INGBNL2AXXXN}
{4:
:20:P140220000000001
:25:NL77ABNA0574908765EUR
:25:NL77INGB0574908765EUR
:28C:0000
0
:60F:C140219EUR662,23

2
bank_statement_parse_nl_ing_mt940/tests/test_import_bank_statement.py

@ -50,7 +50,7 @@ class TestStatementFile(TransactionCase):
import_model.import_file(cr, uid, [bank_statement_id])
# statement name is account number + '-' + date of last 62F line:
ids = statement_model.search(
cr, uid, [('name', '=', 'NL77ABNA0574908765-2014-02-20')])
cr, uid, [('name', '=', 'NL77INGB0574908765-2014-02-20')])
self.assertTrue(ids, 'Statement not found after parse.')
statement_id = ids[0]
statement_obj = statement_model.browse(

Loading…
Cancel
Save