I'm assuming that your integrated magnetometer and IMU has is doing a level of self calibration. Thus if you spin it around it will use the rate gyros to calibrate the magnetic variations. If you disconnect it from the robot you can calibrate it to itself. But when you do that you will be removing the value of calibrating it on the vehicle.
The vehicle itself will produce both magnetic fields as well as distort magnetic fields. (Respectively hard and soft iron effects) When you're calibrating the magnetometer, to be most useful on your robot it must remain fixed in space with respect to the effects of the robot. Since those are the effects that will be most valuable to calibrate out you'll want to calibrate while attached to the robot.
If you do not expect the vehicle to ever significantly pitch or roll then calibrating the magnetometer is likely less important or valuable to get coverage during your calibration routine.
There's a good overview of the needs of calibration of from Analog Devices As an example of how people have calibrated 1D magnetometers (aka compasses) in a much more analog example in boating via Practical Sailor