diff --git a/project_task_recurring_activity/models/recurring_activity.py b/project_task_recurring_activity/models/recurring_activity.py index 1383907b9c..f8a7ff6310 100644 --- a/project_task_recurring_activity/models/recurring_activity.py +++ b/project_task_recurring_activity/models/recurring_activity.py @@ -17,9 +17,21 @@ class RecurringActivity(models.Model): string="Assigned to", index=True, required=True, + compute="_compute_on_activity_type_id", + store=True, + readonly=False, + ) + summary = fields.Char( + compute="_compute_on_activity_type_id", + store=True, + readonly=False, + ) + description = fields.Html( + sanitize_style=True, + compute="_compute_on_activity_type_id", + store=True, + readonly=False, ) - summary = fields.Char() - description = fields.Html(sanitize_style=True) days_after_task_creation_date = fields.Integer() next_recurrence_date = fields.Date( string="next_date", compute="_compute_next_recurrence_date", store=True @@ -66,17 +78,14 @@ def _check_user_id(self): ) ) - @api.onchange("activity_type_id") - def _onchange_activity_type_id(self): - self.user_id = ( - self.user_id if self.user_id else self.activity_type_id.default_user_id - ) - self.description = ( - self.activity_type_id.default_description - if not self.description or self.description == "


" - else self.description - ) - self.summary = self.summary if self.summary else self.activity_type_id.summary + @api.depends("activity_type_id") + def _compute_on_activity_type_id(self): + if not self.user_id: + self.user_id = self.activity_type_id.default_user_id + if not self.description or self.description == "


": + self.description = self.activity_type_id.default_description + if not self.summary: + self.summary = self.activity_type_id.summary @api.model def delta_time(self, old, new):