-
-
Notifications
You must be signed in to change notification settings - Fork 818
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
Deprecate base_contact #120
Conversation
@@ -34,6 +45,7 @@ Contributors | |||
* Sandy Carter <bwrsandman@gmail.com> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use my savoirfairelinux email? sandy.carter@savoirfairelinux.com while you're there
This is a case study for me. |
I'll do some checks and let you know. |
I did this:
The bold lines are the necessary steps for sysadmins to follow, and nothing was broken. |
@yajo great initiative, but you definitely need migration scripts for that. At the very least, you need to migrate the xmlids of the fields's ir.model.fields record to the appropriate new module (see OCA/OpenUpgrade#303 for discussion, I just stumpled upon this one yesterday). Otherwise, odoo will drop the columns if you deinstall the then obsolete base_contact. |
Ignore last update, it's just a rebase. @hbrunn Thanks but I don't understand you very well... Can you explain better please? And if you have any docs (or at least examples) for that, they'll be very appreciated. |
@yajo when you deinstall a module, odoo unlinks all records that have an xml id (look at the table For documentation, use the source: https://github.com/odoo/odoo/blob/8.0/openerp/models.py#L356 Now on module deinstallation, odoo unlinks the But in this case, the xmlid belongs to the module To fix that, create a file
This will run if you update Please don't hesitate to ask if something is still unclear |
Thanks, it's clear now. I also found https://github.com/odoo/odoo/blob/8ff7230e2d6d49e5b880fbee9589de1e8a78fb95/openerp/modules/migration.py#L38 useful. I'm on it. |
@hbrunn Well spotted. After uninstalling, fields were removed. Last update fixes that. Thank you! |
@hbrunn Many thanks for the advice! |
Rebased to see if that fixes the runbot builds. |
Can anyone help me fixing the runbot error please? It seems to me like it's treating the deprecation warning as an error, but it's the expected behavior. |
Runbot is sending fails to github when it has a warning status |
import logging | ||
|
||
|
||
logging.getLogger(__name__).warn("This module is DEPRECATED. See README.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warnings from runbot come from here, but it's a normal deprecation warning. Nothing to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That this will flash every time a server worker is launched even if the module isn't installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if that can be avoided...
@yajo: can you replace your logging statement with the following code:
|
@gurneyalex Doing that in my tests logs nothing. Are you sure you want me to push that? Another solution is to downgrade the message to info, but IMHO it should be a warning. |
I opted for transforming the warn in info to fix the checks. |
@yajo yes DeprecationWarnings are ignored by default (https://docs.python.org/2.7/library/warnings.html?highlight=warnings#warning-categories) If you prefer having a WARNING log level (and I agree this is better than Info), you could check the hostname of the server. If it matches runbot.*.odoo-community.org then don't log. I can make sure that the runbot has an environment variable set (e.g. OCA_RUNBOT) and you can use this rather than the fqdn for the test. And the best way of doing this is to use code such as the following: in the init.py of your module:
(caution, I did not test this, there may by typos). Addind '.deprecated' is important so that the loggers in the other files of the modules are not impacted. |
I removed the name part because anyway the logger already logs that automatically. Let's see if this time it passes the checks. |
@yajo I did not have time to update the runbot, so it will fail. |
Can you explain yourself better, please? Sorry, I did not understand. |
fixed typo in my comment. |
Then what should I do now? |
@gurneyalex Have you updated it already? |
Really I'm just renaming partner_contact_base. The new name is more self-explanatory.
- Remove nationality and birthday features. - Move the remaining features to partner_contact_in_several_companies. - Make base_contact a dummy module. - Warn deprecation everywhere possible.
OK, finally merging |
Hi, sorry I arrive late in the discussion and this is now merged, but I think the warning should be moved somewhere that is executed only if the module is installed. I'm unsure where though. Maybe Thanks! |
@hbrunn Just checking:
The module version was bumped to 2.0.0, which is equivalent to 8.0.2.0.0. |
Good you asked, I'm not so sure: https://github.com/OCA/OCB/blob/8.0/openerp/modules/migration.py#L96 ff Did anyone try if the migration script runs when upgrading from base_contact after this version number change? If not, that's a serious problem when people uninstall base_contact. @lepistone I have the same problem. |
ping @dreispt (just to avoid you missed my previous non-attributed post) |
@hbrunn I didn't test. I guess the relevant pieces of code are:
From the code, I'm guessing it should work... |
@dreispt yes I just debugged thourgh it. There are some curious transformations of the version string, and it works out in the end. So nothing to do and sorry for the noise |
@hbrunn Thanks for your time checking that. |
@hbrunn about the init hook: I'm not sure myself, as that would be shown only on module installation. Where would you put them, and with which log level? Thanks! |
@lepistone I was thinking about raising in the init hook, but that indeed doesn't do anything for existing installations. Another possibility might be setting For new users, I'd declare an abstract model that gives a warning in its But on the other hand: What's the problem with keeping this module as sort of metapackage? |
The only problem is maintaining deprecated code, but it should work as it is. Indeed the warning raises even when it is not installed, but no idea about how to avoid that. It should be a separate issue anyway. |
This fixes #119.
The new modules:
The old base_contact warns deprecation everywhere.
Old translations preserved where possible with credits.
After merging we can start again with #118.