mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-06 23:10:26 +00:00
@@ -1131,41 +1131,17 @@ 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:
|
|
||||||
gle = party_gl_dict.copy()
|
|
||||||
|
|
||||||
if self.payment_type == "Receive":
|
|
||||||
amount = self.base_paid_amount
|
|
||||||
else:
|
|
||||||
amount = self.base_received_amount
|
|
||||||
|
|
||||||
exchange_rate = self.get_exchange_rate()
|
|
||||||
amount_in_account_currency = amount * exchange_rate
|
|
||||||
gle.update(
|
|
||||||
{
|
|
||||||
dr_or_cr: amount,
|
|
||||||
dr_or_cr + "_in_account_currency": amount_in_account_currency,
|
|
||||||
"against_voucher_type": "Payment Entry",
|
|
||||||
"against_voucher": self.name,
|
|
||||||
"cost_center": self.cost_center,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
gl_entries.append(gle)
|
|
||||||
else:
|
|
||||||
for d in self.get("references"):
|
for d in self.get("references"):
|
||||||
# re-defining dr_or_cr for every reference in order to avoid the last value affecting calculation of reverse
|
# re-defining dr_or_cr for every reference in order to avoid the last value affecting calculation of reverse
|
||||||
dr_or_cr = "credit" if self.payment_type == "Receive" else "debit"
|
dr_or_cr = "credit" if self.payment_type == "Receive" else "debit"
|
||||||
cost_center = self.cost_center
|
cost_center = self.cost_center
|
||||||
if d.reference_doctype == "Sales Invoice" and not cost_center:
|
if d.reference_doctype == "Sales Invoice" and not cost_center:
|
||||||
cost_center = frappe.db.get_value(
|
cost_center = frappe.db.get_value(d.reference_doctype, d.reference_name, "cost_center")
|
||||||
d.reference_doctype, d.reference_name, "cost_center"
|
|
||||||
)
|
|
||||||
|
|
||||||
gle = party_gl_dict.copy()
|
gle = party_gl_dict.copy()
|
||||||
|
|
||||||
allocated_amount_in_company_currency = self.calculate_base_allocated_amount_for_reference(
|
allocated_amount_in_company_currency = self.calculate_base_allocated_amount_for_reference(d)
|
||||||
d
|
|
||||||
)
|
|
||||||
reverse_dr_or_cr = 0
|
reverse_dr_or_cr = 0
|
||||||
|
|
||||||
if d.reference_doctype in ["Sales Invoice", "Purchase Invoice"]:
|
if d.reference_doctype in ["Sales Invoice", "Purchase Invoice"]:
|
||||||
@@ -1212,6 +1188,13 @@ class PaymentEntry(AccountsController):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if self.book_advance_payments_in_separate_party_account:
|
||||||
|
gle.update(
|
||||||
|
{
|
||||||
|
"against_voucher_type": "Payment Entry",
|
||||||
|
"against_voucher": self.name,
|
||||||
|
}
|
||||||
|
)
|
||||||
gl_entries.append(gle)
|
gl_entries.append(gle)
|
||||||
|
|
||||||
def make_advance_gl_entries(
|
def make_advance_gl_entries(
|
||||||
|
|||||||
Reference in New Issue
Block a user