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

* fix: Incorrect exchange rate in payment entries

* test: Update failing tests
This commit is contained in:
Deepesh Garg 2023-01-10 20:12:43 +05:30 committed by GitHub
parent 58ad79d3e8
commit 0ed938a490
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()