I'm sorry that I have made a mistake. The error occurred because of my code. I'm using salesFormLetter.update(salesTable, transDate, SalesUpdate::DeliverNow, AccountOrder::None, false, false) to do the post of packing slip . The sales order which I want to post has 2 lines with a same item. The first line sales 6, and the second line sales 2. (So the On order qty is 8.) I have updated the salesDeliverNow of the first line to 6, and salesDeliverNow of the second line to 1 by x++, and then post them using salesFormLetter.update(salesTable, transDate, SalesUpdate::DeliverNow, AccountOrder::None, false, false). Then the error occurred.
I have tried to post the same qty using standard form, the error not occurred.
So how can I post them by x++?