Preheat the oven to 200°C/400°F fan/gas 6. Lightly oil a non-stick baking tray.
Heat the oil in a non-stick frying pan over a medium heat and add the onion and mushrooms. Cook for 4–6 minutes until softened. Add the herbs and garlic and cook for another 30 seconds. Set aside to cool.
Put the pulses, oats and tomato purée in a food processor and blitz until well combined. Add the onion mixture, salt and pepper and blitz again. (I like to leave plenty of texture but feel free to blitz for longer if you prefer.) Add the pine nuts and pulse a couple of times to combine. With slightly damp hands, form the mixture into golf-ball or walnut-sized balls (you should get 12–16 balls, depending on size). Place the beanballs on the oiled baking tray and drizzle with a little more oil. Bake in the oven for 18–20 minutes, turning once.
Meanwhile, make the tomato sauce. Heat the oil in a sauté or deep-sided frying pan over a medium heat. Add the onion and cook for 4–6 minutes until softened but not coloured. Add the garlic and chilli (if using) and cook for 30 seconds until fragrant.
Add the passata, stock and sugar. Season with salt and black pepper, stir and bring to the boil. Reduce the heat and simmer gently for 10 minutes. Stir in the balsamic vinegar and basil.
Remove the beanballs from the oven and drop them gently into the tomato sauce. Simmer over a low heat for 3–4 minutes, turning once in the sauce. Scatter with basil and serve with spaghetti, rice or couscous.