[IMP] sms: Don't overwrite default recipients on default_get

If the recipients are passed by setting 'default_recipients' on the context,
then don't overwrite the content with the method '_get_default_sms_recipients'.

For example, as an employee is a mail.thread, then the method '_get_default_sms_recipients'
exists on it. Calling this method will erase the content of the field 'recipients' that comes
from the default_recipients key in the context.

If we want to use this wizard on something else than a partner, we should avoid this
kind of overwrite.
This commit is contained in:
Yannick Tivisse
2018-11-06 15:18:06 +00:00
parent c0c72f027d
commit 3c91ac425f
+1 -1
View File
@@ -67,7 +67,7 @@ class SendSMS(models.TransientModel):
model = self.env[active_model]
records = self._get_records(model)
if getattr(records, '_get_default_sms_recipients'):
if getattr(records, '_get_default_sms_recipients') and not self.env.context.get('default_recipients'):
partners = records._get_default_sms_recipients()
phone_numbers = []
no_phone_partners = []