mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-15 23:54:59 +00:00
@@ -1222,10 +1222,15 @@ class PaymentEntry(AccountsController):
|
||||
self.setup_party_account_field()
|
||||
|
||||
company_currency = erpnext.get_company_currency(self.company)
|
||||
self.transaction_currency = company_currency
|
||||
self.transaction_exchange_rate = 1
|
||||
|
||||
if self.paid_from_account_currency != company_currency:
|
||||
self.currency = self.paid_from_account_currency
|
||||
self.transaction_currency = self.paid_from_account_currency
|
||||
self.transaction_exchange_rate = self.source_exchange_rate
|
||||
elif self.paid_to_account_currency != company_currency:
|
||||
self.currency = self.paid_to_account_currency
|
||||
self.transaction_currency = self.paid_to_account_currency
|
||||
self.transaction_exchange_rate = self.target_exchange_rate
|
||||
|
||||
gl_entries = []
|
||||
self.add_party_gl_entries(gl_entries)
|
||||
@@ -1304,6 +1309,9 @@ class PaymentEntry(AccountsController):
|
||||
"cost_center": cost_center,
|
||||
dr_or_cr + "_in_account_currency": d.allocated_amount,
|
||||
dr_or_cr: allocated_amount_in_company_currency,
|
||||
dr_or_cr + "_in_transaction_currency": d.allocated_amount
|
||||
if self.transaction_currency == self.party_account_currency
|
||||
else allocated_amount_in_company_currency / self.transaction_exchange_rate,
|
||||
},
|
||||
item=self,
|
||||
)
|
||||
@@ -1348,6 +1356,9 @@ class PaymentEntry(AccountsController):
|
||||
"account_currency": self.party_account_currency,
|
||||
"cost_center": self.cost_center,
|
||||
dr_or_cr + "_in_account_currency": self.unallocated_amount,
|
||||
dr_or_cr + "_in_transaction_currency": self.unallocated_amount
|
||||
if self.party_account_currency == self.transaction_currency
|
||||
else base_unallocated_amount / self.transaction_exchange_rate,
|
||||
dr_or_cr: base_unallocated_amount,
|
||||
},
|
||||
item=self,
|
||||
@@ -1444,9 +1455,16 @@ class PaymentEntry(AccountsController):
|
||||
frappe.db.set_value("Payment Entry Reference", invoice.name, "reconcile_effect_on", posting_date)
|
||||
|
||||
dr_or_cr, account = self.get_dr_and_account_for_advances(invoice)
|
||||
base_allocated_amount = self.calculate_base_allocated_amount_for_reference(invoice)
|
||||
args_dict["account"] = account
|
||||
args_dict[dr_or_cr] = self.calculate_base_allocated_amount_for_reference(invoice)
|
||||
args_dict[dr_or_cr] = base_allocated_amount
|
||||
args_dict[dr_or_cr + "_in_account_currency"] = invoice.allocated_amount
|
||||
args_dict[dr_or_cr + "_in_transaction_currency"] = (
|
||||
invoice.allocated_amount
|
||||
if self.party_account_currency == self.transaction_currency
|
||||
else base_allocated_amount / self.transaction_exchange_rate
|
||||
)
|
||||
|
||||
args_dict.update(
|
||||
{
|
||||
"against_voucher_type": invoice.reference_doctype,
|
||||
@@ -1464,8 +1482,13 @@ class PaymentEntry(AccountsController):
|
||||
args_dict[dr_or_cr + "_in_account_currency"] = 0
|
||||
dr_or_cr = "debit" if dr_or_cr == "credit" else "credit"
|
||||
args_dict["account"] = self.party_account
|
||||
args_dict[dr_or_cr] = self.calculate_base_allocated_amount_for_reference(invoice)
|
||||
args_dict[dr_or_cr] = base_allocated_amount
|
||||
args_dict[dr_or_cr + "_in_account_currency"] = invoice.allocated_amount
|
||||
args_dict[dr_or_cr + "_in_transaction_currency"] = (
|
||||
invoice.allocated_amount
|
||||
if self.party_account_currency == self.transaction_currency
|
||||
else base_allocated_amount / self.transaction_exchange_rate
|
||||
)
|
||||
args_dict.update(
|
||||
{
|
||||
"against_voucher_type": "Payment Entry",
|
||||
@@ -1487,6 +1510,9 @@ class PaymentEntry(AccountsController):
|
||||
"account_currency": self.paid_from_account_currency,
|
||||
"against": self.party if self.payment_type == "Pay" else self.paid_to,
|
||||
"credit_in_account_currency": self.paid_amount,
|
||||
"credit_in_transaction_currency": self.paid_amount
|
||||
if self.paid_from_account_currency == self.transaction_currency
|
||||
else self.base_paid_amount / self.transaction_exchange_rate,
|
||||
"credit": self.base_paid_amount,
|
||||
"cost_center": self.cost_center,
|
||||
"post_net_value": True,
|
||||
@@ -1502,6 +1528,9 @@ class PaymentEntry(AccountsController):
|
||||
"account_currency": self.paid_to_account_currency,
|
||||
"against": self.party if self.payment_type == "Receive" else self.paid_from,
|
||||
"debit_in_account_currency": self.received_amount,
|
||||
"debit_in_transaction_currency": self.received_amount
|
||||
if self.paid_to_account_currency == self.transaction_currency
|
||||
else self.base_received_amount / self.transaction_exchange_rate,
|
||||
"debit": self.base_received_amount,
|
||||
"cost_center": self.cost_center,
|
||||
},
|
||||
@@ -1537,6 +1566,8 @@ class PaymentEntry(AccountsController):
|
||||
dr_or_cr + "_in_account_currency": base_tax_amount
|
||||
if account_currency == self.company_currency
|
||||
else d.tax_amount,
|
||||
dr_or_cr + "_in_transaction_currency": base_tax_amount
|
||||
/ self.transaction_exchange_rate,
|
||||
"cost_center": d.cost_center,
|
||||
"post_net_value": True,
|
||||
},
|
||||
@@ -1562,6 +1593,8 @@ class PaymentEntry(AccountsController):
|
||||
rev_dr_or_cr + "_in_account_currency": base_tax_amount
|
||||
if account_currency == self.company_currency
|
||||
else d.tax_amount,
|
||||
rev_dr_or_cr + "_in_transaction_currency": base_tax_amount
|
||||
/ self.transaction_exchange_rate,
|
||||
"cost_center": self.cost_center,
|
||||
"post_net_value": True,
|
||||
},
|
||||
@@ -1584,6 +1617,7 @@ class PaymentEntry(AccountsController):
|
||||
"account_currency": account_currency,
|
||||
"against": self.party or self.paid_from,
|
||||
"debit_in_account_currency": d.amount,
|
||||
"debit_in_transaction_currency": d.amount / self.transaction_exchange_rate,
|
||||
"debit": d.amount,
|
||||
"cost_center": d.cost_center,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user