Following up How to use party.replace? I’m about writing a small tool to search for all references to be replaced by the
party.replace wizard. My idea is to iterate over all models, then search all Many2One fields referencing to
Now there are two issues:
When checking all Models, in the official modules this gave 68 references which are not replaced. E.g.
('party.party-party.category', 'party'). Not sure whether these are not replaced intentionally.
When checking only sub-classes of
ModelSQL, in the official modules 40 references which are replaced are not found. E.g.
('bank.account-party.party', 'owner'), which is very curious:
bank.account-party.partyis a subclass of
isinstance(model, ModelSQL)is False and
The reason for restriction to
ModelSQLis to not report references in e.g. Wizard state.
So the question is: How to check whether a field needs to be replaced?