Hi, checking the code the error you mention is raised when in purchase line the field "Drop Shipment" or the field "Special Order" are marked: can you please check them?
They can be set if you run the drop shipment function on the order or if the "Purchase Code" field has been set up as a special order.