Friday, March 26, 2021
1 change · master
New functionality added to Odoo
Odoo now checks during startup whether custom code is overriding features that still exist. This helps catch outdated or renamed business logic earlier, reducing the risk of silent feature loss or hard-to-trace bugs.
Original PR description
Problem: methods can be removed or renamed, and their overrides can be missed in the meantime, generating dead code and possibly losing features / adding bugs which can be hard to track. On registry…
Problem: methods can be removed or renamed, and their overrides can be missed in the meantime, generating dead code and possibly losing features / adding bugs which can be hard to track. On registry load, looks for `super` in methods, tries to find out what they're looking for in a superclass and checks if that thing exists. Has some impact on registry loading (on my machine, with 500 modules loaded the check costs 1.5s to ~10s, it also shouldn't cost that much on re-check e.g. module installations as the classes are "cached"). TODO: probably remove the jump handler for 3.5? I don't think we support that in master. TODO: check the 15 methods it's currently finding to see what's to fix e.g. remove outdated method or rename an override of a renamed method From a request of @fmdl in #53450, this solution is more CPU-expensive than an explicit `@overrides` but generates far less code churn to produce results: methods don't need to be annotated to be checked, meaning we can't forget annotating methods (unless we make the annotation a requirement à la C# I guess, but that would be *a lot* of code churn).