[16.0][FIX] project_timeline: Prevent at uninstall the error "No default view of type 'timeline'"#1677
[16.0][FIX] project_timeline: Prevent at uninstall the error "No default view of type 'timeline'"#1677arnaudlayec wants to merge 7 commits intoOCA:16.0from
Conversation
7317a3c to
d577607
Compare
alexey-pelykh
left a comment
There was a problem hiding this comment.
Good fix. The uninstall hook properly cleans up the timeline view mode from affected actions, preventing the "No default view of type 'timeline'" error after uninstalling. Clean implementation. LGTM.
alexey-pelykh
left a comment
There was a problem hiding this comment.
Follow-up review with a couple of robustness observations on the uninstall hook.
Overall the approach is sound -- cleaning view_mode during uninstall is the right fix for the "No default view of type 'timeline'" error. Two edge cases worth considering:
-
ValueErrorifremove()finds no match: The domain usesilike, which is case-insensitive. If an action'sview_modesomehow containsTimeline(capitalized) or a substring match liketimeline2, theilikefilter would match it, butview_mode.remove("timeline")would raiseValueErrorbecause the exact string"timeline"is not in the split list. A safer pattern would be a list comprehension filter:view_mode = [m for m in action.view_mode.split(",") if m.strip() != "timeline"]
-
Empty
view_modeafter removal: If an action hasview_mode = "timeline"as its only view mode, after removal the result would be an empty string. Odoo expects at least one view mode inir.actions.act_window. Consider either skipping such actions or setting a fallback (e.g.,"tree,form").
Neither of these is likely to occur in practice with the standard project_timeline module, so they are minor robustness improvements rather than blockers. The existing approval stands.
Review posted via CorporateHub OCA review campaign
Currently translated at 100.0% (3 of 3 strings) Translation: project-16.0/project-16.0-project_reviewer Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_reviewer/it/
…ne'" By adding an `uninstall_hook` which trims "timeline" from the "view_mode" attributes of "ir_act_window" model to merge with previous to merge with previous
d577607 to
c286c9d
Compare
alexey-pelykh
left a comment
There was a problem hiding this comment.
Fixes look good. The list comprehension with .lower() handles edge cases cleanly, and removing the action + menu when view_mode becomes empty is a better approach than a fallback -- an action that only served the timeline view has no purpose post-uninstall. Tests cover both cases (multi-mode trim and single-mode cleanup) and the demo data independence improvement is a welcome bonus.
Review posted via CorporateHub OCA review campaign
Before
When uninstalling the module, specific timeline views are well removed.
But not the attribute
view_modeofir_act_windowmodel.This causes the
UserErrorfrom baseir_ui_viewmodel to raise when the user browse to the Project menu, blocking all browsing into Project apps. The error is : "No default view of type 'timeline' could be found !"Fix proposal
This module adds an
uninstall_hookwhich trims the string timeline from the "view_mode" attributes ofir.actions.act_windowmodel.If approved, I will forward-port to 18.0.