Browse Source

Update flake and pylint errors.

pull/69/head
Fekete Mihai 9 years ago
parent
commit
af7df6550b
  1. 1
      account_bank_statement_import_mt940_ro_brd/__openerp__.py
  2. 3
      account_bank_statement_import_mt940_ro_brd/account_bank_statement_import.py
  3. 8
      account_bank_statement_import_mt940_ro_brd/mt940.py

1
account_bank_statement_import_mt940_ro_brd/__openerp__.py

@ -8,7 +8,6 @@
'author': 'Forest and Biomass Services Romania, '
'Odoo Community Association (OCA)',
'website': 'https://www.forbiom.eu',
'website': 'www.forbiom.eu',
'category': 'Banking addons',
'depends': [
'account_bank_statement_import_mt940_base'

3
account_bank_statement_import_mt940_ro_brd/account_bank_statement_import.py

@ -3,7 +3,7 @@
# See README.rst file on addons root folder for license details
import logging
from openerp import models, api
from openerp import models
from .mt940 import MT940Parser as Parser
_logger = logging.getLogger(__name__)
@ -13,7 +13,6 @@ class AccountBankStatementImport(models.TransientModel):
"""Add parsing of mt940 files to bank statement import."""
_inherit = 'account.bank.statement.import'
def _parse_file(self, cr, uid, data_file, context=None):
"""Parse a MT940 IBAN BRD file."""
parser = Parser()

8
account_bank_statement_import_mt940_ro_brd/mt940.py

@ -3,10 +3,10 @@
# See README.rst file on addons root folder for license details
import re
from datetime import datetime
from openerp.addons.account_bank_statement_import_mt940_base.mt940 import (
MT940, str2amount)
def get_counterpart(transaction, subfield):
"""Get counterpart from transaction.
@ -21,6 +21,7 @@ def get_counterpart(transaction, subfield):
if len(subfield) >= 3 and subfield[2]:
transaction.remote_owner_tin = subfield[2]
def get_subfields(data, codewords):
"""Return dictionary with value array for each codeword in data.
@ -32,7 +33,7 @@ def get_subfields(data, codewords):
+25TRANSACTIONMESSAGE3+26TRANSACTIONMESSAGE4
+27TRANSACTIONMESSAGE5
+61PARTNERADDRESS1+62PARTNERADDRESS2
codewords = ['20', '23', '24', '25', '26', '27',
codewords = ['20', '23', '24', '25', '26', '27',
'30', '31', '32', '33', '61', '62']
!!! NOT ALL CODEWORDS ARE PRESENT !!!
Then return subfields = {
@ -63,6 +64,7 @@ def get_subfields(data, codewords):
subfields[current_codeword].append(word[2:])
return subfields
def handle_common_subfields(transaction, subfields):
"""Deal with common functionality for tag 86 subfields."""
# Get counterpart from 31, 32 or 33 subfields:
@ -86,6 +88,7 @@ def handle_common_subfields(transaction, subfields):
transaction.eref = ''.join(
subfields[transaction.eref])
class MT940Parser(MT940):
"""Parser for ing MT940 bank statement import files."""
@ -140,4 +143,3 @@ class MT940Parser(MT940):
handle_common_subfields(transaction, subfields)
# Prevent handling tag 86 later for non transaction details:
self.current_transaction = None
Loading…
Cancel
Save