fix: Incorrect exchange rate in payment entries (#33481)

fix: Incorrect exchange rate in payment entries (#33481)

* fix: Incorrect exchange rate in payment entries

* test: Update failing tests

(cherry picked from commit 0ed938a490)

Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
This commit is contained in:
mergify[bot]
2023-01-10 22:18:59 +05:30
committed by GitHub
parent 39e5aabc57
commit e995e952b5
2 changed files with 4 additions and 4 deletions

View File

@@ -247,7 +247,7 @@ class PaymentEntry(AccountsController):
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:

View File

@@ -743,9 +743,9 @@ class TestPurchaseOrder(FrappeTestCase):
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()