From 0b7b3213106c6cab686fccfae5ea1a3224fecafc Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 13 May 2013 15:24:22 +0200 Subject: [PATCH] [FIX] account_voucher: display the multi-currency options each time needed bzr revid: qdp-launchpad@openerp.com-20130513132422-q78dopdnnyd2x8dy --- addons/account_voucher/account_voucher.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 4b4639daeb6..f8b380a7ea4 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -247,13 +247,12 @@ class account_voucher(osv.osv): line_osv = self.pool.get("account.voucher.line") line_dr_ids = resolve_o2m_operations(cr, uid, line_osv, line_dr_ids, ['amount'], context) line_cr_ids = resolve_o2m_operations(cr, uid, line_osv, line_cr_ids, ['amount'], context) - #compute the field is_multi_currency that is used to hide/display options linked to secondary currency on the voucher is_multi_currency = False #loop on the voucher lines to see if one of these has a secondary currency. If yes, we need to see the options for voucher_line in line_dr_ids+line_cr_ids: - line_currency = voucher_line.get('move_line_id', False) and self.pool.get('account.move.line').browse(cr, uid, voucher_line.get('move_line_id'), context=context).currency_id - if line_currency: + line_id = voucher_line.get('id') and self.pool.get('account.voucher.line').browse(cr, uid, voucher_line['id'], context=context).move_line_id.id or voucher_line.get('move_line_id') + if line_id and self.pool.get('account.move.line').browse(cr, uid, line_id, context=context).currency_id: is_multi_currency = True break return {'value': {'writeoff_amount': self._compute_writeoff_amount(cr, uid, line_dr_ids, line_cr_ids, amount, type), 'is_multi_currency': is_multi_currency}}