New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[13.0][REF] base_changeset: remove base model inheritance #2194
base: 13.0
Are you sure you want to change the base?
Conversation
Using the base model implies adding the changeset fields and methods for all models in the system. This is causing errors when the module is updated, as recorded in issue OCA#2187. Usually the practice is not to perform this kind of inheritance, but to create a new Abstract Model to be used to add such functionalities. This MR intends to perform this modifications so that the models that should be provided with the changeset fields and methods can simply inherit from this new Abstract Model. To do so, new modules can be developed for each desired behaviour (for example purchase_changeset, sale_changeset...).
So this way the module become useless by itself, because it will require extra development for each model we want to use this functionality with. This was unwanted in my initial idea of this module. |
It's true, but inheriting directly from base and adding all the fields for all models seems to cause issues, specially when dealing with DB having lots of models. In other similar cases I have seen that the typical approach is to have a base module adding the core fields and methods in a new abstract model, and then modules are developed on top for the different areas where it could be needed. I have tried this new approach together with a new purchase_changeset module for purchase related models and worked fine without the issue detected when inheriting from base. I wanted to share it to have opinions on it. |
One intermediate option can be to attach this feature to |
I guess this would cover a wide quantity of models, but still models like |
Attaching this feature to |
I am not sure on changing such core method behavior... |
Using the base model implies adding the changeset fields and methods for all models in the system. This is causing issues when the module is updated, as recorded in #2187.
Usually the practice is not to perform this kind of inheritance, but to create a new Abstract Model to be used to add such functionalities.
This MR intends to perform this modifications so that the models that should be provided with the changeset fields and methods can simply inherit from this new Abstract Model. To do so, new modules can be developed on top of this base module (for example a module purchase_changeset or sale_changeset).
This MR is currently a proposal opened to discussion. The tests have not yet been adapted.