Recording AP - Quick Question

Hey, this is a stupid question but my brain is just going crazy from studying that I can't figure this out.. When does an entity record accounts payable for goods ordered? Is it when they receive the goods (preparation of receiving reports), when they place an order, or at other times??