Skip to content

Commit

Permalink
fix: handle partial return against invoices
Browse files Browse the repository at this point in the history
  • Loading branch information
GursheenK committed Nov 13, 2023
1 parent 4a111f7 commit 5b446d4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions erpnext/accounts/doctype/payment_entry/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,9 +1074,7 @@ def add_party_gl_entries(self, gl_entries):

reverse_dr_or_cr, standalone_note = 0, 0
if d.reference_doctype in ["Sales Invoice", "Purchase Invoice"]:
is_return, return_against = frappe.db.get_value(
d.reference_doctype, d.reference_name, ["is_return", "return_against"]
)
is_return = frappe.db.get_value(d.reference_doctype, d.reference_name, "is_return")
payable_party_types = get_party_types_from_account_type("Payable")
receivable_party_types = get_party_types_from_account_type("Receivable")
if is_return and self.party_type in receivable_party_types and (self.payment_type == "Pay"):
Expand All @@ -1086,7 +1084,7 @@ def add_party_gl_entries(self, gl_entries):
):
reverse_dr_or_cr = 1

if is_return and not return_against and not reverse_dr_or_cr:
if is_return and not reverse_dr_or_cr:
dr_or_cr = "debit" if dr_or_cr == "credit" else "credit"

gle.update(
Expand Down

0 comments on commit 5b446d4

Please sign in to comment.