[fix] Set amounts only if party and bank account exists
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 28978cd..3eed70c 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -251,8 +251,8 @@
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 @@
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
\ No newline at end of file