While moving to a new iPhone, don’t forget to make this new phone a trusted device with Apple. By doing so, whenever you’re prompted to provide a security code, your new iPhone 7 is one of the choices to receive this security challenge. If you don’t make this update, then your security challenge will most likely go to your old iPhone that you probably don’t have with you.
Go to Apple ID to manage trusted devices. Check under Account – Security and look at Trusted Devices. Verify devices as needed or remove devices that are no longer valid.