[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) <sig@openerp.com>
This commit is contained in:
jerome hanke (jhk)
2020-02-18 10:47:20 +00:00
parent e6d2b8e782
commit 45aa0aeaf5
+2 -1
View File
@@ -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):