With a flight Spain, France, Dubai, BKK, departure country( for TP)is Spain or France as it is where I board the international flight?
TLDR : Answer Summary
In the case of flying to Bangkok with a boarding point in either Spain or France, the departure country for the tourist permit (TP) would be considered Spain, as it is the origin of the international flight.