Delivery note doesn't update sales order's delivered counts

The delivery note doesn’t update ‘delivered count’ on sales order after submission. Delivery note has been seeded with items via ‘get items from sales order’ functionality and there’s a reference to the sales order in the item table on delivery note; also there is a link between sales order and delivery note (delivery note is listed on the sales order)

After submitting the delivery note, I can create another one and can add the previously delivered items again. However, items properly vanish from the stocks.

any pointers as to how do I debug this?

Hi, if you used something like Data Import tool for creation of delivery note, the stock updation will not take place.

The updation happens based on the so_detail field in Delivery Note Item. Kindly check whether or not this field exists and contains proper reference in any item in your DN for which SO wasn’t updated.

Since this field is hidden you can enter the following JS in the console:


select against_sales_order,so_detail from tabDelivery Note Item where parent=‘DN-00090’;
| against_sales_order | so_detail |
| SO-00072 | NULL |
| SO-00072 | NULL |
| SO-00072 | NULL |
| SO-00085 | NULL |
| SO-00072 | NULL |

How do I fix this?

on a side note, I don’t believe this DN was imported; at this moment only data import we do here are items.

Yeah, precisely. Since items are imported and your item table doesn’t contain so_detail during import, so it doesn’t update previous doctype. You can cancel and create a new one, but ensuring so_detail stays.

If you want to import items, make sure you download the items table first and it contains so_detail.

Nonono. Items are imported into stock catalog, not on the delivery note. I’m tracking down the reason for so_detail vanishing, now that you’ve told me what to look for. Thank you. :slight_smile:

1 Like

OK, this is major. I now know what happened. I’ve downloaded the csv of item table to batch-alter the “From warehouse”, and now I see that the exported csv doesn’t contain the so_detail field. I’ll redo the DN by hand, but this effectively renders the download/upload feature useless and dangerous.

AFAIK, this isn’t offered by default for Delivery Note.


For relevant code, see:

@ManasSolanki Is it a bug / feature?

I don’t remember enabling anything. The download/upload buttons where there for me to use, so I did :slight_smile:

What I’m however missing is an update button, that would just update the fields present in CSV, instead of overwriting whole table (and deleting fields not present in CSV); this way I could download the table, remove everything other than row’s unique ID, leave updated ‘From Warehouse’ information and re-upload. Lets be honest, you can’t beat excel when it comes to updating delivery note, invoice or other document having 200+ positions.

1 Like

Hello, how could the value of so_detail be obtained? I have a custom doctype, with a custom script and I need this value to be able to automatically make a delivery note, if you can help me, I would appreciate it