[fix] Set amounts only if party and bank account exists

This commit is contained in:
Nabin Hait 2016-07-27 13:07:52 +05:30
parent 548ea777a9
commit 2a2346422d

View File

@ -251,8 +251,8 @@ class PaymentEntry(AccountsController):
self.unallocated_amount = party_amount - self.total_allocated_amount
def set_difference_amount(self):
base_unallocated_amount = flt(self.unallocated_amount) * \
(self.source_exchange_rate if self.payment_type=="Receive" else self.target_exchange_rate)
base_unallocated_amount = flt(self.unallocated_amount) * (flt(self.source_exchange_rate)
if self.payment_type=="Receive" else flt(self.target_exchange_rate))
base_party_amount = flt(self.base_total_allocated_amount) + flt(base_unallocated_amount)
@ -672,7 +672,7 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
pe.setup_party_account_field()
pe.set_missing_values()
if bank:
if party_account and bank:
pe.set_exchange_rate()
pe.set_amounts()
return pe