From 45aa0aeaf56afa62e5340575a2abe4d2f82dc48a Mon Sep 17 00:00:00 2001 From: "jerome hanke (jhk)" Date: Mon, 17 Feb 2020 13:22:27 +0000 Subject: [PATCH] [FIX] mail: onchange on activity_type does not erases note by default Steps to reproduce: - install crm - go to any lead and schedule an activity in the mail thread - select "email" as activity type and type some text in the note field - change the activity type to "call" Previous behavior: The text you had in the note field is erased even if there is nothing set as a default message Current behavior: the note field gets erased only if there is a default message set for the current activity type opw-2195368 closes odoo/odoo#45603 X-original-commit: 1445b694e6111727d93d548f2830c53180fb9aa7 Signed-off-by: Simon Goffin (sig) --- addons/mail/models/mail_activity.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mail/models/mail_activity.py b/addons/mail/models/mail_activity.py index 7e8d52146ae..935cadbdfa6 100644 --- a/addons/mail/models/mail_activity.py +++ b/addons/mail/models/mail_activity.py @@ -213,7 +213,8 @@ class MailActivity(models.Model): base = fields.Date.from_string(self.env.context.get('activity_previous_deadline')) self.date_deadline = base + relativedelta(**{self.activity_type_id.delay_unit: self.activity_type_id.delay_count}) self.user_id = self.activity_type_id.default_user_id or self.env.user - self.note = self.activity_type_id.default_description + if self.activity_type_id.default_description: + self.note = self.activity_type_id.default_description @api.onchange('recommended_activity_type_id') def _onchange_recommended_activity_type_id(self):