ERPNext v16.3 – Fix Update Items in Sales Order

We are facing an issue in ERPNext version 16.3 related to updating items in Sales Order.

Issue details:

  • When adding items to a Sales Order:

    • The first row works correctly: after selecting an item, the price and item details are fetched properly.

    • Starting from the second row onward, after selecting a different item, the system still fetches item details (via get_item_details) using the item_code of the first row.

  • As a result:

    • The price, rate, and other item-related fields are incorrect for rows after the first one.

    • get_item_details seems to always receive or reuse the first item’s item_code instead of the currently selected row’s item.

In ERPNext v16.3, the issue usually happens because:

  • The Item field onChange event is not correctly bound to the current child row context (cdt, cdn)

  • Or the code reads item_code from frm.doc.items[0] (first row) instead of the active row

  • As a result, when get_item_details is triggered, it always receives the item_code of the first row

Please raise github issue, it will solve faster there.

1 Like

I like how you went into the code and identified the core probelm :ok_hand:

Is this a typo as i can only find 16.3.0 on github as of today (29 Jan 2025)

1 Like

You’re right, I made a mistake — it’s a bug in version 16.3.

I’ve created this issue on GitHub.

2 Likes