Since that fn() is usually called for a single module, it is not worth
fetching all modules' data, but rather group by the menus/reports/views
models.
In the "account-fr" test, this reduces around 2k sql calls.
bzr revid: xrg@linux.gr-20110610094533-0dwg4a4mx3hqmfji