chore: code cleanup

This commit is contained in:
ruthra kumar 2023-07-10 15:28:10 +05:30
parent 1bcb728c85
commit cd42b26839
2 changed files with 6 additions and 8 deletions

View File

@ -363,12 +363,6 @@ class PaymentReconciliation(Document):
payment_details = self.get_payment_details(row, dr_or_cr)
reconciled_entry.append(payment_details)
# if payment_details.difference_amount and row.reference_type not in [
# "Sales Invoice",
# "Purchase Invoice",
# ]:
# self.make_difference_entry(payment_details)
if entry_list:
reconcile_against_document(entry_list, skip_ref_details_update_for_pe)

View File

@ -972,9 +972,12 @@ class AccountsController(TransactionBase):
"""
Make Exchange Gain/Loss journal for Invoices and Payments
"""
# Cancelling existing exchange gain/loss journals is handled in on_cancel event in accounts/utils.py
# Cancelling existing exchange gain/loss journals is handled during the `on_cancel` event.
# see accounts/utils.py:cancel_exchange_gain_loss_journal()
if self.docstatus == 1:
if self.get("doctype") == "Journal Entry":
# 'args' is populated with exchange gain/loss account and the amount to be booked.
# These are generated by Sales/Purchase Invoice during reconciliation and advance allocation.
if args:
for arg in args:
if arg.get("difference_amount", 0) != 0 and arg.get("difference_account"):
@ -1035,6 +1038,7 @@ class AccountsController(TransactionBase):
"exchange_rate": 1,
"cost_center": erpnext.get_default_cost_center(self.company),
# TODO: figure out a way to pass reference
# throws 'Journal Entry doesn't have {account} or doesn't have matched account'
# "reference_type": self.doctype,
# "reference_name": self.name,
# "reference_detail_no": arg.idx,
@ -1049,7 +1053,7 @@ class AccountsController(TransactionBase):
journal_entry.submit()
if self.get("doctype") == "Payment Entry":
# For Payment Entry, exchange_gain_loss field in the `reference` table is the trigger for journal creation
# For Payment Entry, exchange_gain_loss field in the `references` table is the trigger for journal creation
gain_loss_to_book = [x for x in self.references if x.exchange_gain_loss != 0]
booked = []
if gain_loss_to_book: