Skip to content
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

[16.0][FIX] upgrade_analysis: blacklist + no reinstall + UI tweaks #2739

Open
wants to merge 3 commits into
base: 16.0
Choose a base branch
from

Conversation

pedrobaeza
Copy link
Member

Several patches for problems found when performing a OU analysis:

  • [FIX] Add to blacklist deprecated modules

    Odoo has deprecated such modules with a pre-hook raising an error, so they are not installable anymore.

    This way, we avoid them to be included in the Install Modules Wizard.

  • [IMP] Don't reinstall installed modules

    If a module is already installed, there's no need of reinstalling it.

  • [FIX] Proper UI in forms

    The colspan property of some UI elements were not correctly adjusted to the v16 sytem.

    This commits fixes it.

@Tecnativa

@pedrobaeza pedrobaeza added this to the 16.0 milestone Oct 22, 2023
@OCA-git-bot
Copy link
Contributor

Hi @StefanRijnhart, @legalsylvain,
some modules you are maintaining are being modified, check this out!

@pedrobaeza pedrobaeza force-pushed the 16.0-fix-upgrade_analysis-ui_deprecated_modules branch 2 times, most recently from 60bf9de to 6d14f56 Compare October 22, 2023 16:42
@legalsylvain
Copy link
Contributor

legalsylvain commented Oct 22, 2023

hi @pedrobaeza. Thanks for working on this module.

[FIX] Add to blacklist deprecated modules

👍

[FIX] Proper UI in forms

👍

[IMP] Don't reinstall installed modules. If a module is already installed, there's no need of reinstalling it.

I don't use this module very often, so I don't have a clear point of view. But I remember that the analysis was performed when modules already installed were reinstalled. (but I don't know why).

I'm not available for the next two weeks. I can look at this topic during OCA days in a little more detail.

@StefanRijnhart perhaps you have an opinion on the subject?

@pedrobaeza
Copy link
Member Author

pedrobaeza commented Oct 22, 2023

That part is not altered. The reinstallation takes place the same:

self.env["ir.module.module"].search([("state", "=", "installed")]).write(

This is only for avoiding to reinstall on the first wizard.

@pedrobaeza pedrobaeza force-pushed the 16.0-fix-upgrade_analysis-ui_deprecated_modules branch from 6d14f56 to 899d597 Compare October 22, 2023 18:04
@StefanRijnhart
Copy link
Member

From https://github.com/OCA/server-tools/blob/15.0/upgrade_analysis/upgrade_log.py#L192-L197 I gather that not reinstalling all modules at this point might give different results if the code was updated in the mean time and new data records were added. This is a common situation in the timeframe surrounding a new Odoo release, so it's not completely safe. Maybe this can be made into an option defaulting to 'reinstall already installed modules'?

@pedrobaeza
Copy link
Member Author

Are you sure that statement is still applying? I did the analysis for 16.0, and didn't notice any problem. Anyway, it was just an improvement, so it's not the main fix at all, and I can remove it.

Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[FIX] Add to blacklist deprecated modules

LGTM, but I wonder this list should be better in the apriori.py file of the openupgrade project. (to have all the merged / renamed / deprecated changes in the same place).

[IMP] Don't reinstall installed modules

Not sure to understand. See inline.

[FIX] Proper UI in forms

👍

@@ -1,4 +1,9 @@
BLACKLIST_MODULES = []
BLACKLIST_MODULES = [
"payment_alipay",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. Naive question. How do you know this module is deprecated. it is installable in V16. the only way to find the information is to read the description of the manifest.

https://github.com/odoo/odoo/blob/16.0/addons/payment_alipay/__manifest__.py#L8

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, @legalsylvain, I found it by the hard way, when errors arose, as @hbrunn found out in #3086

@@ -34,7 +34,7 @@ class UpgradeInstallWizard(models.TransientModel):
def _module_ids_domain(self, extra_domain=None):
domain = [
"&",
("state", "not in", ["uninstallable", "unknown"]),
("state", "not in", ["installed", "uninstallable", "unknown"]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to understand. how do you run the analysis of the base module, that is allways installed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for reinstalling things, so no need to reinstall what is already installed.

@StefanRijnhart
Copy link
Member

Are you sure that statement is still applying? I did the analysis for 16.0, and didn't notice any problem. Anyway, it was just an improvement, so it's not the main fix at all, and I can remove it.

This is a valid question. If it is safe to perform the analysis without a reinstall of installed modules (even if new xml records were added to these installed modules in the mean time), it should also be safe to skip this step entirely in the analysis process. We can then generate an analysis by only installing each module once on a fresh database.

This is also easily testable: does a one step analysis and a two step analysis both yield equivalent results?

Copy link
Member

@hbrunn hbrunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've scripted this for myself as creating all databases from scratch for all analysis runs, so I can't really say something about the reinstall question.

@pedrobaeza
Copy link
Member Author

@StefanRijnhart

This is also easily testable: does a one step analysis and a two step analysis both yield equivalent results?

Yes, I ran it and got the same results, that were reflected in OCA/OpenUpgrade#4180.

Odoo has deprecated such modules with a pre-hook raising an error, so
they are not installable anymore.

This way, we avoid them to be included in the Install Modules Wizard.
If a module is already installed, there's no need of reinstalling it.
The colspan property of some UI elements were not correctly adjusted to
the v16 sytem.

This commits fixes it.
@pedrobaeza pedrobaeza force-pushed the 16.0-fix-upgrade_analysis-ui_deprecated_modules branch from 899d597 to 673bbfa Compare October 22, 2024 06:47
@StefanRijnhart
Copy link
Member

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-2739-by-StefanRijnhart-bump-minor, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Oct 22, 2024
Signed-off-by StefanRijnhart
@StefanRijnhart
Copy link
Member

Thanks! The commit to not reinstall modules would have to be ported to17.0

@OCA-git-bot
Copy link
Contributor

@StefanRijnhart your merge command was aborted due to failed check(s), which you can inspect on this commit of 16.0-ocabot-merge-pr-2739-by-StefanRijnhart-bump-minor.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

@pedrobaeza
Copy link
Member Author

This is #3066 hitting

I'm going to deactivate such harmful test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants