Skip to content
Snippets Groups Projects
Commit 7bf73663 authored by Audric Onockx (auon)'s avatar Audric Onockx (auon)
Browse files

[FIX] hr_timesheet: uninstall project's 'timesheet' config


Steps :
Go to project > settings.
Check 'timesheet' config and save.
Uncheck it back and save.

Issue :
See errors in the logs, due to on delete restrict.

Cause :
Record 'hr_timesheet.internal_project_default_stage' from data
is deleted when hr_timesheet is uninstalled.
Yet some project task records still use it, so we can't delete it.

Fix :
Delete the corresponding ir.model.data to keep the stage,
but unlink it from the 'hr_timesheet.internal_project_default_stage' ref.

task-2998416

closes odoo/odoo#106344

X-original-commit: c9e49358111521c042dd793f80ff99895d0fd179
Related: odoo/enterprise#34309
Signed-off-by: default avatarLaurent Stukkens (ltu) <ltu@odoo.com>
parent e998b2c5
No related branches found
No related tags found
No related merge requests found
......@@ -42,3 +42,5 @@ def _uninstall_hook(cr, registry):
project_ids = env['res.company'].search([('internal_project_id', '!=', False)]).mapped('internal_project_id')
if project_ids:
project_ids.write({'active': False})
env['ir.model.data'].search([('name', 'ilike', 'internal_project_default_stage')]).unlink()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment