[MERGE] Account_voucher: Payment Invoice is not considering the currency in Invoice

bzr revid: mra@mra-laptop-20110113104250-pmis2qekfmf2cf48
This commit is contained in:
Mustufa Rangwala 2011-01-13 16:12:50 +05:30
commit a3090b6841
1 changed files with 5 additions and 0 deletions

View File

@ -45,6 +45,11 @@ class account_voucher(osv.osv):
def _get_journal(self, cr, uid, context=None):
if context is None: context = {}
journal_pool = self.pool.get('account.journal')
invoice_pool = self.pool.get('account.invoice')
if context.get('invoice_id', False):
currency_id = invoice_pool.browse(cr, uid, context['invoice_id'], context=context).currency_id.id
journal_id = journal_pool.search(cr, uid, [('currency', '=', currency_id)], limit=1)
return journal_id and journal_id[0] or False
if context.get('journal_id', False):
return context.get('journal_id')
if not context.get('journal_id', False) and context.get('search_default_journal_id', False):