summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Pinna Puissant <jpp@odoo.com>2020-07-14 13:24:11 +0000
committerJorge Pinna Puissant <jpp@odoo.com>2020-07-16 08:55:09 +0000
commit793edf32934b160596682ef4be3b20c7080f8159 (patch)
tree63d0430a20cbf81f73a92a00a267ac70c6f98c92
parente0baa3be18dc113ddecf9dfa7cb3a4533108d27a (diff)
[FIX] hr: activity type configuration on hr plans
revert of 0f4ec36 and bf8a9af - Employees > Configuration > Planning Types and ensure the activity type "To Do" is set to scheduled date several days after previous activity (default should be 5 days); - Check that onboarding Plan has at least 2 activities with activity type "To Do"; - Click launch plan. The activity type configuration is ignored and all activities are due tomorrow. The previous commit uses the function _onchange_activity_type_id to fix this issue. The problem with this commit, is that the _onchange_activity_type_id function will also change the responsible, the notes and the summary to set them to their default value. Now, the activities are due taking into account the activity type configuration without modifying the already set responsible, notes and summary. opw-2265631 X-original-commit: 81e4745a31567af7b58064bd8b4e9bae0756354f
-rw-r--r--addons/hr/wizard/hr_plan_wizard.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/hr/wizard/hr_plan_wizard.py b/addons/hr/wizard/hr_plan_wizard.py
index 88168e300f6..0a9e27c35ea 100644
--- a/addons/hr/wizard/hr_plan_wizard.py
+++ b/addons/hr/wizard/hr_plan_wizard.py
@@ -24,14 +24,14 @@ class HrPlanWizard(models.TransientModel):
responsible = activity_type.get_responsible_id(self.employee_id)
if self.env['hr.employee'].with_user(responsible).check_access_rights('read', raise_exception=False):
- activity = self.employee_id.activity_schedule(
+ date_deadline = self.env['mail.activity']._calculate_date_deadline(activity_type.activity_type_id)
+ self.employee_id.activity_schedule(
activity_type_id=activity_type.activity_type_id.id,
summary=activity_type.summary,
note=activity_type.note,
- user_id=responsible.id
+ user_id=responsible.id,
+ date_deadline=date_deadline
)
- activity._onchange_activity_type_id()
- activity.user_id = responsible.id
return {
'type': 'ir.actions.act_window',