If you have a module with several dependencies or a complex dependency
graph, the system repeats the number of checks of a module.
For example: we have 4 modules A, B, C and D, where A depends on B and C,
B depends on D and C depends on D.
Before this patch, we check once if A is installed, once if B is
installed, once if C is installed and twice id D is installed.
With this patch, D is checked only once.
On this example, the difference is minimal but on worse scenario as
explained on the below issue, the processing time was provoking a
timeout on test platform
https://github.com/odoo/odoo/pull/29779#issuecomment-452821082
Cherry-pick to master of #29779closesodoo/odoo#35185
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>