Soak the beans. The fresher the beans the less you have to soak but if they are old, soak at least for 24 hours. You can use tins but I've tried both and dried tastes so much better.
Drain the beans. Take a large cooking pot.
Add the oil, then onions, cumin, oregano, tomato puree, garlic, one by one, frying and stirring in between.
Add tinned tomatoes, the soaked chillies, the sugar, the orange juice, and keep tasting and seasoning.
Cook for 3 hours at least or until beans are soft. Keep checking every half hour or so and add water if it looks like getting dry.