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