[IMP] mail: keep old subtype subscription on change on parent record

With this commit, when changing subtype subscription from a parent
record (e.g. project of task), then it does not update subtype
subscription of existing records. Changes on parent record should
only affect new record afterwards.

Task-Id 1974055

Closes #34150

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Priyanka Kakadiya
2020-01-17 10:05:08 +00:00
committed by Alexandre Kühn
parent 16dd3da7a9
commit 0b11ed87b6
+3 -3
View File
@@ -275,7 +275,7 @@ class MailThread(models.AbstractModel):
for key, val in self._context.items():
if key.startswith('default_') and key[8:] not in create_values:
create_values[key[8:]] = val
thread._message_auto_subscribe(create_values)
thread._message_auto_subscribe(create_values, followers_existing_policy='update')
create_values_list[thread.id] = create_values
# automatic logging unless asked not to (mainly for various testing purpose)
@@ -2824,7 +2824,7 @@ class MailThread(models.AbstractModel):
model_description=model_description,
)
def _message_auto_subscribe(self, updated_values):
def _message_auto_subscribe(self, updated_values, followers_existing_policy='skip'):
""" Handle auto subscription. Auto subscription is done based on two
main mechanisms
@@ -2881,7 +2881,7 @@ class MailThread(models.AbstractModel):
self._name, self.ids,
list(new_partners), new_partners,
list(new_channels), new_channels,
check_existing=True, existing_policy='skip')
check_existing=True, existing_policy=followers_existing_policy)
# notify people from auto subscription, for example like assignation
for (template, lang), pids in notify_data.items():