Registering a model that is the target of a O2M result in the removal of previously added automatic indexes
This happens in the case where the target of the O2M is the only model from this relation to be registered in the module.
This is due to the fact that the call to __setup__
resets _sql_indexes
but since the origin of the O2M field is not registered the automatically added indexes won't be added again.
I see two ways to fix that:
- Differentiate the automatically added indexes from the others
- Not reset the indexes once they've been set in
__setup__
I opted for the second solution.