[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#78063 X-original-commit: 8fe71cd7ff412a01b6f7dbaf569f7b85fbffd631 Related: odoo/enterprise#21551 Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
This commit is contained in:
committed by
Barad Mahendra
parent
159e58286e
commit
07670d41a8
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user