From 9a8a140782884426b651ecbd1a1735131e5efb3f Mon Sep 17 00:00:00 2001 From: Arthur Maniet Date: Fri, 21 Aug 2015 17:04:58 +0200 Subject: [PATCH] [IMP] account: change an account currency along with its journal's --- addons/account/models/account.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/account/models/account.py b/addons/account/models/account.py index 95e1f061165..3a77abfc046 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -303,6 +303,11 @@ class AccountJournal(models.Model): if journal.refund_sequence_id: new_prefix = self._get_sequence_prefix(vals['code'], refund=True) journal.refund_sequence_id.write({'prefix': new_prefix}) + if 'currency_id' in vals: + if not 'default_debit_account_id' in vals and self.default_debit_account_id: + self.default_debit_account_id.currency_id = vals['currency_id'] + if not 'default_credit_account_id' in vals and self.default_credit_account_id: + self.default_credit_account_id.currency_id = vals['currency_id'] result = super(AccountJournal, self).write(vals) # Create the bank_account_id if necessary