What affects a trader/store generating caps?

The "more idle settlers equals higher income" thing was going around various places early on in the game release but is not true.

Cap generation is based on the total population at your settlement and whether they're assigned to a task or not is irrelevant (you'll make the same money from a settlement with 15 people all assigned to something as you will from a settlement with 15 people with 5 of them not assigned to anything). This is also as stated on the Fallout Wikia page for Trading Posts:

Assigning settlers to these trading stands will increase settlement happiness and produce a profit of caps based on population size. Caps can be collected from the settlement's inventory by accessing the workbench.