Delivery note link logic with Return docuemnt

Dear Team,

I created a Delivery Note and then generated a Sales Invoice from the same Delivery Note. After that, I returned the Sales Invoice using the Create button. As a result, the original Sales Invoice status changed to Credit Note Issued, and a return document was created.

Next, I opened the Delivery Note through the Connections section and created a Sales Return. The Delivery Note status then changed to Return Issued.

However, when I checked the Connections section of both the Sales Return document and the Credit Note document, the same Delivery Note was displayed with the status Return Issued.

Could someone please clarify why the same Delivery Note is linked to both documents and why it appears in the Connections section of both the Sales Return and Credit Note?

I looked into this in the code.

For the Credit Note, the Delivery Note shows up in Connections because the Sales Invoice items store the Delivery Note number. When you return the invoice, the Credit Note copies that number from the original items. So the Delivery Note is linked to it through the invoice.

The “Return Issued” status belongs to the Delivery Note itself. That’s why you see the same status wherever the Delivery Note appears.

For the Sales Return, I couldn’t find anything in the code that adds the original Delivery Note to its Connections. What it does have is a “Return Against” field that points to the original Delivery Note. Could you send me a screenshot of the Sales Return’s Connections, so I can see exactly where you’re seeing the Delivery Note?

The two documents do different jobs. The Credit Note reverses the billing, and the Sales Return reverses the stock. Nothing is duplicated.

Actually, my doubt is about the return documents: Credit Note Issued and Return. Both documents are linked to the same Delivery Note, correct?

After completing the entire return cycle, when I check the Delivery Note’s connections, both return documents are displayed, and the Delivery Note status shows Return Issued for both connections.

Why does this happen? My doubt is why both documents are linked to the same Delivery Note and why the same status is displayed for both.

From your screenshot there is only one Delivery Note, and its status is “Return Issued”. The Credit Note and the Sales Return both link back to that one Delivery Note, so when you open either of them you see the same Delivery Note and the same status.

The status doesn’t belong to the Credit Note or the Sales Return. It belongs to the Delivery Note. Once its items have been returned (your “% Returned” bar is full), the Delivery Note becomes “Return Issued”, and that is what you see wherever it is shown.

The Credit Note and the Sales Return have their own statuses. The original Sales Invoice shows “Credit Note Issued” because it has been returned. Open each return document directly to see its own status.

Please check the two Delivery Notes: one is the original stock-out Delivery Note, and the other is the stock-in Delivery Note created for the return.

In the invoice section, we have two documents: Credit Note Issued and Return. The Delivery Note connections should be as follows:

  1. Credit Note Issued: It should be linked to the original stock-out Delivery Note associated with the Sales Invoice.

  2. Return: It should be linked to the second Delivery Note created for the stock return.

However, currently, both documents are showing the same Delivery Note connection instead of their respective Delivery Notes.

Could you please check why this is happening and clarify whether the document connections are working as expected?

I checked the code. When a credit Note is created from the Sales invoice, its item rows copy the delivery_note and dn_detail values from the original invoice rows. So the Credit Note links to the original stock-out Delivery Note, which matches your expectation.

The return Delivery Note is a separate document. It is linked to the original through its Return Against field, not through the invoice. There is no field that links the Credit Note to the return Delivery Note, so the Credit Note never shows it in its Connections. Both the Credit Note and the return Delivery Note point back to the same original Delivery Note.

This is how the standard return flow is built, so it’s not a bug in your setup. If you want the Credit Note to link to the return Delivery Note, that would be a feature request or a custom link.

The Connections view is showing documents that reference the Delivery Note; it doesn’t mean the two returns are the same transaction. The Credit Note can retain the Delivery Note link through its invoice item rows, while the Sales Return references it as the original Delivery Note. Check return_against and the item rows on both documents. If both were submitted for the same goods, verify stock and accounting impact to avoid recording the return twice.