|
@ -322,7 +322,7 @@ class AccountBankStatementImport(models.TransientModel): |
|
|
bs_model = self.env['account.bank.statement'] |
|
|
bs_model = self.env['account.bank.statement'] |
|
|
bsl_model = self.env['account.bank.statement.line'] |
|
|
bsl_model = self.env['account.bank.statement.line'] |
|
|
# Filter out already imported transactions and create statement |
|
|
# Filter out already imported transactions and create statement |
|
|
ignored_statement_lines_import_ids = [] |
|
|
|
|
|
|
|
|
ignored_line_ids = [] |
|
|
filtered_st_lines = [] |
|
|
filtered_st_lines = [] |
|
|
for line_vals in statement['transactions']: |
|
|
for line_vals in statement['transactions']: |
|
|
unique_id = ( |
|
|
unique_id = ( |
|
@ -333,7 +333,7 @@ class AccountBankStatementImport(models.TransientModel): |
|
|
[('unique_import_id', '=', unique_id)], limit=1)): |
|
|
[('unique_import_id', '=', unique_id)], limit=1)): |
|
|
filtered_st_lines.append(line_vals) |
|
|
filtered_st_lines.append(line_vals) |
|
|
else: |
|
|
else: |
|
|
ignored_statement_lines_import_ids.append(unique_id) |
|
|
|
|
|
|
|
|
ignored_line_ids.append(unique_id) |
|
|
statement_id = False |
|
|
statement_id = False |
|
|
if len(filtered_st_lines) > 0: |
|
|
if len(filtered_st_lines) > 0: |
|
|
# Remove values that won't be used to create records |
|
|
# Remove values that won't be used to create records |
|
@ -346,7 +346,7 @@ class AccountBankStatementImport(models.TransientModel): |
|
|
statement_id = bs_model.create(statement).id |
|
|
statement_id = bs_model.create(statement).id |
|
|
# Prepare import feedback |
|
|
# Prepare import feedback |
|
|
notifications = [] |
|
|
notifications = [] |
|
|
num_ignored = len(ignored_statement_lines_import_ids) |
|
|
|
|
|
|
|
|
num_ignored = len(ignored_line_ids) |
|
|
if num_ignored > 0: |
|
|
if num_ignored > 0: |
|
|
notifications += [{ |
|
|
notifications += [{ |
|
|
'type': 'warning', |
|
|
'type': 'warning', |
|
@ -360,8 +360,6 @@ class AccountBankStatementImport(models.TransientModel): |
|
|
'name': _('Already imported items'), |
|
|
'name': _('Already imported items'), |
|
|
'model': 'account.bank.statement.line', |
|
|
'model': 'account.bank.statement.line', |
|
|
'ids': bsl_model.search( |
|
|
'ids': bsl_model.search( |
|
|
[('unique_import_id', 'in', |
|
|
|
|
|
ignored_statement_lines_import_ids)]).ids |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
[('unique_import_id', 'in', ignored_line_ids)]).ids} |
|
|
}] |
|
|
}] |
|
|
return statement_id, notifications |
|
|
return statement_id, notifications |