Skip to content

Commit

Permalink
fix: payment request rounding in multi-currency and on status update
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed Sep 17, 2023
1 parent 5e21e7c commit 47feb5f
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions erpnext/accounts/doctype/payment_request/payment_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,31 +234,11 @@ def create_payment_entry(self, submit=True):

ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)

if self.reference_doctype in ["Sales Invoice", "POS Invoice"]:
party_account = ref_doc.debit_to
elif self.reference_doctype == "Purchase Invoice":
party_account = ref_doc.credit_to
else:
party_account = get_party_account("Customer", ref_doc.get("customer"), ref_doc.company)

party_account_currency = ref_doc.get("party_account_currency") or get_account_currency(
party_account
)

bank_amount = self.grand_total
if (
party_account_currency == ref_doc.company_currency and party_account_currency != self.currency
):
party_amount = ref_doc.base_grand_total
else:
party_amount = self.grand_total

payment_entry = get_payment_entry(
self.reference_doctype,
self.reference_name,
party_amount=party_amount,
bank_account=self.payment_account,
bank_amount=bank_amount,
bank_amount=self.grand_total,
)

payment_entry.update(
Expand Down

0 comments on commit 47feb5f

Please sign in to comment.