summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Maniet <arthurmaniet@me.com>2015-08-21 16:18:07 +0200
committerArthur Maniet <arthurmaniet@me.com>2015-08-21 16:43:25 +0200
commit857156e33e8a8f68cc8da41e06eda250913ffddd (patch)
tree3f6d5a935eab43ac2e6fdff498714d965d0cb602
parent3a4848e3a90685d072880e95090bc78f029767cb (diff)
[FIX] account: set a journal bank_statements_source after it succeeds
When a bank statement acquisition method (file import, plaid, manual encoding) is used on a journal, it should only be set as the journal's bank_statements_source after successful completion.
-rw-r--r--addons/account_bank_statement_import/account_bank_statement_import.py3
-rw-r--r--addons/account_bank_statement_import/account_journal.py1
2 files changed, 2 insertions, 2 deletions
diff --git a/addons/account_bank_statement_import/account_bank_statement_import.py b/addons/account_bank_statement_import/account_bank_statement_import.py
index 6ea8c4d266c..aebdc80644b 100644
--- a/addons/account_bank_statement_import/account_bank_statement_import.py
+++ b/addons/account_bank_statement_import/account_bank_statement_import.py
@@ -46,6 +46,8 @@ class AccountBankStatementImport(models.TransientModel):
stmts_vals = self._complete_stmts_vals(stmts_vals, journal, account_number)
# Create the bank statements
statement_ids, notifications = self._create_bank_statements(stmts_vals)
+ # Now that the import worked out, set it as the bank_statements_source of the journal
+ journal.bank_statements_source = 'file_import'
# Finally dispatch to reconciliation interface
action = self.env.ref('account.action_bank_reconcile_bank_statements')
return {
@@ -73,7 +75,6 @@ class AccountBankStatementImport(models.TransientModel):
'default_name': _('Bank') + ' ' + account_number,
'default_currency_id': currency and currency.id or False,
'default_type': 'bank',
- 'default_bank_statements_source': 'file_import',
}
}
diff --git a/addons/account_bank_statement_import/account_journal.py b/addons/account_bank_statement_import/account_journal.py
index 35267234bc6..7964ecc9aec 100644
--- a/addons/account_bank_statement_import/account_journal.py
+++ b/addons/account_bank_statement_import/account_journal.py
@@ -10,7 +10,6 @@ class AccountJournal(models.Model):
@api.multi
def import_statement(self):
"""return action to import bank/cash statements. This button should be called only on journals with type =='bank'"""
- self.bank_statements_source = 'file_import'
model = 'account.bank.statement'
action_name = 'action_account_bank_statement_import'
ir_model_obj = self.pool['ir.model.data']