refactor: handle forex payment advance entries

This commit is contained in:
ruthra kumar 2023-12-01 12:13:00 +05:30
parent 080aa30407
commit 961bdf0d24

View File

@ -1057,17 +1057,19 @@ class PaymentEntry(AccountsController):
dr_or_cr = "credit" if self.payment_type == "Receive" else "debit" dr_or_cr = "credit" if self.payment_type == "Receive" else "debit"
if self.book_advance_payments_in_separate_party_account: if self.book_advance_payments_in_separate_party_account:
gle = party_gl_dict.copy()
if self.payment_type == "Receive": if self.payment_type == "Receive":
amount = self.base_paid_amount amount = self.base_paid_amount
else: else:
amount = self.base_received_amount amount = self.base_received_amount
gle = party_gl_dict.copy() exchange_rate = self.get_exchange_rate()
amount_in_account_currency = amount * exchange_rate
gle.update( gle.update(
{ {
dr_or_cr: amount, dr_or_cr: amount,
# TODO: handle multi currency payments dr_or_cr + "_in_account_currency": amount_in_account_currency,
dr_or_cr + "_in_account_currency": amount,
"against_voucher_type": "Payment Entry", "against_voucher_type": "Payment Entry",
"against_voucher": self.name, "against_voucher": self.name,
"cost_center": self.cost_center, "cost_center": self.cost_center,