Commit Graph
76 Commits
Author SHA1 Message Date
Julien Banken 0040a7b609 [REF] sms,mail: remove no_edit attribute from fields
It turns out that the 'no_edit' attribute of the fields is deprecated
and doesn't do anything (there is no JavaScript or Python code using it).
We will hence remove that attribute from the views to clean them.

task-2686290

closes odoo/odoo#81210

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-12-13 09:49:04 +00:00
Thibault Delavallée e8796e6302 [IMP] sms: add precompute on fields
As body and composition_mode are required, an override of create has been
added to ensure they have a value. Indeed compute are computed after creation
which leads to required not being satisfied.

Now that precompute[1] are available this code can be safely replaced.

Task-2709581

[1] https://github.com/odoo/odoo/commit/d04a5b5c8c7dc13e4e911a29d1944e90587e2883

Part-of: odoo/odoo#80947
2021-12-07 11:50:54 +00:00
Julien Banken e4c583fcc8 [IMP] mail,sms: revamp the resend modals
The error messages of the resend modals can be partially hidden in the
table. The user can therefore have difficulty to understand what went
wrong when the server failed to send an email or an sms. To avoid that,
we will ensure that the error messages will be fully visible in the table.

To improve the interface, we will also update the label of a some fields
and we will automatically hide the 'Send & Close' buttons from the resend
modals when the user did not select at least one recipient from the list.

task-2523036

Part-of: odoo/odoo#71413
2021-09-30 13:31:53 +00:00
Thibault Delavallée 8c16737135 [REF] sms: rename sms.sms error_code to failure_type
PURPOSE

Prepare code cleaning and optimization in mail, mass_mailing and SMS by
cleaning models for readability and code complexity and footprint reduction.

SPECIFICATIONS

Be aligned with mail_mail and mass_mailing naming where failure_type is used
instead of error_code.

LINKS

Task ID-2377974
Community PR odoo/odoo#61467
Enterprise PR odoo/enterprise#14633
Upgrade PR odoo/upgrade#1907
2021-08-18 13:38:17 +00:00
Thibault Delavallée d950b97dbf [REF] mass_mailing(_sms): improve mail/sms and traces failed/ignored state management
RATIONALE

Currently there are differences between mail and sms error management
especially when sending them in batch (mass mode). Moreover cancel
(ignored) and error (exception) states meaning is not clear. Finally
some failure types management between mail and sms can be cleaned.

SPECIFICATIONS

Meaning of ignored / error we want to enforce now is

  * error: there was something wrong at sending and user has an action to
    perform, i.e. server failed -> check its logs;
  * canceled: invalid recipients due to contact information or mailing
    configuration (blacklist, opt out, void or invalid email or phone number).
    In indicates issues linked to records themselves;

In this task we also add failure information granularity on mailing traces
linked to email like what is done currently on SMS. This can be related to
mailing (blacklist, optout, duplicates) or related to recipient (no recipient,
incorrectly formatted).

We also correctly distinguish optout from blacklist when sending SMS.

SPECIFIC USE CASES

  * recipient without email / number: mail / sms is set as canceled, trace is
    ignored;
  * recipient with invalid email (no @) / number (formatting impossible):
    mail / sms is set as canceled, trace is ignored;

    -> we now distinguish when possible a void email from a wrong email using
       a newly-added selection key (mail_email_missing);

  * recipient with email / number blacklisted: mail / sms is canceled, trace
    is ignored;
  * recipient with email / number that optouted from mailing: mail / sms is
    canceled, trace is ignored;
  * recipient with email that bounces: mail is sent and will be set as bounce
    when receiving bounce in gateway; trace follow same path;
  * recipient with number that bounces: not supported as currently no support
    of bounce through IAP;
  * mail server error, IAP error: mail / sms is set as exception / error,
    trace is set in exception;

This means we introduce new failure types on mailing.trace model to reflect
those failure types

  * ``mail_missing``: missing email (different from wrong value);
  * ``mail_bl``: blacklisted;
  * ``mail_optout``: optouted;
  * ``mail_dup``: duplicated email skipped during mass email send;

