From a91cbecc41056d5d718d1a4b484422bea370b4fd Mon Sep 17 00:00:00 2001 From: "Ronald Portier (Therp BV)" Date: Thu, 11 Jun 2015 14:56:08 +0200 Subject: [PATCH] [FIX] Solving pylint/flake and test errors. Also added dutch translation. --- .../account_bank_statement_import.py | 44 ++-- .../i18n/account_bank_statement_import.pot | 58 +++-- account_bank_statement_import/i18n/nl.po | 236 ++++++++++++++++++ .../demo/demo_data.xml | 2 +- .../test_files/test-ing.940 | 2 +- .../tests/test_import_bank_statement.py | 2 +- .../tests/test_import_bank_statement.py | 2 +- 7 files changed, 307 insertions(+), 39 deletions(-) create mode 100644 account_bank_statement_import/i18n/nl.po diff --git a/account_bank_statement_import/account_bank_statement_import.py b/account_bank_statement_import/account_bank_statement_import.py index b688199e..a1c7fca5 100644 --- a/account_bank_statement_import/account_bank_statement_import.py +++ b/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,11 +350,12 @@ class AccountBankStatementImport(models.TransientModel): if num_ignored > 0: notifications += [{ 'type': 'warning', - 'message': _("%d transactions had already been imported and " - "were ignored.") % num_ignored - if num_ignored > 1 - else _("1 transaction had already been imported and " - "was ignored."), + 'message': + _("%d transactions had already been imported and " + "were ignored.") % num_ignored + if num_ignored > 1 + else _("1 transaction had already been imported and " + "was ignored."), 'details': { 'name': _('Already imported items'), 'model': 'account.bank.statement.line', diff --git a/account_bank_statement_import/i18n/account_bank_statement_import.pot b/account_bank_statement_import/i18n/account_bank_statement_import.pot index e312875e..40119334 100644 --- a/account_bank_statement_import/i18n/account_bank_statement_import.pot +++ b/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 "" @@ -73,19 +73,19 @@ msgstr "" msgid "Bank Statement Line" msgstr "" +#. 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 "" + #. module: account_bank_statement_import #: 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:200 -#, python-format -msgid "Cannot find in which journal import this statement. Please manually select a journal." -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 "" diff --git a/account_bank_statement_import/i18n/nl.po b/account_bank_statement_import/i18n/nl.po new file mode 100644 index 00000000..4fae8ad6 --- /dev/null +++ b/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 , 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 \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 "" diff --git a/bank_statement_parse_nl_ing_mt940/demo/demo_data.xml b/bank_statement_parse_nl_ing_mt940/demo/demo_data.xml index 2be59cd8..83e3386c 100644 --- a/bank_statement_parse_nl_ing_mt940/demo/demo_data.xml +++ b/bank_statement_parse_nl_ing_mt940/demo/demo_data.xml @@ -14,7 +14,7 @@ Your Company - NL77ABNA0574908765 + NL77INGB0574908765 diff --git a/bank_statement_parse_nl_ing_mt940/test_files/test-ing.940 b/bank_statement_parse_nl_ing_mt940/test_files/test-ing.940 index f90ac6a6..8226c9df 100644 --- a/bank_statement_parse_nl_ing_mt940/test_files/test-ing.940 +++ b/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 diff --git a/bank_statement_parse_nl_ing_mt940/tests/test_import_bank_statement.py b/bank_statement_parse_nl_ing_mt940/tests/test_import_bank_statement.py index dbf99528..914b9a8d 100644 --- a/bank_statement_parse_nl_ing_mt940/tests/test_import_bank_statement.py +++ b/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( diff --git a/bank_statement_parse_nl_rabo_mt940/tests/test_import_bank_statement.py b/bank_statement_parse_nl_rabo_mt940/tests/test_import_bank_statement.py index b0332bb8..a799af8c 100644 --- a/bank_statement_parse_nl_rabo_mt940/tests/test_import_bank_statement.py +++ b/bank_statement_parse_nl_rabo_mt940/tests/test_import_bank_statement.py @@ -31,7 +31,7 @@ class TestStatementFile(TransactionCase): def test_statement_import(self): """Test correct creation of single statement. - + For this test there is NOT an existing bank-account. Therefore a bank account should automatically be created in the main company. """