From 73db5b3eef51180b0dd81e212213ee9bf284abd5 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 2 Dec 2014 15:02:02 +0100 Subject: [PATCH] [FIX] account_voucher: period selection in on_change The find method returns a list of ids while the on_chage expects an int --- addons/account_voucher/account_voucher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 78060e8a733..b1e8e8ecb08 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -884,11 +884,11 @@ class account_voucher(osv.osv): else: currency_id = journal.company_id.currency_id.id - period_id = self.pool['account.period'].find(cr, uid, context=dict(context, company_id=company_id)) + period_ids = self.pool['account.period'].find(cr, uid, context=dict(context, company_id=company_id)) vals['value'].update({ 'currency_id': currency_id, 'payment_rate_currency_id': currency_id, - 'period_id' : period_id + 'period_id': period_ids and period_ids[0] or False }) #in case we want to register the payment directly from an invoice, it's confusing to allow to switch the journal #without seeing that the amount is expressed in the journal currency, and not in the invoice currency. So to avoid