[FIX] traceback from journal vouchers
authorForam Katharotiya (OpenERP) <fka@tinyerp.com>
Tue, 6 Aug 2013 12:58:54 +0000 (18:28 +0530)
committerForam Katharotiya (OpenERP) <fka@tinyerp.com>
Tue, 6 Aug 2013 12:58:54 +0000 (18:28 +0530)
bzr revid: fka@tinyerp.com-20130806125854-txgvpzvkpc928v09

addons/account_voucher/account_voucher.py

index 4f383a1..90bfd01 100644 (file)
@@ -915,7 +915,7 @@ class account_voucher(osv.osv):
         #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
         #this common mistake, we simply reset the amount to 0 if the currency is not the invoice currency.
-        if context.get('payment_expected_currency') and currency_id != context.get('payment_expected_currency'):
+        if context and context.get('payment_expected_currency') and currency_id != context.get('payment_expected_currency'):
             vals['value']['amount'] = 0
             amount = 0
         res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, amount, currency_id, ttype, date, context)