Skip to content
Snippets Groups Projects
Commit 8fe71cd7 authored by yograj tandel's avatar yograj tandel Committed by Barad Mahendra
Browse files

[FIX] hr_timesheet: fix traceback after unistalling timesheet


Currently when unistall the hr_timesheet and try to open the project
menu it generates an traceback due to invalid field in domain of the
action.

so in this commit fix the traceback by adding the unistallation hook
so domain will be replaced on unistallation of the hr_timesheet.
also archive the internal project when unistalling the hr_timesheet.

Task-2629395

closes odoo/odoo#76413

Related: odoo/enterprise#20807
Signed-off-by: default avatarLTU-Odoo <IT-Ideas@users.noreply.github.com>
parent a7f7233e
Branches
Tags
No related merge requests found
......@@ -32,3 +32,19 @@ def create_internal_project(cr, registry):
} for task in project_ids.task_ids.filtered(lambda t: t.company_id in admin.employee_ids.company_id)])
_check_exists_collaborators_for_project_sharing(env)
def _uninstall_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
xml_ids = [
'project.open_view_project_all',
'project.open_view_project_all_group_stage'
]
for xml_id in xml_ids:
act_window = env.ref(xml_id, raise_if_not_found=False)
if act_window and act_window.domain and 'is_internal_project' in act_window.domain:
act_window.domain = []
# archive the internal projects
project_ids = env['res.company'].search([('internal_project_id', '!=', False)]).mapped('internal_project_id')
if project_ids:
project_ids.write({'active': False})
......@@ -46,6 +46,7 @@ up a management by affair.
'application': False,
'auto_install': False,
'post_init_hook': 'create_internal_project',
'uninstall_hook': '_uninstall_hook',
'assets': {
'web.assets_backend': [
'hr_timesheet/static/src/scss/timesheets_task_form.scss',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment