From 3fcf7631c9b707df1dad72a2275f21112aecfac8 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Thu, 7 Apr 2022 14:51:58 +0000 Subject: [PATCH] [IMP] sale_{project,timesheet}: add default values for timesheets action This commit adds some default values for the action used in the SOLs containing a service product shown in the Sales section. task-2814466 Part-of: odoo/odoo#88219 --- addons/sale_project/models/project.py | 2 +- addons/sale_timesheet/views/hr_timesheet_views.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale_project/models/project.py b/addons/sale_project/models/project.py index 1bd4b91ec7b..4758b3e68f8 100644 --- a/addons/sale_project/models/project.py +++ b/addons/sale_project/models/project.py @@ -267,7 +267,7 @@ class Project(models.Model): def get_action(sol_id): """ Return the action vals to call it in frontend if the user can access to the SO related """ action, res_id = action_per_sol.get(sol_id, (None, None)) - return {'action': action, 'res_id': res_id, 'additional_context': json.dumps({'active_id': sol_id})} if action else {} + return {'action': action, 'res_id': res_id, 'additional_context': json.dumps({'active_id': sol_id, 'default_project_id': self.id})} if action else {} return [{ **sol_read, diff --git a/addons/sale_timesheet/views/hr_timesheet_views.xml b/addons/sale_timesheet/views/hr_timesheet_views.xml index 92e619e5565..b7fb9c91d48 100644 --- a/addons/sale_timesheet/views/hr_timesheet_views.xml +++ b/addons/sale_timesheet/views/hr_timesheet_views.xml @@ -109,6 +109,7 @@ 'search_default_billable_timesheet': True, 'search_default_week': 1, 'default_so_line': active_id, + 'default_is_so_line_edited': True, }