Skip to content

Bug: Purchase Return / Debit Note marked as Paid makes original Purchase Invoice become Overdue #53844

@Vicory75

Description

@Vicory75

Information about bug

There seems to be an issue in the handling of Purchase Invoice Returns / Debit Notes when the original supplier invoice has already been fully paid and the supplier has already refunded the full amount.

Scenario

  • A Purchase Invoice is created for goods received from a supplier.
  • The invoice is fully paid and correctly shows Paid.
  • Later, the goods are returned to the supplier.
  • The supplier refunds the full amount already paid.
  • From the original Purchase Invoice, a Return / Debit Note is created.
  • On the Return Purchase Invoice, Is Paid is set because the refund has already been received.

Problem
When the Return / Debit Note Purchase Invoice is submitted:

  • the refund is correctly registered,
  • but the original Purchase Invoice changes from Paid to Overdue.

This seems incorrect, because:

  • the original supplier invoice was already fully paid,
  • the refund / debit note has also already been settled,
  • therefore the original invoice should not become overdue
  • the account in charge of this cash movement wrongly delete the first outgoing cash flow and register an incoming cash flow.

Expected Behavior
After submitting the Purchase Return / Debit Note:

  • the original Purchase Invoice should remain Paid (or at least not become Overdue),
  • the Return / Debit Note should reflect the refund correctly,
  • both documents should represent a fully settled situation
  • the account in charge of this cash movement should report an outgoing cash flow and later an equivalent incoming cash flow of equivalent value.

Actual Behavior
After submitting the Return / Debit Note Purchase Invoice:

  • the original Purchase Invoice status changes to Overdue,
  • even though both:
    • the original supplier invoice was paid,
    • and the supplier refund has already been received.

Suspected Cause
This seems related to the field: Update Outstanding for Self
On the Return / Debit Note Purchase Invoice:

  • it is enabled by default,
  • even if manually disabled, it gets re-enabled on Save,
  • therefore it seems impossible to prevent the outstanding update behavior.

This may be causing the system to incorrectly reopen or alter the outstanding amount of the original Purchase Invoice.

Steps to Reproduce

  1. Create a Purchase Invoice for a supplier.
  2. Submit it.
  3. Fully pay it so that its status becomes Paid.
  4. Create a Return / Debit Note from that Purchase Invoice.
  5. Mark the Return / Debit Note as Is Paid (because the supplier has already refunded the amount).
  6. Submit the Return / Debit Note.

Result:
The original Purchase Invoice changes to Overdue.

Business Logic Concern
From an accounting / operational perspective, this flow should represent:

  • an original payable that was settled,
  • and a later supplier refund that was also settled.
    So the final state should not leave the original invoice appearing as unpaid / overdue.

Additional Notes
This seems especially problematic in real workflows where:

  • goods are returned after payment,
  • supplier reimbursement is already completed,
  • and users need the accounting status to remain consistent.
    It happens the same also for services or not product in stocks

It would be helpful to clarify whether:

  1. this is a bug in status calculation,
  2. Update Outstanding for Self should be user-controllable on return debit notes,
  3. or whether ERPNext expects a different accounting flow for this case.

Module

accounts

Version

ERPNext: v15.81.1
Frappe Framework: v15.84.0

Installation method

docker

Relevant log output / Stack trace / Full Error Message.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions