Yeah, I know that, but the vehicles are running empty. However I should have mentioned it, sorry.
Then there is either something wrong with r27893, or you are setting the orders incorrectly. I can not reproduce this issue in 1.7.1
Just to be sure, are you trying it on horse vehicles? The other vehicles are refitting as expected.
I attached a screenshot from quick test, where you can see the vehicle didn't refit while in the station (should have been refitted to coal). These exact orders do work on non horse vehicles as I expect (refit at station when emptied present cargo), so I don't think I am doing something wrong.
Please note I didn't include the unload command just because the vehicles will never get any cargo in this case. In real game I have included them, of course.
Found it. Its a rather interesting bug.
It will happen to any articulated vehicle in which the first part of the vehicle doesn't carry cargo (horse carriges and trailers), and you try to refit it to the default cargo of the vehicle (coal for a hopper, wood for flatbed...).