-
-
Notifications
You must be signed in to change notification settings - Fork 700
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
[FIX] base: Uninstall l10n_it_edi to avoid conflict with l10n_it_fatturapa #3595
Conversation
Hi @pedrobaeza, @MiquelRForgeFlow, @StefanRijnhart, |
581d165
to
140c7b3
Compare
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.
hi. I don't understand why you don't simply write :
if openupgrade.is_module_installed(cr, "l10n_it_fatturapa"):
openupgrade.logged_query(
cr,
"""
UPDATE ir_module_module
SET state='to remove'
WHERE name = 'l10n_it_edi'""",
)
(eventually with an extra where clause where state in ['to install', 'installed', to upgrade'] ...
I mean what you want to ensure is : if l10n_it_fatturapa
is installed, then l10n_it_edi
is not. Right ?
Thanks for having a look! Your proposal would work too, but in my opinion it would work in too many cases: it would edit the state of Maybe it is worth mentioning that |
I don't think so. here, we are the base pre-migration step. so the update of the module to install / update / removed has been done. 2 cases :
don't you think ? (I'm not sure what I say). ;-) |
As far as I can see in #3595 (review), your proposal is to uninstall
Right, there is nothing to do here, but:
So I think this PR's code doesn't have to be changed. Second case
This happens both with or without your proposal. Maybe you are suggesting to check if both
|
yes that was the sense of the text "(eventually with an extra where clause where state in ['to install', 'installed', to upgrade'] ..." but in facts, I wonder if it's a problem of Open Upgrade. I mean, if in version 14, you make an update all of the database with |
75be281
to
3357e81
Compare
Oh I thought that was for
The
|
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.
LGTM.
Note, you can use the module See : OCA/server-tools#2091 |
3357e81
to
d09e091
Compare
], | ||
limit=1, | ||
) | ||
it_edi_module.button_uninstall() |
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.
Why doing 2 times the same?
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.
Thanks for having a look!
Mark as 'to_remove' to avoid raising a conflict; it will be installed anyway,
but we will uninstall it for good in end-migration.
I wrote it in a comment in the code in https://github.com/OCA/OpenUpgrade/pull/3595/files#diff-aec3724a38e5c01c0ea5b62012c57a9145be5ab7058f222be86607cb7c50301fR93-R94.
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.
Yeah, but why it will be installed? You are saying in other comment that is not auto-install. And if it's installed by another module, uninstalling this one will uninstall the other module as well.
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.
Just summarizing a bit and adding a few more details:
In 13.0
DB I have:
name | state |
---|---|
l10n_it_edi | installed |
l10n_it_fatturapa | to upgrade |
When I upgrade to 14.0
without this PR, the error in the description is raised:
odoo.exceptions.UserError: I moduli "ITA - Fattura elettronica - Base" e "Italy - E-invoicing" non sono compatibili.
If I include only the pre-migrate
part of this PR, the migration concludes successfully BUT l10n_it_edi
and l10n_it_fatturapa
are both installed; that is why I also added the end-migration
to uninstall the module.
Now back to your question:
Yeah, but why it will be installed?
l10n_it_edi
is added to the graph of modules to be loaded in https://github.com/odoo/odoo/blob/a46d20c89c24a4e60faef09cf8ad7721bd29d6cc/odoo/modules/loading.py#L341-L345:
cr.execute("SELECT name from ir_module_module WHERE state IN %s" ,(tuple(states),))
module_list = [name for (name,) in cr.fetchall() if name not in graph]
if not module_list:
break
graph.add_modules(cr, module_list, force)
because it is called including the state to_remove
in https://github.com/odoo/odoo/blob/a46d20c89c24a4e60faef09cf8ad7721bd29d6cc/odoo/modules/loading.py#L455-L457:
processed_modules += load_marked_modules(cr, graph,
['installed', 'to upgrade', 'to remove'],
force, status, report, loaded_modules, update_module, models_to_check)
Odoo thinks that l10n_it_edi
has to be updated because the following condition is True:
needs_update = (
hasattr(package, "init")
or hasattr(package, "update")
or package.state in ("to install", "to upgrade")
)
(from https://github.com/odoo/odoo/blob/a46d20c89c24a4e60faef09cf8ad7721bd29d6cc/odoo/modules/loading.py#L161-L165)
more precisely, hasattr(package, "update")
is True because it is assigned in https://github.com/odoo/odoo/blob/cbab786eb2e153eb7eefbd994cb261fa96e56800/odoo/modules/graph.py#L85-L87:
for kind in ('init', 'demo', 'update'):
if package in tools.config[kind] or 'all' in tools.config[kind] or kind in force:
setattr(node, kind, True)
More precisely, package in tools.config[kind]
is True.
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.
Thank you for the detailed explanation. Wow, such a difficult thing to handle...
Isn't better to switch the auto-install to False in OCB and use that source for the migrations? |
As I wrote earlier (#3595 (comment)),
|
This PR has the |
From version
14.0
, modulel10n_it_fatturapa
conflicts withl10n_it_edi
: https://github.com/OCA/l10n-italy/blob/bb780459361ad45900ccfb74aea22ca99b958d75/l10n_it_fatturapa/__manifest__.py#L16.We assume that if
l10n_it_fatturapa
is installed, thenl10n_it_edi
is not to be installed: this is the accepted solution when this same error happens while installing the modules manually, see https://github.com/OCA/l10n-italy/blame/a5bb1352e155dd1e5d81feea5e631ad76543559e/l10n_it_fatturapa/README.rst#L70-L75.Without this fix, when upgrading from
13.0
to14.0
, the following is raised during the migration ofbase
:(It means that mentioned modules are incompatible)