From 4fe0ce8460a6dc5d7693b927cd728678f5e4b326 Mon Sep 17 00:00:00 2001 From: "Audric Onockx (auon)" Date: Tue, 22 Nov 2022 08:23:58 +0000 Subject: [PATCH] [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#106354 X-original-commit: c9e49358111521c042dd793f80ff99895d0fd179 Related: odoo/enterprise#34317 Signed-off-by: Laurent Stukkens (ltu) --- addons/hr_timesheet/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/hr_timesheet/__init__.py b/addons/hr_timesheet/__init__.py index de5fd790751..c7f65263edb 100644 --- a/addons/hr_timesheet/__init__.py +++ b/addons/hr_timesheet/__init__.py @@ -44,3 +44,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()