Skip to content

Commit

Permalink
fix: Incorrect exchange rate in payment entries (frappe#33481)
Browse files Browse the repository at this point in the history
* fix: Incorrect exchange rate in payment entries

* test: Update failing tests
  • Loading branch information
deepeshgarg007 authored Jan 10, 2023
1 parent 58ad79d commit 0ed938a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion erpnext/accounts/doctype/payment_entry/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def set_exchange_rate(self, ref_doc=None):
self.set_target_exchange_rate(ref_doc)

def set_source_exchange_rate(self, ref_doc=None):
if self.paid_from and not self.source_exchange_rate:
if self.paid_from:
if self.paid_from_account_currency == self.company_currency:
self.source_exchange_rate = 1
else:
Expand Down
6 changes: 3 additions & 3 deletions erpnext/buying/doctype/purchase_order/test_purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,9 +743,9 @@ def test_advance_paid_upon_payment_entry_cancellation(self):
pe = get_payment_entry("Purchase Order", po_doc.name)
pe.mode_of_payment = "Cash"
pe.paid_from = "Cash - _TC"
pe.source_exchange_rate = 80
pe.target_exchange_rate = 1
pe.paid_amount = po_doc.grand_total
pe.source_exchange_rate = 1
pe.target_exchange_rate = 80
pe.paid_amount = po_doc.base_grand_total
pe.save(ignore_permissions=True)
pe.submit()

Expand Down

0 comments on commit 0ed938a

Please sign in to comment.