Commit 971eb71e authored by Rémi - Le Filament's avatar Rémi - Le Filament
Browse files

Do not modify data_file which is used by other import methods

parent bc55fc44
......@@ -69,7 +69,6 @@ class AccountBankStatementImport(models.TransientModel):
if (test_versionB == None):
# for files generated after december 2017
file_version = "version_C"
parse_line_1 = re.compile(
self.regexp_version[file_version]['line_1']).search(data_file[0])
bank_group_code = parse_line_1.group('bank_group_code')
......@@ -85,7 +84,7 @@ class AccountBankStatementImport(models.TransientModel):
opening_balance = float(re.compile(self.regexp_version[file_version]['line_opening_balance']).search(data_file[len(data_file)-1]).group('balance').replace(',','.'))
except Exception as e:
_logger.error(e)
_logger.debug(e)
return False
return (file_version, bank_group_code, openning_date, closing_date,
bank_account_number, opening_balance, closing_balance,
......@@ -93,8 +92,8 @@ class AccountBankStatementImport(models.TransientModel):
@api.model
def _parse_file(self, data_file):
data_file = data_file.decode('iso-8859-1').splitlines()
result = self._check_file(data_file)
data_file_split = data_file.decode('iso-8859-1').splitlines()
result = self._check_file(data_file_split)
if not result:
return super(AccountBankStatementImport, self)._parse_file(
data_file)
......@@ -104,7 +103,7 @@ class AccountBankStatementImport(models.TransientModel):
total_amt = 0.00
try:
index = 0
for line in data_file[5:len(data_file)-1]:
for line in data_file_split[5:len(data_file_split)-1]:
transaction = re.compile(self.regexp_version[file_version]['line_debit']).search(line)
if (transaction != None):
transaction_amount = float(transaction.group('debit').replace(',','.'))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment