Just to add to what @theSLAYER said: this works for transfers that would legitimately be allowed in the real games. That is:
back and forth between Gen 1 and 2 (for Gen 1 Pokémon)
Gen 3 to Gen 4, 5, 6, 7 or 8
Gen 4 to Gen 5, 6, 7 or 8
Gen 5 to Gen 6, 7 or 8
Gen 1, 2 or 6 to Gen 7 or 8
Gen 7 to Gen 8
Let's Go Pikachu/Eevee to Gen 8
This always assumes a non-dexited Pokémon if going into Gen 8, of course, and any transfer to Gen 8 will technically be illegal without a HOME tracker.