To reproduce
============
- create sms template and apply it to a module different than `res.partner`
for example Tasks
- add context action
- create a task and select a customer that has a phone number
- from action try to send the sms, an error is displayed
Problem
=======
when computing the receipient info, the partner on the record is not taken
into account.
opw-3475456
closesodoo/odoo#137014
X-original-commit: 6e6a8c24c3ab1a6b3ff27564f4244ed3d6b4c022
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
psycopg2.extras.execute_values was introduced in PR #101237
however it pypasses the override logic for cr.execute. As a result
1. --log-sql cannot log these queries
2. assertQueryCount cannot notice these queries
...
This commit create a new api cr.execute_values to support the same SQL feature
without losing the override logic for cr.execute
closesodoo/odoo#131190
Related: odoo/enterprise#47374
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
RATIONALE
Simplify field management for mail / phone / sms flows. Make it working out
of the box, easier to use and tweak.
SPECIFICATIONS
Add a '_phone_format' tool method on BaseModel. It allows to format a number
either directly, either from a field available on the model. It allows to
ease number formatting. It uses available helpers to find numbers using
'_phone_get_number_fields' and '_phone_get_country_field'. With default
generic behavior this allows to simplify most calls to phone number formatting.
Having it available at BaseModel level allows to remove some custom code,
calls to phone_validation API, ...
Task-3422449 (Mail, Phone: Move and improve field helpers)
Part-of: odoo/odoo#130468
RATIONALE
Simplify field management for mail / phone / sms flows. Make it working out
of the box, easier to use and tweak.
SPECIFICATIONS
Simplify model custom code when dealing with phone and sms by using helpers
and standard behavior defined on all models.
'_sms_get_partner_fields' was introduced at odoo/odoo@bdebcab0ce to have a generic
implementation of finding partners on a record. Since then another version
has been added directly in 'mail' module, using '_mail_get_partners'.
'_sms_get_number_fields' was introduced at the same time to have a generic
implementation of finding numbers on a record. Since then a generic and
improved version has been added directly in 'phone_validation' module, see
'_phone_get_number_fields'.
Those method can therefore be removed, and replaced by the generic ones
available on BaseModel.
Task-3422449 (Mail, Phone: Move and improve field helpers)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)
Part-of: odoo/odoo#130468
Steps to reproduce:
- Create a SMS template with the 'Applies to' property set to
Transfer (without this the action will never appear)
- Go to Transfer, pick one, open action and try to send a SMS
Issue:
Traceback
Cause:
When sending the SMS we try to modify the 'mobile' attribute of
'stock.picking' but it doesn't exist.
opw-3286153
X-original-commit: c84f952824bea4c1e0d5dcc7450d5e48a5637db8
Part-of: odoo/odoo#123716
Update counters to match current runbot state. Several changes (ORM, mail
code organization) lead to some counters being obsolete.
Task-3322905
Part-of: odoo/odoo#121104
'TestSMSCommon' was useless and is replaced by the 'SMSCommon' class defined
directly in SMS addon, easing inheritance and imports. See community PR for
more details.
Task-3263512
Part-of: odoo/odoo#117606
'TestMailCommon' was useless and is replaced by the 'MailCommon' class defined
directly in Mail addon, easing inheritance and imports.
Task-3263512
Part-of: odoo/odoo#117606
Steps:
install calendar app.
enable sms template of calendar.
go to calendar event form view.
try to send SMS.
Issue:
traceback clicking `Send SMS' of Send SMS wizard.
Cause:
trying to write on field even though field does not
exist in model.
Fix:
check field exist in model before write on it.
task-3084701
closesodoo/odoo#114824
X-original-commit: b773006055f0c29e56b2719621e2abd80af6b9e7
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
steps:
- Go to Rental app
- Open a rental Order
- Click on Action
- Send an SMS text message
- Fill phone number and message
- Sens SMS
Issue:
Traceback
Cause:
Sale order doesn't have a phone or mobile field so the sms.composer tries to write on it use "False"
Solution ensure the field name isn't false before writing
opw-3103232
closesodoo/odoo#110038
X-original-commit: 70a9995c9e02f36dc15d2723151ef0a205ebc12b
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Prior to this commit, the recipient in the SMS wizard
shows The name of the record.
In this commit, we make the partner the recipient instead
showing The name of the record itself.
task-3000243
closesodoo/odoo#110801
X-original-commit: 16e25edaf5c589046d42c62a2c32d337504d9e37
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Currently the search method defined on 'phone_mobile_search' supports either
a boolean (is set / is not set) search, either considers all searches to be
"like TERM". This is coming from the main usage that is the search view
that sends domains like "[('phone_mobile_search', 'ilike', term)]".
In this commit we improve the method to correctly support
* direct check (=)
* negative operators (not (i)like)
* like / ilike (previously like were considered as ilike)
Idea is: a positive operator check that any of the phone fields respects the
domain (phone or mobile is TERM). A negative operator checks that all phone
fields respects the negative domain (both phone and mobile do not contain TERM).
Tests are added.
Task-3012789
X-original-commit: 8e905343f38a4dae828ccaddc62ce5c6a2f754db
Part-of: odoo/odoo#104111
To reproduce
============
Go to Contacts and try to filter by phone/mobile is/not set. A traceback is
raised.
Problem
=======
The search method responsible for this field didn't take into account Value
to filter by to be a boolean.
Solution
========
Correctly support this case in search method.
Add unit test.
Task-3012789
opw-2980542
X-original-commit: 62b7da527c6ddb4654fbccf5c6d8c94158915ebc
Part-of: odoo/odoo#104111
Currently the search methods defined on ``phone_mobile_search`` field forces
the usage of ``phone`` and ``mobile`` fields on model. This currently works
on models using by default this search field (lead and partner). However this
breaks on any model not having those two fields and inheriting from the
'mail.thread.phone' mixin.
In this commit we use the result of ``_phone_get_number_fields`` to know which
fields to use in the SQL query.
Tests are added to ensure it works as intended.
Task-3012789
X-original-commit: 6b235868da6fed1b2a0eaa7a25dc2202c6fefaa0
Part-of: odoo/odoo#104111
In order to better reflect real models, let us have phone and mobile fields
being computed either by hand, either based on customer on 'mail.test.sms.bl'
test model.
Done in its own commit to ease discovering of side effects in tests, which
does not seem to be the case.
Task-3012789
X-original-commit: 71e2b8713bc83ed999ab2e2839edc56804a0fe54
Part-of: odoo/odoo#104111
Website: the context install_filename='dummy' is used to prevent
arch_updated from becoming True while updating translations of
ir_ui_view.arch_db (if arch_update becomes True, test_inherit_specific
fails)
Fuzzy search for jsonb translated fields has been adapted in the case of
website. It may require some refactoring later.
Purpose
=======
Currently, only email sending can be scheduled with the `scheduled_date` field
defined on on <mail.mail>. It's not possible to delay the sending of
notifications.
We want to be able to delay the sending of the emails, but also the inbox
and bus bus notifications.
Technical
=========
For that purpose, we created a new model which stores the message we need to
notify with the scheduled date. When a scheduled_datetime is given we skip the
notification process. Instead an entry in that new model is created. A cron
regularly polls the scheduled message and launch the notification process on
messages that are ready to be sent.
Task-2207626 (Rating: Delay rating notification to ease feedback)
Part-of: odoo/odoo#95623
Co-authored-by: Thibault Delavallée <tde@odoo.com>
PURPOSE
Have more reliable tests.
Better spot side effects coming from sub addons.
Lessen non deterministic counters due to local db.
SPECIFICATIONS
Make crm, event and mail performance tests post install.
Update query counters with
* local values (install module only with enterprise activated);
* community / enterprise runbots (if value is different);
* some notes on non deterministic issue if known;
Task-2925606
closesodoo/odoo#96446
Related: odoo/enterprise#29726
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
After updating email server actions we can improve SMS server actions the
same way. We can now post on documents using SMS notification mechanism
in addition to pure mass SMS sending.
A new field is added to handle the way of sending SMS, like we do for
email actions.
Task-2613245 (Server actions mail update / cleaning)
Part-of: odoo/odoo#75906
When sending SMS on several records in comment mode (aka: post sms message
in batch) the body is sent as it is. This does not happen frequently as
default usage is either
* comment on a single record -> body is rendered by onchange / compute;
* mass SMS on several records -> body is rendered for all records then
sent to all recipients;
Using comment mode in mass is not common, and is mainly achieved through
handcrafted actions. However this can be fixed by correctly rendering the
body before posting on all records.
Use addition of records instead of OR to keep ordering of created
messages when using SMS composer.
Spotted during Task-2613245 (Server actions mail update / cleaning)
closesodoo/odoo#97787closesodoo/odoo#97890closesodoo/odoo#97931
X-original-commit: odoo/odoo@1778a2c1b2
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Purpose is to enable dynamic rendering in mass comment mode. This highlights
an issue, as currently when using the comment mode on several records body
is not rendered, just sent as it is. This means raw dynamic code could be
sent.
Also cleanup some invalid setup (not enough records for mass) that skipped
some tests.
Spotted during Task-2613245 (Server actions mail update / cleaning)
X-original-commit: odoo/odoo@d5a1c5768b
Part-of: odoo/odoo#97931
In this commit we introduce a new module ``test_mail_sms`` that holds the
tests for sms application, like ``test_mail`` does for mail. Currently all
sms tests are inside ``test_mail_full``. After this commit code is moved
from ``test_mail_full`` into that module. Full testing module should be used
mainly to test integrations with a lot of submodules and for performance
tests, not testing details of SMS implementation.
We also add ``mass_mailing_sms`` as dependency of ``test_mass_mailing`` so
that both mailing types are tested in the same module. It eases maintenance
and writing of tests. Mass mailing SMS tests from `test_mail_full`` are
therefore moved in ``test_mass_mailing``.
This commit also allows some cleaning in classes used in tests, to have
classes in ``test_mail_sms`` and ``test_mail_full`` that contain everything
necessary to test mail features.
Task-2890111 (Test Mail/Mass Mailing: SMS tests reorganization and move)
Part-of: odoo/odoo#96223