We introduce ``sms_optout`` on SMS and trace models as it was merged with
blacklist previously. Now both errors are distinguished.

LINKS

Task ID-2377974
Community PR odoo/odoo#61467
Enterprise PR odoo/enterprise#14633
Upgrade PR odoo/upgrade#1907
2021-08-18 13:37:33 +00:00
Martin Trigaux c7bac3dee0 [IMP] *: make ir.model.data helper private
No reason to interfact with them directly in RPC
2021-08-10 13:49:04 +02:00
Martin Trigaux 03ff8d4d58 [FIX] *: retrieve model with sudo in selection fields 2021-08-10 13:49:04 +02:00
Kevin Baptiste 86aa7b78aa [IMP] *: introduce data-hotkey on form and modal views
Define `data-hotkey` on most used action buttons.

For the modals, the following keys are dedicated for "special"
actions:
 - Alt+G: add
 - Alt+V: save
 - Alt+Z: cancel

closes odoo/odoo#73275

Taskid: 2588233
Related: odoo/enterprise#19464
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-07-15 08:39:49 +00:00
Munaf Khan 3c71695e2a [IMP] sms: rename 'Cancel' button to 'Discard' in SMS resend wizard
taskID-2465233
closes https://github.com/odoo/odoo/pull/67502

closes odoo/odoo#67502

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-19 12:51:07 +00:00
Thibault Delavallée c4dacc24fa [REF] mail, sms: simplify notification recipients structure
Now that recipients in notification process are always partners due to
simplification of MailFollower model we can safely simplify the structure
used to collect and propagate recipients information.

Before this task it was a dictionary with a list of partner related data and
a list of channel related data. It is now simply a list of partner related
data, leading to various code cleaning.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:22:20 +00:00
Thibault Delavallée 4cb1f56aba [REF] mail, sms, test_mail: remove now unused channel_id field on Py and JS follower models
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

PURPOSE

Remove channel ability to follow records as it mainly adds noise without a lot
of added value. Simplify channel notification flow by using directly members
and not a delegation through a channel self-following trick. Remove followers
being channels and posting with added listeners being channels.

SPECIFICATIONS

As there is no way to add channel-based follower anymore we can remove all
fields and code supporting this feature. Notably we can remove ``channel_id``
field on ``mail.follower`` model as well all code using it, notably compute
methods.

In this commit we also make ``partner_id`` field required as now followers
are always partners. Email, name and active fields are now simple related
fields on the partner.

Code computing data about subscription is also updated and simplified. As
we do not have channels anymore but only partners all custom SQL queries
are now simplified.

JS models for Discuss are also cleaned. Following python change, JS models
are simplified to match the backend models. Channel_id is removed, partner_id
is now required, and various code is updated according to the simplified
model.

Side note: we could probably get rid of specific index on ``partner_id``
field. However we have to ensure we never search for followers without being
in a model / res_id context. This will be done in another cleaning step to
be sure performance are not broken.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:18 +00:00
ryv-odooandThibault Delavallée ba9e79f29c [REF] mail: rename mail.notification table
RATIONALE

