Heat the oil in a large skillet. In a food processor, coarsely grind the onions, and add to the pot. Cook on a medium flame, stirring occasionally, until dark. Transfer the onions to a bowl. Add the quinoa, water, salt, pepper and turmeric, and bring to a boil. Reduce to medium and cook, covered, about 15 minutes: the grain will start opening and showing tiny white points. Stir in the reserved onions and the chestnuts. Serve hot.