From 1ebe98df7996ceef484d9e5a3cd094e1ef45bdb1 Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 3 Apr 2015 09:06:14 +0200 Subject: [PATCH] [IMP] Specify the currency to use for the account.account and account.journal created by res_partner_bank.post_write --- .../account_bank_statement_import.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/account_bank_statement_import/account_bank_statement_import.py b/account_bank_statement_import/account_bank_statement_import.py index 74317b0d..5d9dbaaa 100644 --- a/account_bank_statement_import/account_bank_statement_import.py +++ b/account_bank_statement_import/account_bank_statement_import.py @@ -214,13 +214,11 @@ class account_bank_statement_import(models.TransientModel): vals_acc['company_id'] = company_id # When the journal is created at same time of the bank account, we need - # to specify the currency to use a first time for the account.account - res_bank = self.env['res.partner.bank'].with_context( - default_currency_id=currency_id).create(vals_acc) - # and a second time on the journal - if currency_id: - res_bank.journal_id.currency = currency_id - return res_bank + # to specify the currency to use for the account.account and + # account.journal + return self.env['res.partner.bank'].with_context( + default_currency_id=currency_id, + default_currency=currency_id).create(vals_acc) @api.model def _complete_stmts_vals(self, stmts_vals, journal_id, account_number):