The loop would only consider models that have >0 records registered in ir.model.data. This is merge of commits 3988ebf4dc130, 070e7d6ac717de and adapt to trunk. bzr revid: p_christ@hol.gr-20101116163510-yemzlcy0f0yk893l