Skip to content

Delivery Note billing percent and status do not consider returns from non‑invoiced items (example: 93.55% billed + 0.04% returned) #52647

@rizwan100mu

Description

@rizwan100mu

Information about bug

Image

Description
In a Delivery Note where most of the amount is already invoiced, and a return is made only from the non invoiced items, the system does not treat this return as closing the remaining billable portion.
Concrete example from our system:
• Before any return:
• % Amount Billed = 93.55%
• % Returned = 0.00%
• Status = Partially Billed
• After creating a Delivery Note Return only for non invoiced quantity:
• % Amount Billed is still 93.55%
• % Returned = 0.04%
• Status is still Partially Billed
In this scenario, the invoiced items are already fully billed, and 0.04% has been returned from the non‑invoiced side. The Delivery Note does not reflect that part of the remaining unbilled percent has actually been settled via return.

When we then create another Delivery Note Return for the entire remaining non‑invoiced quantity (so that nothing is left to bill: all items are either invoiced or returned), the status still stays Partially Billed because % Amount Billed is not updated to 100%. The system continues to calculate the billed percent only against the original Delivery Note amount and ignores the fact that the remaining unbilled quantity has been fully returned.


Steps to reproduce

  1. Create a Delivery Note, for example with total amount = 1000.
  2. Create Sales Invoice(s) against this Delivery Note so that:
    • Invoiced amount ≈ 935.50
    • % Amount Billed on the Delivery Note becomes 93.55%
    • Status = Partially Billed
  3. There is still some non invoiced quantity/amount left (about 6.45%).
  4. Create a Delivery Note Return against the same Delivery Note:
    • Select only non invoiced items/qty.
    • Return a small part of that non invoiced quantity so that % Returned on the original Delivery Note shows 0.04%.
    • Submit the return.
  5. Open the original Delivery Note again.
    Actual result
    • % Amount Billed remains 93.55% (same as before the return).
    • % Returned = 0.04%.
    • Status = Partially Billed.
    Effectively we now have:
    • 93.55% of the Delivery Note is invoiced.
    • 0.04% of the Delivery Note is returned from the non invoiced portion.
    • A small balance remains that is neither invoiced nor returned.
    However, the UI only shows “93.55% billed, 0.04% returned, Partially Billed”, which is confusing because the return from non invoiced items does not help to close the open billing status.

Expected behavior
• When a return is created from non invoiced items, that returned part should be considered as “settled” together with the invoiced part.
• Conceptually, the settled percent should be:
• Before return:
• Settled = 93.55% (only invoiced part).
• After the 0.04% return from non invoiced qty:
• Settled = 93.55% + 0.04% = 93.59%.
• More importantly, once 100% of the remaining non invoiced quantity is returned, then:
• Every item on the Delivery Note is either invoiced or returned.
• Effective settlement = 100%.
• The Delivery Note should no longer appear as Partially Billed; it should move to a fully closed state (e.g. Completed / Fully Billed / Closed, as per design).
In short: the system should allow “invoiced + returned (from non invoiced items)” to reach 100% and close the Delivery Note.


Why this is a problem
• Users see Partially Billed even when all practically billable quantity is either invoiced or returned.
• Reports based on status or % Amount Billed show such Delivery Notes as still open, which is misleading for finance and operations.
• It makes reconciliation harder, because the document looks partially billed even though there is nothing meaningful left to bill after all remaining items have been returned.


Suggested change
• Adjust Delivery Note billing/status logic so that:
• Returns from non invoiced quantities reduce the effective billable base.
• The system computes a settlement percent that includes:
• invoiced amount, plus
• returned amount from non invoiced lines.
• When this settlement percent reaches 100%, the Delivery Note is automatically marked as fully settled and status updated accordingly.

Module

stock

Version

V15 v16

Installation method

None

Relevant log output / Stack trace / Full Error Message.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions