From 3c91ac425f74755fa0e79aa620b601d29a4be65b Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Tue, 6 Nov 2018 15:02:02 +0000 Subject: [PATCH] [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. --- addons/sms/wizard/send_sms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sms/wizard/send_sms.py b/addons/sms/wizard/send_sms.py index 448d9fcc626..786a5e2af76 100644 --- a/addons/sms/wizard/send_sms.py +++ b/addons/sms/wizard/send_sms.py @@ -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 = []