OCA / OpenUpgrade

Open source upgrade path for Odoo/OpenERP
https://oca.github.io/OpenUpgrade/
GNU Affero General Public License v3.0
722 stars 690 forks source link

[12.0] theme_bootswatch views #2335

Closed ivantodorovich closed 4 years ago

ivantodorovich commented 4 years ago

Impacted versions: 12.0

Steps to reproduce: Migrate from 11.0 to 12.0 on a database with theme_bootswatch website theme

Current behavior: style compilation error on website


Related to https://github.com/OCA/OpenUpgrade/pull/1842 Ping @MiquelRForgeFlow

Hi guys,

I'm encountering an issue migrating a database to 12.0 with this theme. Issue is the previous theme_bootswatch.theme_* (ir.ui.view) are not removed, nor updated. So they reference to not existing stylesheets, raising a compilation error.

They were replaced by theme.ir.ui.view in the code, hence the previous ir.ui.view should be removed, IMO.. no?

I don't know why they're not removed. Maybe it's because they XMLID didn't disappear, it's just that now it's referencing to another model/resid? Or maybe it's just because `theme*` modules are installed in a hacky-way.

Not updated nor removed view: (old view - should be removed) image

New view generated by theme.ir.ui.view (the one to keep): image

theme_bootswatch.theme_united now pointing to a theme.ir.ui.view: image

pedrobaeza commented 4 years ago

This is not a problem of OpenUgprade itself. You have to deal with this theme itself. One possibility is to re-assign the theme in the website.

ivantodorovich commented 4 years ago

Hmmm isn't this theme part of openupgrade? https://github.com/OCA/OpenUpgrade/tree/12.0/addons/theme_bootswatch

or are theme_ modules out of the scope ? if so what's the point of https://github.com/OCA/OpenUpgrade/pull/1842?

The fix is quite easy: remove the deprecated views but why not handle it in the migration script?

Reassigning the theme doesn't work because the old views are not related to any theme.ir.ui.view. They have to manually be removed.

But also I would ask: how are these files generated and question its ouput:

https://github.com/ForgeFlow/OpenUpgrade/blob/12.0/addons/theme_bootswatch/migrations/12.0.1.0/openupgrade_analysis_work.txt

This one is missing the following:

DEL ir.ui.view: theme_bootswatch.theme_cerulean
DEL ir.ui.view: theme_bootswatch.theme_cosmo
DEL ir.ui.view: theme_bootswatch.theme_customize
DEL ir.ui.view: theme_bootswatch.theme_cyborg
DEL ir.ui.view: theme_bootswatch.theme_flatly
DEL ir.ui.view: theme_bootswatch.theme_journal
DEL ir.ui.view: theme_bootswatch.theme_simplex
DEL ir.ui.view: theme_bootswatch.theme_slate
DEL ir.ui.view: theme_bootswatch.theme_spacelab
DEL ir.ui.view: theme_bootswatch.theme_united

Because in fact the 12.0 version is not creating new xmlids, it's reusing them to target to another model theme.ir.ui.view instead of ir.ui.view

Isn't managing this special cases where an xmlid gets reused in a new version of the module, but targeting to a different model, something openupgrade should consider? because I think that's the real issue here

pedrobaeza commented 4 years ago

The problem is not the theme, but the noupdate flags set locally in the DB due to changes in them. That's why they are not removed.

ivantodorovich commented 4 years ago

There's no noupdate flag set. Neither in 11.0 (before), nor 12.0 (after). In fact after the db is migrated, there's not even a ir.model.data for these views.. becuase it's xmlid is now poing to a brand new theme.ir.ui.view

pedrobaeza commented 4 years ago

Then they should be removed automatically... I don't get the problem. Have you updated all with regular Odoo?

ivantodorovich commented 4 years ago

I'm updating all with openupgrade, and only at the end I update all with regular odoo.

But at this point the xmlids are not referencing these views anymore, so they don't get removed (they dont "belong" to the module anymore)

pedrobaeza commented 4 years ago

Then that's the weird thing. Why they are not referenced? The only thing I see it's because in previous versions, they were noupdate="1", and thus copied through multi-website code. I haven't got this problem with any theme, but bootswatch specifically is not installed in any of my customers.