A bit of history. Link between a message and its recipients has been added
at first mail refactoring towards a Chatter / Discuss feature. It was done
in v7 at d64f3c9783 with the base addition of mail notification model (lots
of commits follow that one but that's the first one about notification).

Due to some people thinking that it was unnecessary to keep a model for
notification it has been removed in v9 at 88b8cd0587. Notification table was
renamed from mail_notification to mail_message_res_partner_needaction_rel.

It was proven to be a mistake even if those "some people" were warned and
model made its way back to Odoo in v10 at 72dfcae2a4 . Table name mail_message
_res_partner_needaction_rel was kept to ease migration and backward
compatibility.

It is now time to complete the circle and rename it to mail_notification.

SPECIFICATIONS

Rename ``mail_message_res_partner_needaction_rel`` to ``mail_notification`` .

RIP JEM.

Never forget.

LINKS

Task ID-2477444
Prepares Task ID-2377974 (trace management cleaning task)
Prepares Task ID-2070632 (channel members main task)
Prepares Task ID-2419762 (channel members followup task)
COM PR odoo/odoo#67382
UPG PR odoo/upgrade#2245

Co-Authored-By: Rémy Voet <ryv@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
2021-03-05 15:20:53 +00:00
Lavish Chhatwani d30663503d [IMP] sms: autofocus on "body" for valid phone number in single mode
Before Commit:
When users wants to send an SMS to someone with help of the phone widget,
the composer is opened, and users expect to be able to write the message
right away. The issue is that the default focus is on the phone number, so
if users start writing, it will corrupt the phone nubmber, and they have to
discard the changes and have to click the body to finally start typing SMS
content.

After Commit:
When the composer is opened, if the phone number is valid, 'body' field is
focused automatically so that users can start typing right away. If number
is not valid, the focus will still be on the phone number. This is managed
by providing 'default_focus' attibute on the body field, which appears or
is hidden as needed.
For the mass mode also, we simply focus on the body field to enable user
to start writing content right away.

closes odoo/odoo#65443

Task-id: 2394488
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-02-09 11:01:03 +00:00
Martin Trigaux 1658473bf2 [FIX] *: rephrase, correct typos
Courtesy of Transifex's translators for reporting bad/unclear sentences.

closes odoo/odoo#62564

X-original-commit: 9b3b2e8d711e3be75b1faffaf6f4f8f4ec90186e
Related: odoo/enterprise#15038
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-11-30 07:07:58 +00:00
Martin Trigaux e433bc57ff [FIX] *: rephrase, correct typos
Courtesy of Transifex's translators for reporting bad/unclear sentences.

closes odoo/odoo#61804

X-original-commit: f5d0f4a1ebf406583889e9e04912d40c0693343e
Related: odoo/enterprise#14769
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-11-16 16:47:28 +00:00
Mariska Archielli (ram) a73044a66d [FIX] mass_mailing, mass_mailing_sms : fix bugs and incoherency
Fix traceback when creating a new contact by checking the id list is not empty
Filter default reporting by name rather then by campaign (as campaign is an option)
Group by Campaign only if the option is checked to enforce coherency.
> This is unblocked with a group.
Hide the 'replied' status from sms reports as it is not relevant for sms.
Remove the preview message for sms as it is not relevant elsewhere then the object of mails.
Warn the user if he's trying to send a sms with only white-space characters.
> this causes an error because the plaintext-html conversion in mail_thread.py
> consider a white-spaces-only text as empty.
Mobile placeholder added for a better understanding of the field by the user.

Task ID : 2302578

closes odoo/odoo#61461

X-original-commit: e6496af1ea31b2c699de9e41196a9ae3a07efb7f
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-11-06 10:00:07 +00:00
Priyanka Kakadiya 7b4efe3a76 [FIX] sms: fix sending failures sms wizard
due to breaking changes in https://github.com/odoo/odoo/commit/bf32b22ce247c19fda94ded74e37f7c6120ce2c4
and especially the part:

"NOTE 1.  If the default_get within the onchange returns a value for
a field that is not in the view, we ignore it, and it won't be saved.
Before, that value was kept and sent upon save.  This change in behavior
may prove problematic, although the overall risk is small.  Decision has
been made to keep heavy comments and code snippets if we were to revert
back somehow to the previous situation."

the wizard to sending failures sms was broken as the field notification_id
which is required was not present in the view and was thus ignored by
to web client when calling 'create'.

closes odoo/odoo#58294

Task: 2335273
Closes: https://github.com/odoo/odoo/pull/57912
X-original-commit: 9fed44512074d36f7b4aedf8ed08422304e433ea
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-09-23 08:46:38 +00:00
Dharmraj Jhala 0e57bfd453 [FIX] sms, test_mail_full: make contextual action work for sms templates
While creating contextual action for an sms template, the composition mode
may be decided on the fly, based on number of records and on context the key
`default_composition_mode`, which is set to 'guess'.

It used to work before a recent refactoring[1], because the composition
mode was changed in the default_get, and was being set to appropriate
value instead of 'guess'.

After this refactoring, the composition mode is not being set in the
default_get but is being computed, so the key `default_composition_mode`
tries to set the composition_mode selection field to 'guess', which is not
available in the selection values, resulting into traceback.

This commit fixes the issue by renaming the context key(removing 'default'
prefix) to avoid setting the mode directly and instead let the compute method
decide the composition mode based on context key and number of records.

[1] - https://github.com/odoo/odoo/commit/e02137c48562d824e3e01054e31dae383e5843e2

TaskID - 2286959

closes odoo/odoo#54938

X-original-commit: 2b9ea3d93445e05cb0440aab33f2bf9e066b0fa5
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-07-27 07:27:18 +00:00
Victor Feyens 71ab12840b [IMP] *: do not specify unwanted defaults in default_get
When default_get is called, the wanted fields are specified through the
fields_list arg.  It is useless to fill the values for unwanted fields.

As default_get is called for nearly all records creation, simplifying
the default_get overrides:
* remove potential wrong side-effects of the values
* remove some useless or wrong  defaults computations (searches, refs,
...)
2020-07-23 16:38:17 +00:00
Martin Trigaux ba244cef01 [IMP] *: replace to new _() syntax
Using a few regex like
\((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\)
($1, $3))

Old syntax is still compatible but starts the migration to the new
syntax that catches error.
2020-06-18 13:03:34 +02:00
Aymane (ayt) 8df6aec234 [IMP] mail, sms: support keydown based change event in char fields using an option
PURPOSE

Avoid flickering and incorrect display of warning box in SMS when updating
the number to contact.

SPECIFICATIONS

Currently when an user uses composer to send an SMS, number is validated
at onchange. It leads to two issues

  * jump of content as a warning box appears;
  * visual warning displayed after user may have clicked on "Send"
    button, leading to warning not being useful;

We choose to validate number in real time in order to give directly
a feedback to the user. It also lessens flickering on composer screen.
This is done by allowing to trigger the 'change' event on key down. This
requires a specific onchange_on_keydown option to be used on char field.

LINKS

Task ID 2229050
PR #51159

closes odoo/odoo#52962

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-06-15 13:26:13 +00:00
Aymane (ayt)andThibault Delavallée e02137c485 [REF] sms: move composer from onchange / default_get to editable computed fields
PURPOSE

Try to move from onchange / default_get to stored editable computed fields.
Behavior should be the same (computed or set by user), with support of
create / write / onchange field update without additional code.

SPECIFICATIONS

Update classic fields updated in some cases by onchange and/or default methods
by fields with store=True, readonly=False. It means their value comes either
from manual user input, either from trigger based computation.

Remove onchange and default_get when possible, leading to an unique computation
method and clearing fields definition.

Also clean some fields definition inconsistencies, notably required fields
that should instead be correctly computed or default that have no real meaning.

LINKS

Task ID 2229050
PR #51159

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Aymane Taibi <ayt@odoo.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2020-05-27 07:22:28 +00:00
Rémi Rahir 7287800101 [IMP] sms: Add new failure status for unregistered accounts
Since January 2020, users are required to validate their IAP account via
SMS code validation. This new behaviour needed to be properly ported to
the client to correctly inform the user.

This commit adds support of a new failure_type: 'Unregistered Account'.

Task #2209567

closes odoo/odoo#48512

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-05-12 16:39:40 +00:00
Sébastien Theys dea52493b8 [IMP] mail, sms, snailmail, test_mail_full: adapt mail.notification
The purpose is to have more common code for failure and notifications, with less
override in `sms` and `snailmail`.

task-2176017

closes odoo/odoo#44170

Related: odoo/enterprise#9140
Related: odoo/upgrade#918
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-04-17 12:17:57 +00:00
Thibault Delavallée efa161e25c [IMP] sms: make template required on preview template
It makes no sense to make it not required.

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:25:07 +00:00
Thibault Delavallée 2835e0ba38 [MOV] mail, sms: move language computation in render mixin directly
PURPOSE

Merge rendering tools used in mail and sms templates as well as partially
in mailings and move them directly in mail.render.mixin.

SPECIFICATIONS

Move tools related to language computation from mail.template model to the
mail.render.mixin. It allows to update both

  * mail.template: simply update calls accordingly;
  * sms.template: remove code doing what is now available through mail.render
    .mixin inherit;

Lang field is moved to mail.render.mixin as it is used notably for the language
computation. It therefore adds the field on mailing.mailing model although
not used currently.

LINKS

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:24:42 +00:00
Thibault Delavallée 822f468059 [MOV] mail: move rendering code to mail render mixin
We also have to update code calling directly the rendering itself. Indeed
some code bits does some rendering directly on jinja-enabled input and not
through templates. Those calls have to be updated accordingly.

LINKS

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:24:19 +00:00
Florimond Husquinet (fhu)andThibault Delavallée f685e70616 [IMP] sms: allow to edit number when sending an SMS to one recipient
After this commit

  * the SMS button is visible next to a phone number in mass_mailing, and
    mass_mailing_sms
  * when sending an sms to a single contact, its phone number is now an
    editable field in the wizard and there is a warning if the number is
    invalid;
  * if operator updated the recipient number, update record number according
    to the new number only in single recipient mode (aka, solving number
    issues directly from interface);

LINKS

Task ID 2088303
Community PR odoo/odoo#40482
Upgrade PR odoo/upgrade#873

Co-Authored-By: Florimond Husquinet <fhu@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
2020-03-05 11:27:01 +00:00
Thibault DelavalléeandFlorimond Husquinet 3150541bed [REF] sms: composer model cleaning
In this commit we perform some cleaning in composer model before adding
number update feature:

  * remove partner_ids field that is not used anymore. It comes from early
    implementation of SMS composer and is now dead;
  * rename recipient_count to recipient_valid_count to better reflect its
    use;
  * rename recipient_description to recipient_single_description to better
    reflect it is used only in mono-recipient mode;
  * add a new single comment computed field, allowing to display some
    information only when sending an sms to a single given record;

We also fix computed fields by making them work in batch.

LINKS

Task ID
Community PR odoo/odoo#40482
Upgrade PR odoo/upgrade#873

Co-Authored-By: Florimond Husquinet <fhu@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
2020-03-05 11:04:49 +00:00
Debauche Stéphane 991eb9a17b [FIX] sms: ensure chatter / SMS have the same content
When we send a SMS in the contact form view, exact body is sent by SMS and
displayed in chatter. If some manual HTML is added chatter will display it
as HTML while sms receive HTML tags.

We want that the SMS content in the chatter is the same as the SMS sent and
that HTML tags are removed to avoid being interpreted.

To achieve that goal we call html2plaintext in ``_message_sms`` and in
``prepare_log_body_value`` that are two entry points to send SMS.

We also update ``html2plaintext`` to strip result in order to avoid having
unnecessary spaces left.

Task ID 2126123
PR #40441

closes odoo/odoo#46362

X-original-commit: 4b7b14a5ea5e6ab521838c01813fa478154682fd
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-02-26 15:12:03 +00:00
mreficent 3dffce34bf [IMP] fields: log warning for ignored selection
When a field is related, defining a selection or selection_add will
have no effect and the paramater is ignored.

Log a warning and fix all fields badly definied

Closes odoo/odoo#45716

closes odoo/odoo#45832

Related: odoo/enterprise#8613
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-20 14:58:33 +00:00
Dharmraj Jhala 587a6bd9f6 [IMP] sms: improve SMS preview without existing record behavior and code
This commit clean-ups the code for model `sms.template.preview` which
mainly includes the following changes :

 * remove 'res_id' field and use only the reference field instead;
 * remove inheritance from `sms.template` as we only need a body field
   computed based on record and template;
 * convert onchange of lang / record to compute field for body;
 * fix 'No Records' warning which previously appeared even if there were
   records to be previewed (by adding compute field 'no_records');

LINKS

TaskID 2180132
Community PR odoo/odoo#44104
Upgrade PR odoo/upgrade#763

Related: odoo/upgrade#763
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-02-11 14:14:19 +00:00
Martin Trigaux a74a648030 [IMP] *: use ast.literal_eval
When simply need to parse a domain, it is easier

Add .strip() on ir.ui.view as ast.literal_eval produces an syntax
error if the node starts with spaces (as done in the xpath of
hr_attendance.view_employee_form_inherit_hr_attendance)

closes odoo/odoo#43831

Related: odoo/enterprise#7894
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-01-28 13:58:05 +00:00
Swapnesh Shah 32695d2747 [FIX] sms: do not add 'preview' action for SMS templates in dropdown menu
'Template Preview' action shouldn't be accessible through the action dropdown
as it is linked to a given template and accessible directly from the
template form view. Having it available in dropdown makes no sense.

closes odoo/odoo#42353

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-01-02 15:29:43 +00:00
Florimond Husquinet (fhu) 30cd679b81 [IMP] sms: allow to send SMS to oneself
Currently discuss post (through mail or sms) does not allow the author
to be notified of its content, as

  * he posted it and is therefore already updated;
  * it could create email loops;

However with SMS one could easily try to send SMS to himself using the
sms composer that is different from the mail composer. In that case
just use the ``mail_notify_author`` context key allowing to bypass the
"no author notification" rule.

Task ID 2091685
PR #40650

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-02 15:34:14 +00:00
RomainLibert dfd25263f8 [FIX] sms: avoid cache miss in compute
We should always ensure to assign something in a compute method

Since sms_template_id is not required, we have to check that it is set
before trying to render the template

Also make sure to have a default value in case you don't have a res_id

closes odoo/odoo#38546

X-original-commit: b96bb2a00737339dc53ff06167c1a0cd424ad717
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-10-11 21:48:31 +00:00
RomainLibert e5f41040a1 [FIX] sms: avoid crashing when no res_model of res_ids
sms_composer could crash in case you didn't pass it the active_id,
active_ids context keys or don't call the default_get

In that case it would try to access `self.env[False]` which would crash
in the `_compute_recipients_count`

We also have to ensure that we have a default value for `self.res_ids`
because `literal_eval(False)` will crash

closes odoo/odoo#38545

X-original-commit: 7ed0bd258d8a744716101d89cfa0bdf0f7990fb5
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-10-11 21:48:11 +00:00
Rémy Voet 8636fd8313 [FIX] sms: fix some usability issues
- In the portal chatter, when a message was send by sms and failed
the icon was grey. Change it to make it red when there is a failure
(revert by another task).

- In the sms composer wizard, if the sanitized number is wrong,
show 'Raoul Grosbedon (Invalid number)' instead of 'Raoul Grosbedon (False)'.

Task 2075733
2019-09-25 17:43:42 +00:00
Thibault Delavallée e875357b99 [FIX] sms: do not send sms already failed
Failed SMS should stay in error state and not be sent to IAP as we already
know it will fail. No pain, no gain.

LINKS

Task 2076366 (send now)
Task 2067873 (template access)
PR #37298
PR odoo/enterprise#5750
2019-09-25 11:14:09 +00:00
Thibault Delavallée 48cc126137 [FIX] (mass_mailing_)sms: allow to directly send SMS in mass mode
PURPOSE

Sending SMS is sometimes required as an immediate marketing tool.
Using delayed crons is not always the best user choice. Implement a
Send Now mechanism in batch SMS.

SPECIFICATIONS

Allow to send directly SMS when doing SMS marketing

SMS Application
  * in sms composer, in mass mode: rename Send SMS to Put in queue and
    add a Send Now button by-passing the queue;
  * set Put in queue as primary, Send Now as secondary;

SMS Marketing Application
  * in mailing view for SMS: rename Send SMS to Put in queue and
    add a Send Now button by-passing the queue;
  * set Put in queue as primary, Send Now as secondary;

Tests of SMS marketing with 400 contacts to SMS indicates it takes about
10 seconds to be completed which is considered as ok.

LINKS

Task 2076366 (send now)
Task 2067873 (template access)
PR #37298
PR odoo/enterprise#5750
2019-09-25 11:12:59 +00:00
ryv-odoo 7087e969ca [FIX] sms, mass_mailing : fix some glitches, perform YAB2B
Specifications

  * sms, in the form view of sms composer : the count of all record doesn't
    match the reality in a multi-company environment. The search_count was
    done is sudo, then records of other company was taken in account in the
    count. Fix by explicitly setting fields as computer_sudo=False;

  * mass_mailing, in the kanban view of mail marketing : A warning ribbon
    ("insufficient credit") appeared on the kanban item of mass mailing, but
    the message was for sms marketing views only. Change the attributes to be
    invisible for mail marketing;

  * mass_mailing, in the form view of mail mailing : Weird default domain
    filter ([0 = 1]) was display instead of an empty domain filter;

  * mass_mailing_sms, in the test sms wizard, remove a duplicate error message :
    When the number format was wrong a duplicate error message pop up. Fix by
    simplify the model and remove useless computed fields.

  * mass_mailing_sms, in the test sms wizard, rename the label "Number" to
    "Number(s)" to show that it can multiples ones.

Task ID 2073016 (sms fixes)
PR #37185
2019-09-20 13:44:09 +00:00
ryv-odoo 8e2da3b4d6 [IMP] (sms_)mass_mailing: improve interface
- Change the name of "Mass SMS" by "SMS Marketing"
- Improve the Mass Mailing views (kanban, form)
- Improve the Mass SMS views (kanban, search, form)
- Hide the sanitized numbers from views (sometime replace by mobile)
- Fix demo data of sms
- Explain the language field of sms template
- Improve the render of the sms composer wizard

TASK_ID : 2053631
2019-09-12 14:53:44 +00:00
ryv-odoo e4afa5d6d0 [IMP] sms: allow to create a sms context action
In the SMS template, we add the ability to create (and remove)
a contextual action on the targeted model from a sms template.
We change the sms composer to guess the composition mode,
and then to be usable by contextual action. The guess compostion mode
works differently if there are multiple target
selected (mass) or a single target (comment).

TASK_ID : 2053631
2019-09-12 14:53:44 +00:00
ryv-odoo 076e71cb5b [IMP] sms: allow to preview a sms template
Add a way for the user to preview sms content from a sms
template depending of a record (targeted model) and the
installed languages (as for the mail template). Add button
to open this preview on the form of the sms template.

TASK_ID : 2053631
2019-09-12 14:53:44 +00:00
Thibault Delavallée 5450415354 [REF] sms: improve onboarding and user experience of SMS composer
PURPOSE

SMS are a powerful marketing tool. For instance it is perfect to announce a
sale or to communicate a coupon code, to welcome a new customer in a fidelity
program, ...

Purpose of this task is to integrate SMS sending in batch in mass mailing. It
will use same mailing objects but sending SMS instead of emails. Some metrics
and flows will have to be slightly updated at the same time.

SPECIFICATIONS

Clean the use and options of sms composer after FP feedback :

  * see https://s.nimbusweb.me/share/3167586/ap1xpy95rz29a5cys576 as basis;
  * globally, do not display invalid recipients, only valid / invalid count
    as well as current selection / active domain counts;
  * consider logging a note as default behavior when using the composer;
  * simplify code: when doing a mass SMS, send SMS and attach a simple note
    to the document;

Some other points

  * make name of sms templates translatable;
  * improve various wording, notably in sms widget;
  * display error code in sms list view;
  * update sms composer actions accordingly by correctly setting active id
    or ids;

LINKS

Task 1997464
PR #34424
Original SMS addition: Task 1922163 (4287481)
2019-08-12 12:00:22 +00:00
Thibault Delavallée 5d1f08a012 [IMP] sms: integrate duplicate / blacklist into composer in batch mode
PURPOSE

SMS are a powerful marketing tool. For instance it is perfect to announce a
sale or to communicate a coupon code, to welcome a new customer in a fidelity
program, ...

Purpose of this task is to integrate SMS sending in batch in mass mailing. It
will use same mailing objects but sending SMS instead of emails. Some metrics
and flows will have to be slightly updated at the same time.

SPECIFICATIONS

Purpose of this commit is to support blacklisted and already-done numbers
when sending SMS.

  * blacklist support: necessary to avoid sending SMS in batch to people that
    asked to stop being spammed;
  * already-done support: when performing mailing in batch or doing A/B testing
    we may have already-done SMS;

When sending SMS in batch, already update state and error code of SMS that
should not be sent

  * blacklisted number: set to canceled, with blacklist error code;
  * duplicated number: set to canceled, with duplicated error code;
  * invalid number (cannot sanitize): set to error, with either missing number
    if void or wrong format if not void;

Support of blacklist / duplicated / invalid will notably be used when
performing SMS marketing (mass SMS) and marketing automation using mass
SMS.

LINKS

Task 1997464
PR #34424
Original SMS addition: Task 1922163 (4287481)
2019-08-12 12:00:22 +00:00
Thibault Delavallée 7e8a02cd6e [IMP] phone_validation: add blacklist mechanism
PURPOSE

SMS are a powerful marketing tool. For instance it is perfect to announce a
sale or to communicate a coupon code, to welcome a new customer in a fidelity
program, ...

Purpose of this task is to integrate SMS sending in batch in mass mailing. It
will use same mailing objects but sending SMS instead of emails. Some metrics
and flows will have to be slightly updated at the same time.

SPECIFICATIONS

Purpose of this commit is to add a blacklist mechanism for phone numbers
used to send SMS like what already exists for email addresses when sending
emails.

Define a new phone.blacklist model, holding a number and the state of the
blacklist (active field), as well as tools methods to access it. Make it
as private as possible, accessing it in sudo once access are granted.

Also clean phone validation tools: lessen number of tool functions and update
caller to simplify code readability. Some fixes are also included in this
commit, notably blank spaces cleaning in phone numbers.

Improve phone.validation.mixin to add a tool method computing a sanitized
number, in addition to formatting it to national / international.

Define a new mail.thread.phone mixin computing the blacklist status of a
record. This mixin

  * inherit from phone.validation.mixin in order to have access to some
    base phone number parsing capabilities;
  * computes a sanitized phone number based on ´´_phone_get_number_fields´´.
    It takes first sanitized value, trying each field returned by the
    method. That means one sanitized phone number is available per record
    even if several fields are available;
  * compute blacklist state of records. It is based on phone.blacklist
    model and give an easy-to-use field and API to manipulate blacklisted
    records;
  * give some API methods :

    * ``_phone_set_blacklisted``: set recordset as blacklisted;
    * ``_phone_reset_blacklisted``: reactivate recordset (even if not blacklisted
        this method can be called safely);

Put menus in technical in order to have access to it. Add a Phone / SMS
menu below "Email" and use it to store SMS / Phone actions.

Finally prepare tests addition by performing some light cleaning while adding
blacklist tests. Purpose is to ease future tests related to SMS.

LINKS

Task 1997464
PR #34424
Original SMS addition: Task 1922163 (4287481)
2019-08-12 12:00:22 +00:00
Remi Rahir 17679bd44c [FIX] sms: fix some issues in SMS composer
PURPOSE

Followup of merge 4287481 .

SPECIFICATIONS

Display "Missing number" in recipients invalid message when not having
any number to ease user experience;

Use note subtype when logging through composer, like already done in standard
sms API method at 2b7ad217f1a55a0687ba4ec4765bc7777114aac0;

LINKS

Task 1922187
2019-07-23 08:29:15 +00:00
Remi Rahir e20c1b6eff [FIX] sms: fix some typos
PURPOSE

Followup of merge 4287481 .

SPECIFICATIONS

Notification type is now a selection -> use 'sms' instead of True;
Fix typo in method renaming not correctly propagated to its view;

LINKS

Task 1922187
2019-07-23 08:29:15 +00:00
Thibault Delavallée ac212ae65d [IMP] sms: improve composer behavior
PURPOSE

Purpose of this commit is to add options and improve sms composer behavior.
Followup of merge 4287481bf0 .

SPECIFICATIONS

  * mass mode: add an option to keep archives when doing mass sms. This mode
    is actually a _message_sms in batch using the note subtype to speedup the
    process;
  * improve _message_sms_schedule_mass to allow more fine-tuning of options
    when calling it;
  * do not block sending SMS in batch if some recipients are invalid. Indeed
    using notifications there will be traces of failed SMS;
  * avoid reload of form view;

Linked to task 1925950 and 1935280
Part of PR #34864
2019-07-18 09:19:04 +00:00