odoo/odoo#202792

Created by fw-bot
Merged at ae1dde5e90b80706d44fc4fa39715671c0b9637a

Statuses:

label
odoo-dev:saas-17.4-16.0-sms-nonthead-tde-424014-fw
head
93c732fcc7dda1057ef98f1b210e9cfa599eaa98
merged
6 months ago by Marketing, Thibault Delavallee (tde)
odoo/odoo
16.0 #200650
17.0 #202454
saas-17.4 #202792
18.0 #202802
saas-18.1 #202809
saas-18.2 #202913
saas-18.3
saas-18.4
19.0
master #202992

[FW][FIX] sms: compose SMS on non-thread models

Nothing prevents from creating templates and composers on non thread
models. However most necessary code relies on mail.thread.

Here we move code from mail.thread directly to BaseModel. For most
business models it does not change anything. For some side models
it allows / fixes usage of SMS composer, allowing to dynamically
find numbers / partners, ...

One notable use case that triggered this PR is sending of SMS to
users using their work phone number, or through their partner. Either
we hack user model, either we provide a generic fix.

Note that in current master (18.2+) most 'mail' generic features are
supported on non-thread models (template usage and sending, mailing
using composer, ...). SMS is still thread-specific while phone
capabilities have already been moved to generic code.

We therefore continue towards generic simple mail / sms usage on
business records, while advanced features (followers, logs, direct
post using SMS type) require thread-enabled models.

task-4113190
sentry-4681535519

Forward-Port-Of: #202454
Forward-Port-Of: #200650