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

[15.0][OU-IMP] project: merge project_status #4414

Open
wants to merge 1 commit into
base: 15.0
Choose a base branch
from

Conversation

remytms
Copy link
Contributor

@remytms remytms commented Apr 23, 2024

Merge project_status into project module. (OCA/project#1269)

Comment on lines 112 to 118
# We need to delete old project_status views
openupgrade.logged_query(
env.cr,
"DELETE FROM ir_ui_view WHERE model = 'project.project';"
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This part may be a bit overkill. But I need to delete project_status views because there is references on old project.status model in it, and this causes the database to fail showing project views.

But views where renamed during updade of the base module, so I didn't find a way to distinguish between views that are part of existing project module and views coming from project_status and that were renamed.

I tried to remove old views by xmlids but this does not work. I think that this is because some xmlids ends up being the same after the renaming (e.g. project_status.edit_project and project.edit_project).

By using this, I force the update of project module to recreate views of the project.project model.

Any better way of doing it is welcome.

Copy link
Member

Choose a reason for hiding this comment

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

Indeed this is not OK. Regular update process (the second pass without OpenUpgrade) must remove them being noupdate="0".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried not to delete project.project views, and perform a regular update after migration in 15.0.

I got the following logs:

2024-04-23 08:39:02,435 7 INFO brupower_upgrade odoo.addons.base.models.ir_module: ALLOW access to module.button_immediate_upgrade on ['Projet'] to user __system__ #1 via n/a 
2024-04-23 08:39:02,436 7 INFO brupower_upgrade odoo.addons.base.models.ir_module: ALLOW access to module.button_upgrade on ['Projet'] to user __system__ #1 via n/a 
2024-04-23 08:39:02,436 7 INFO brupower_upgrade odoo.addons.base.models.ir_module: ALLOW access to module.update_list on ['Projet'] to user __system__ #1 via n/a 
2024-04-23 08:39:09,805 7 INFO brupower_upgrade odoo.addons.base.models.ir_module: ALLOW access to module.button_install on [] to user __system__ #1 via n/a 
...
2024-04-23 08:39:19,078 7 INFO brupower_upgrade odoo.modules.loading: loading project/views/project_views.xml 
2024-04-23 08:39:19,253 7 WARNING brupower_upgrade odoo.addons.openupgrade_framework.odoo_patch.odoo.addons.base.models.ir_ui_view: Can't render custom view project.project_view_kanban for model project.project. Assuming you are migrating 
between major versions of Odoo. Please review the view contents manually after the migration.
Error: Element '<kanban class="o_kanban_mobile">' cannot be located in parent view 
2024-04-23 08:39:19,286 7 WARNING brupower_upgrade odoo.addons.openupgrade_framework.odoo_patch.odoo.addons.base.models.ir_ui_view: Can't render custom view project.project_view_kanban for model project.project. Assuming you are migrating 
between major versions of Odoo. Please review the view contents manually after the migration.
Error: Element '<kanban class="o_kanban_mobile">' cannot be located in parent view 
2024-04-23 08:39:19,325 7 INFO brupower_upgrade odoo.models.unlink: User #1 deleted ir.actions.act_window.view records with IDs: [336, 337] 
2024-04-23 08:39:19,593 7 WARNING brupower_upgrade odoo.addons.openupgrade_framework.odoo_patch.odoo.addons.base.models.ir_ui_view: Can't render custom view project.project_view_kanban for model project.project. Assuming you are migrating 
between major versions of Odoo. Please review the view contents manually after the migration.
Error: Element '<kanban class="o_kanban_mobile">' cannot be located in parent view 
2024-04-23 08:39:19,598 7 INFO brupower_upgrade odoo.modules.loading: loading project/views/res_partner_views.xml 
...

So it seams that I need to delete some views, but may be not all.

Copy link
Member

Choose a reason for hiding this comment

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

That's not a regular update, as openupgrade_framework is still around. Regular update will remove them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ho, yes indeed.

I've tested to deactivate views instead of deleting it, and it works also.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To perform a regular update after this migration in 15.0, I need to add a step to my migration process. Without deactivating views, if I go directly from a upgrade in 15.0 with openupgrade to an upgrade in 16.0 with openupgrade then upgrade in 16.0 with openupgrade fails.

Copy link
Member

Choose a reason for hiding this comment

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

Well, that shouldn't happen. It will emit the same warnings, but no crash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed it by just removing views that were overridden in the project_status module. And it works well.
Some standard views of project module were deleted in pre-migration script and then created fresh new by the update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pedrobaeza What do you think about the fix I proposed? It has been tested on a database for a real migration.

@remytms remytms force-pushed the 15.0-add-project_status branch 2 times, most recently from 294dcea to 8877eda Compare April 23, 2024 10:33
@legalsylvain legalsylvain added this to the 15.0 milestone Apr 25, 2024
},
)
# Delete project_status views
xmlids_views = [
Copy link
Member

Choose a reason for hiding this comment

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

I still don't see this as correct. Views are not a blocker for migration processes, and more deleting the whole inheritance chain. Please remove this part.

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

Successfully merging this pull request may close these issues.

None yet

3 participants