Commit Graph
45 Commits
Author SHA1 Message Date
Yannick TivisseandVictor Feyens 18952cdc76 [IMP] *: Convert single create method into multi
Taskid: 2703085
Part-of: odoo/odoo#80824
Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-12-14 19:13:18 +00:00
Aurélien Warnon 1e25946a76 [IMP] utm: globally improve UTM records management across all apps
PURPOSE

This commit consolidates UTM usage across all applications.

Global purpose is to avoid having undesired side-effects, such as unlinking an
utm.source/utm.medium/utm.campaign and at the same time cascading the deletion
to various records without noticing.

SPECS

ALLOW MORE PEOPLE TO CLEAN UTM RECORDS

Currently, not even the system administrator can delete utm.mediums and
utm.sources (he can only delete campaigns).

These were considered as "technical records", but allowing some cleanup is
a good idea since these records are often automatically generated and can
create a lot of unnecessary noise in the database.

That's why we now allow the following groups to delete all UTM records
(sources, mediums and campaigns):
- group_system
- group_mass_mailing_user
- group_social_manager (enterprise)

PREVENT DELETION

For some use cases, removing an utm.source/utm.medium/utm.campaign would
cascade delete the related record, which was unintended / hidden side effect.

These combinations were secured by preventing to unlink:
- mailing.mailing source_id field
  Trying to delete the utm.source will throw an error message
- mailing.mailing medium_id field
  Trying to delete the utm.medium will throw an error message
- hr.recruitment.source source_id field
  Trying to delete the utm.source will throw an error message

ADDING CLEAN ERROR MESSAGES

When trying to delete an UTM record that is linked with ondelete="restrict", we
improved the error message to give a clear explication to the user, e.g:

"You can't delete these UTM sources as they are linked to the following
mailings in the Mass Mailing APP, and deleting the source would break the
statistics: Newsletter"

SPECIFY 'ondelete' strategy

For a lot of uses of sources/mediums/campaigns, the 'ondelete' strategy was not
specified, leading to the confusion of "is this really how we want to handle
this?".

A lot of ondelete="set null" have been added in various field definitions to
ensure that this is the desired and logical strategy we want for that
specific model.

PREVENT REMOVING HARDCODED UTM RECORDS

In some functional flows, UTM records are hardcoded using their direct
record reference.
This is notably the case for the recruitment process and its creation of
aliases, and for the Email / SMS Marketing flows.

As deleting them would break these flows, we prevent their deletion in a
"api.ondelete" method.

ENFORCE NEW RULES WITH TESTS

A lot of python tests have been added to make sure we enforce the decisions
taken here above.

LINKS

ENT PR odoo/enterprise#19048
Task-2459480

closes odoo/odoo#72239

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-23 11:12:04 +00:00
Thibault Delavallée 581286346a [FIX] mass_mailing(_sms/_crm/_sale): fix digest layout change breaking mailing statistics
Recently some "de-t-rawify" [1] was done through Odoo. A change in digest
layout broke mailing statistics. Indeed mailing statistics are build on digest
main layout to re-use it. In mailing case a ``kpi_name`` value was missing when
rendering statistics columns, leading to a crash. This is now fixed in both
mailing and sms marketing.

In this commit we also add tests for statistics emails (D+1 KPIs) rendering
for both mail and SMS marketing mailings. Email details are also tested
in order to better highlight future changes and tweaks in email sending
linked to D+1 KPIs emails.

Task-2641394 (Digest emails sending improvement)
Task-2582128 (Digest onboarding and usage improvement)
Task-2686586 (Repair mailing statistics email)

[1] odoo/odoo@c56e8c9f5a

X-original-commit: c9905ceb3172d8e80e3aff4ae9bc925dcb6b6519
Part-of: odoo/odoo#79877
2021-11-16 16:58:35 +00:00
dht-odoo 10490139f1 [IMP] {mass_mailing}_sms: allow internal users to access UTM campaigns
Before this commit:
- UTM campaigns are accessible for all internal users, but with email
  marketing related modules installed, if user who does not have rights
  for email marketing tries to access the campaign, an AccessError is
  raised. It's because few fields related to email marketing are added
  in model `utm.campaign` which are accesible only to the marketing
  users.
- When the user is having `mass_mailing.group_mass_mailing_campaign`
  group enabled but no rights for email marketing, the root menu of
  for the 'Email Marketing' app is visible to that user, which is
  not correct.

With this commit:
- While adding marketing related fields to the campaign, we provide the
  group("mass_mailing.group_mass_mailing_user") at field level whenever
  neccessary so it doesn't raise AcessError. Also, we show those fields
  on the campaign views only when `mass_mailing.group_mass_mailing_campaign`
  group is enabled for the user. To do this, a compute field has been
  introduced to make sure that user has rights to access email marketing
  as well as the feature to manage mass mailing from campaigns is enabled.
  The reason behind introducing a new compute field is, at view level,
  it is not possible to check that user is having multiple groups.
- We've applied the group "mass_mailing.group_mass_mailing_user" on the
  root menu of Email Marketing app, so if the user has UI only group
  "mass_mailing.group_mass_mailing_campaign" and but no rights for
  email marketing, the root menu won't won't appear.

TaskID-2417993

closes odoo/odoo#74113

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-10-07 19:07:04 +00:00
Jérémy Hennecart bc8f4373c3 [IMP] mass_mailing(_sms): a/b testing
Manage correctly a/b testing in mass_mailing.
We can now organize a mass_mailing campaign by testing
multiple mailings for the recipients targeted (subject,
templates, design, ...)

For this a new tab on the mailing record is added to better
promote the existence of the feature.

When an user has the group to manage mailing campaign, he can
access the tab A/B Test. This tab allows to enable A/B testing
for the mailing. If there is no campaign set for the mailing,
one is automatically created allowing the user to continue
smoothly.

Once A/B testing enable, the percentage of recipients use can be
set for each mailings. Also, the user can choose the deciding factor
that will set the final mailing as winner.
In a case, the user is not in manual mode, he can set the schedule datetime
for sending the final mailing.

task-2123242
COM PR: odoo/odoo#75622
ENT PR: odoo/enterprise#20454
UPG PR: odoo/upgrade#2781

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-09-07 18:08:03 +00:00
Thibault Delavallée 1b3fca70f7 [IMP] sms: allow to keep sent sms
When calling send on SMS, sent SMS are unlinked. If a ``delete_all`` parameter
is true, failed SMS are also unlinked.

In this commit we allow to control that behavior with two boolean, one for
sent SMS and one for failed SMS. This allows to ask to keep sent SMS and
update their status accordingly.

More control is necessary notably to enable IAP feedback on sent SMS as
an error could happen after considering it as sent. Some flows will have to
be updated to decide whether this status is necessary and if SMS are kept.
This commit prepares ground for that feature by already improving methods
and API.

Task-2634957
Prepares Task-2535005 (SMS view pimp) and Task-2560666 (IAP feedback)
PR odoo/odoo#75798
2021-09-02 01:55:27 +00:00
Thibault Delavallée bbf4783ac6 [REF] mass_mailing: improve traces state management
PURPOSE

Improve modeling and performances of mass mailing by manually updating trace
status instead of using complex computed fields and lessening fields usage.

Remove some fields and keep only relevant metrics to simplify and clean trace
model.

SPECIFICATIONS

In this commit we clean the way trace state is managed. Currently it is a
computed field based on several datetime fields. However this generates a
lot of noise in the table as well as unnecessary computation

  * there are several columns (one for each state) storing datetime at
    which status was reached. Generally only 2 or 3 contain relevant
    information;
  * state could be set in code directly to avoid a computed field based on
    many triggers;
  * recomputing it each time a date changes is not necessarily necessary;
  * state value can always be updated manually as this is main done through
    some automated server update (mailgateway, link clicks, ...);

As trace states and its triggers should not be updated manually it is better
to synchronize it in code flow. When there is an exception or update done
through sending or gateway status is updated as well accordingly. Various
datetime fields are also updated at the same time. In order to align with
notification model mail and sms trace status are updated to a classic field.
Only last status update is now kept as there is no need to store the entire
history of status change.

We keep only a datetime for relevant metrics: open, reply and click. Other
datetime bring no real value. Knowing when a trace was in error or bounced
is not necessary. Indeed exception generally indicates a server issue (at
sending), cancel indicates a data issue (at sending) and bounce depends on
customer email server.

Status update is removed as using write_date is sufficient. Once created
traces are updated only when an external event occurs (opened, replied, ...).
It allows to simplify trace model.

We also rename ignored field into canceled to match naming use through mail
and sms.

QUERY COUNTERS

This change has some positive update on query counters when sending mailings
as traces have less unnecessary status update compared to priori this change.

LINKS

Task ID-2377974
Community PR odoo/odoo#61467
Enterprise PR odoo/enterprise#14633
Upgrade PR odoo/upgrade#1907
2021-08-18 13:38:08 +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
Romain Derie 92175d3341 [IMP] *: replace web.base.url ICP by helper method
Previous commit introduce an helper to get the most suited URL for a record
instead of always using the ICP, which is not correct in a website context.

This commit replaces calls to ICP by the helper method.

Community: https://github.com/odoo/odoo/pull/68201
Enterprise: https://github.com/odoo/enterprise/pull/17538
Upgrade: https://github.com/odoo/upgrade/pull/2372

task-2476101
2021-06-02 10:04:29 +00:00
Thibault Delavallée ed508ee1bd [REF] mass_mailing: move mailing capability on model
PURPOSE

Remove hardcoded list of models on which mailing is possible. Indeed it is
not modular and not really smart with enterprise code not being reachable
in community.

SPECIFICATIONS

Replace hardcoded list of models on which mailing (both mail or sms) is
possible by a computed searchable field on ``ir.model`` based on a class
attribute.

It allows to cleanly define models having mass mailing capabilities and add
this attribute in bridge modules (when existing) or directly on base model
definition to avoid bridge modules.

In this commit we introduce a basic ``_mailing_enabled`` class attribute
activating mailing on model.

Mailing models may also have a ``_mailing_get_default_domain`` method allowing
to define a custom default domain when sending a marketing mailing on records
on this class.

Mailing models can now define a ``_mailing_get_opt_out_list(_sms)`` method
allowing to define custom behavior to fetch opt-outed records. Instead of
defining a model-based behavior on Mailing itself, it now calls the model
defined one. We still have two methods, one for mailing and one for SMS
opt out computation as it relies on different underlying models and fields.

LINKS

Task ID-2431217
COM PR odoo/odoo#67322
ENT PR odoo/enterprise#16876
UPG PR odoo/upgrade#2236
2021-05-26 07:57:47 +00:00
Thibault Delavallée b1c90b96e1 [FW][FIX] sale, mass_mailing_sms, test_mail_full: correctly support partner-only records
When performing an sms marketing on a model having only a ``partner_id``
field available (aka no ``phone`` or ``mobile``) it crashes due to seen
list computation (aka already contacted recipients). This is due to an SQL
query not taking into account those models as it works only for those with
a phone field.

We fix it as done in ``mass_mailìng`` app, aka fetching information on the
related partner if available.

Some tests for models using a 2many relationships towards recipients are
added. Note that this kind of model does not really support complete SMS
notification, as only the first found partner is notified. Mass SMS on this
kind of model is currently not possible as seen list is not supported. There
is no standard use case of this in Odoo codebase.

Correctly support sms marketing on sale model by defining the necessary
methods. As sale order has only a partner_id field available we have to
correctly override phone related methods for SMS.

LINKS

Task ID-2431217
COM PR odoo/odoo#71140

X-Original-Commit odoo/odoo@987d974ccb

closes odoo/odoo#71178

closes odoo/odoo#71205

X-original-commit: 642816d0a819bf74927ed5aa11b6843cbb97d4df
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-25 14:20:08 +00:00
Thibault Delavallée 5d4208d44d [FIX] sms, various: fix override of sms and phone fields methods
There are two mixin involved in SMS notifications

  * mail.thread: standard SMS sending capabilities;
  * mail.thread.phone: advanced use with support of blacklist;

Both require to define fields to use when searching for phone numbers
(generally phone and/or mobile). Those are ``_sms_get_number_fields`` for
mail.thread standard implementation (in SMS module) and ``_phone_get_number
_fields`` for mail.thread.phone advanced implementation (in phone_validation
module).

In this commit we make mail.thread.phone act like a more advanced version
of mail.thread by making _sms_get_number_fields use result of _phone_get_number
_fields, and not the inverse. It allows to remove some overrides notably in
CRM having to define twice fields.

Task ID-2528169

closes odoo/odoo#71111

Related: odoo/enterprise#18428
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-20 15:02:24 +00:00
Thibault Delavallée a8fafbf02e [FIX] crm: correctly compute phone_sanitized without having crm_sms installed
Currently phone_sanitized computation on lead model works only if crm_sms
is installed. Indeed an override of ``_phone_get_number_fields`` is missing.
However ``_sms_get_number_fields`` coming with ``crm_sms`` and its ``sms``
dependency hides the issue as those modules are auto-install. However if
``crm_sms`` is uninstalled phone_sanitized is not correctly computed anymore.

Task ID-2528169
Oversight of odoo/odoo#45315

X-Original-Commit: odoo/odoo@45ae2922e5
2021-05-12 13:35:03 +00:00
Damien Abeloos 4b1c37160d [IMP] mass_mailing_sms: prevent raising an error in sms mailing
* When the option "Skip Queue" is enabled, there shouldn't be an error
  raised in case there is no matching record for the specified domain
  when clicking on "Launch now".
  (i.e. : no partner/contact associated with a certain number)

  In other words, the user should be allowed to launch a campaign without
  recipient whether its mails or sms, even without a cron rule.

  This was already the case when launching the campaign without skipping
  the queue (= handled by cron).

Task ID : 2410217
PR : https://github.com/odoo/odoo/pull/63370
2021-03-03 12:12:52 +00:00
Thibault Delavallée 1b8f2608ce [FIX] mass_mailing_sms: support convert_links for sms mailings
Mailing model holds a convert_links method that converts its local links.
It is not used in standard flows as it has more used for external tools.
Indeed sending mailings effectively shorten links without going through
that method.

However sms mailings are not supported by this method. In this commit we
ensure calling this method effectively convert links for sms mailings.
Same as email mailings links in standard flows are already shortened.

This allows notably to fix demo data as links were not converted
correctly as it was calling convert_links in xml.

Task ID-2274770
PR odoo/odoo#56887

Related: odoo/upgrade#1744
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-12-03 12:46:51 +00:00
Francois (fge) 1738f9c8f7 [IMP] mass_mailing_sms: support KPIs emails for sms mailings
Currently KPIs reporting on mailings is supported only for mail mailings.
However we think it is interesting to have insights on SMS mailings as well
even if less KPIs are available. Indeed we currently do not support open
or reply KPIs.

This report will be sent by email 24 hours after the campaign sms are sent.
Modification are done of the digest_mail_layout to be able to use it to
generate the KPI report for Email or SMS mass mailing campaigns.

The goal is to have a single template that can be used for both SMS and email
mailings.

Some wording is also improved in various places of KPIs process.

Task ID-2274770
COM PR odoo/odoo#56887
UPG PR odoo/upgrade#1744
2020-12-03 12:46:51 +00:00
Aurélien Warnon 8cd623e1d5 [IMP] mass_mailing[_sms]: pimp mailing list views & demo data
PURPOSE

Improves various views related to the mass mailing lists to help the user to
check the "health" of its lists at a glance.

SPECS

Introduce statistic fields on mailing.list:
- Total number of contacts (replaces the previous number of valid emails)
- Number of valid email contacts
- Number of valid SMS contacts
- Number of mailings sent using the list
- Percentage (and total count) of opted-out contacts
- Percentage (and total count) of blacklisted contacts
- Percentage of contacts having at least one bounced message

The statistics are shown on the kanban and also on the form view where they are
used to quickly reach the associated mailings / contacts.
Demo data were slightly adapted to show more interesting demos on views.

On a technical point of view, the various counts of contacts are made in a
single query using CASE WHEN syntax.
We need some entry points in the query to be able to dynamically add fields and
joins in the mass_mailing_sms app, but it's better than copy/pasting multiple
times a very similar query.

LINKS

Task 2182622
UPG PR odoo/upgrade#1990

closes odoo/odoo#53221

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-12-02 09:39:59 +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
Nasreddin (bon)andAurélien Warnon e598e74648 [IMP] mass_mailing(_sms): support calendar view and ease scheduling
PURPOSE

To ease the scheduling process, we introduce a new calendar view on mailings
that allows to easily schedule your communications. In addition, mailings and
sms views are improved to ease global usability especially about scheduling
configuration.

SPECIFICATIONSS

- add a calendar view to allow marketeers to either schedule or overview their
  ongoing mailings/sms;
  Side note: inspired by what has been done with Social Posts

- improve the scheduling flow by allowing to configure it directly in the form
  view using fields rather than action buttons that open an extra window. This
  implied removing the schedule wizard as everything is now configured directly
  from the mailing form view;

- add a constraint on 'schedule_date' to make sure it's not scheduled in the
  past;

- compute a calendar_date to be used by calendar view. It is either sent
date (if sent), next departure of cron (if in queue) or schedule date (if
scheduled).

- update mass_mailing_sms to match scheduling flow of emails and adjust the
  'sms_force_send' display to ease understanding ;

LINKS

Task ID-2202759
COM PR odoo/odoo#57000
ENT PR odoo/enterprise#12920
UPG PR odoo/upgrade#1736

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
2020-11-24 15:25:50 +00:00
Mariska Archielli (ram) a2e77a8419 [FIX] mass_mailing_sms : traceback on create contact list
Fix traceback when creating a new contact by checking the id list is not empty.

Task ID : 2302578

closes odoo/odoo#58681

X-original-commit: 31f2bb5e494965d31f5e49d47908fd4b5eb64077
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-09-28 13:16:07 +00:00
Martin Trigaux 6156f98288 [FIX] *: adapt action content retrieval
Use _for_xml_id to replace all the self.env.ref().read()[0]
This has the advantage of having a single point of control and to add
the fields filtering and model verification.

Add sudo for other operations on ir.actions.*
2020-08-17 09:09:02 +00:00
xO-Tx f7862cd2b5 [IMP] mass_mailing[_sms]: update subject and allow emoji support for sms content
PURPOSE

Subject field on mailing has not the same use in email marketing (subject of
emails) and in SMS maketing (used internally as there is no subject in SMS).

Purpose of this commit is to improve mailing form view to better distinguish
email and SMS flows.

SPECIFICATIONS

This commit changes helper for mailing subject and update its label according
to mailing_type (mail or sms), as well as the sms content field to enable emoji
support in mailing subjects. This is done through a fake sms_subject field
that is a text without emojis while standard subject allows emojis. Helpers
depends on the displayed field.

Override CRUD to synchronize sms_subject on subject to have only one field
used to store data.

Also allow emojis in SMS content, suing the enable_emojis option.

LINKS

Task ID-2224393
PR #49096
2020-08-11 14:38:33 +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
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
Adrian Torres 1daf8eb127 [FIX] *: set ondelete policy of required Selection fields
With this commit, Selection fields with `required=True` which are
extended via `selection_add` are given proper ondelete policies to
ensure the cleanup of records containing these extended options during
uninstall of the extending module.

This commit also cleans up leftover uninstall hooks that were being used
to handle the same set of problems prior to the ondelete mechanism being
implemented for Selection fields.

closes odoo/odoo#46325

Related: odoo/enterprise#9117
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-30 13:42:04 +00:00
Tiffany Chang (tic) f9ff21a200 [IMP] mass_mailing_(sms): Add unblacklisting button
Previously a blacklisted phone number or email address could only be
removed from their respective blacklist by going to the corresponding
blacklist view [in mass_mailing_(sms)] and manually
archiving/deactiviting the entry. All users could see that an email was
blacklisted via an fa-ban icon added next to their corresponding field
in the modules: crm, mass_mailing, mass_mailing_sms, and contacts (via
extension).

This commit adds additional fa-ban icons next to blacklisted phone
numbers and makes all instances of these icons clickable to remove them
from their corresponding blacklist using a wizard. There are several
limitations to this implementation including:

1. If both a mobile and phone number field appear within a crm lead
instance, then only the mobile field will indicate if it is blacklisted
(due to current implementation of PhoneMixin which only checks 1 phone
value against the blacklist and "sms" which returns mobile numbers first).
I.e. if a phone field value is blacklisted, but a value is typed into the
mobile field, then the phone field will never indicate that it is blacklisted.

2. If someone clicks on a unblacklisting icon after changing the
corresponding field value without clicking off the field input, then the
latest typed in value will be the one submitted for unblacklisting,
which may not actually be blacklisted (due to "is_blacklisted" flag
being a computed field and it not having a chance to re-compute to hide
the button).

3. If someone changes values in the blacklist, then someone who already
has a form open will not see icon disappear until something triggers a
re-compute of the "phone_sanitized_blacklisted" flag (this was already the
case with the icon, but now a user may try to unblacklist a value that is
already unblacklisted.)

4. Since the icon needs to be visible by everyone to indicate whether or
not a phone/email is blacklisted, users without corresponding unblacklist
permissions will be able to click on the icon. When they click on it, they
will be informed they do not have permission to unblacklist. A wizard was
determined to be the best way to implement this unblacklisting for the
following reasons:
  - A "Unblacklisting Reason" is needed and will not be stored as a field.
  - A field widget is unable to do this due to security settings +
    inability to refresh view after unblacklisting with a
    "Unblacklisting Reason" without wiping unsaved changes.

Additionally, to better align with GDPR, the corresponding form view for
the phone/email blacklist has been updated to use the same wizard to
track "Reason for unblacklisting". Unfortunately there is no
straightforward way to prevent direct "Archive" action, so users are
still able to bypass unblacklisting without being asked for a "reason
for unblacklisting".

Supports task: 2117635
Upgrade PR: odoo/upgrade#939
COM PR: odoo/odoo#45315
2020-03-26 10:15:18 +00:00
Thibault Delavallée aaefa35e29 [MOV] link_tracker, various: more link shortening tools to mail.render.mixin
PURPOSE

Move links shortening tools on mail.render.mixin to have rendering and
post procesing tools available on that mixin.

SPECIFICATIONS

Move html and text links shortening methods on mail.render.mixin class.
That way rendering and post processing is done in that mixin instead of
being specific to link.tracker model. Indeed those methods are tools and
not really business related methods.

Future commits will improve the way mail and sms composer use the render
mixin. This commit is therefore both a cleaning and preparing commit.

LINKS

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:25:04 +00:00
Tiffany Chang (tic) dced1d2f70 [IMP] mass_mailing_sms: Add mailing_type domain activity restriction
Restrict the displayed activities when clicking on "Email Marketing"
and "SMS Marketing" modules in the activity systray. Due to their
activities being linked to the same model, we need to distinguish which
activities belong to which module based on their assigned mailing_type
value. Without this domain restriction, users can still filter based on
mailing_type, but it is much less intuitive this way due to them being
separate apps.

Task: 2169498
2020-01-21 12:43:48 +00:00
Tiffany Chang (tic) abaae1e463 [IMP] mass_mailing_(sms): split systray activities
Due to 'mass_mailing_sms' inheriting mailing.mailing from
'mass_mailing', activities for these two modules would show up as one
"Mass Mailing" line in the systray. This commit adds additional logic
to remove this "Mass Mailing" line and replace it with 2 lines: "Email
Marketing" and "SMS Marketing" with their appropriately matching module
icon. For consistency, when only the 'mass_mailing' module is installed,
it will still display "Email Marketing".

Task: 2169498
2020-01-21 12:37:58 +00:00
Thibault DelavalléeandAurélien Warnon 110decad00 [REF] mass_mailing(_sms): force domain reset when changing model / type
In this commit we rewrite the compute on mailing domain to simply reset it
once the mailing domain is changed. Indeed trying to keep a previous domain
based on try / except has no meaning from functional point of view. If model
changes then domain should change as it is a business record, not just a
technical domain to try to apply.

LINKS

Task ID 2088577
PR #41877
Enterprise PR odoo/enterprise#7278

Co-Authored-By: Thibault Delavallée <tde@odoo.com>
Co-Authored-By: Aurélien Warnon <awa@odoo.com>
2019-12-16 15:58:16 +00:00
Rémy Voet ffe1d4047d [REF] mass_mailing: move from onchange / default to stored editable computed fields
PURPOSE

Try to move from onchange / default_get to stored editable computed fields.
Normally behavior should be the same (computed or set by user), with support
in create / write + onchange without additional code.

SPECIFICATIONS

Update classic fields with onchange to stored editable computed fields. It
means their value will come either from manual user input, either computed
based on triggers. Purpose is to remove all onchange and default_get when
possible.

Clean fields definition inconsistencies, like default / required on computed
fields. Indeed computed fields should always have a value, maybe coming from
user input. They should not have default / required that are attributes for
classic fields.

LINKS

Task ID 2088577
PR #41877
Enterprise PR odoo/enterprise#7278
2019-12-16 15:58:16 +00:00
Debauche Stéphane 8453b7fb90 [IMP]: mass_mailing: improve some views
- In the campaign form view, when you click on "SMS", the filter has changed
  ``My Mailing`` -> ``My SMS Marketing``
- In the campaign form view,  display the Mail/SMS subject instead of the SMS name
- In UTM, move the campaign from the data to the demo data

Task #2082296

closes odoo/odoo#40205

Related: odoo/enterprise#6685
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-11-14 07:37:16 +00:00
Thibault Delavallée aa0656d950 [FIX] mass_mailing_sms: leftover reference to a renamed model
closes odoo/odoo#39874

X-original-commit: c34f860548b0d68773b25e89fb99aad1fb144b8c
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-11-06 13:14:58 +00:00
Paul Morelle c78cda8876 [FIX] link_tracker: support any url
URLs with parameters were not correctly supported by the regular
expression.
For example, URLs with parameters were truncated before the '?'.

This patch adds support for a wider range of URLs, and checks in a test
that the parameters are correctly handled.

closes odoo/odoo#39762

X-original-commit: 616e145635eac06a0a44ab3d899f4a9e707b3ba8
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2019-11-04 15:01:50 +00:00
Yenthe666 473403792e [FIX] *: fix "there is no" sentences
"There is no <plural>" is not correct
cf https://english.stackexchange.com/a/26634

closes odoo/odoo#38205

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-10-08 14:30:19 +00:00
ryv-odoo 100249f172 [FIX] mass_mailing_sms : sms on record chatter
- For the sms marketing, by default the sms is now log
on the chatter of the record (like with the sms composer).
But can be disable it with keep arhives unchecked (in debug mode only).

TASK_ID : 2075733
2019-09-30 14:28:30 +00:00
ryv-odoo b002973f0e [IMP] sms - mass_mailing_sms : unsubscribe sms improvement
- In the sms marketing, the sms_allow_unsubscribe is now False by default
and move the field in the setting page.

- Improve the unsubscribe link for the sms : adding "\nSTOP SMS : "
message before the link.

TASK_ID : 2075733
2019-09-30 14:28:28 +00:00
Thibault Delavallée 29d5134d3c [FIX] mass_mailing_sms: fix sms mailing retry not really working
Retry was not working for SMS marketing as it was actually not really
implemented. It now correctly unlinks failed sms and traces and reschedule
the mailing accordingly

It is also possible now to force send while being in queue mode to avoid
having to switch too much between states.

LINKS

Task 2076366 (send now)
Task 2067873 (template access)
PR #37298
PR odoo/enterprise#5750
2019-09-25 11:13:03 +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
qmo-odoo 79bfdbf30c [MOV] mass_mailing_sms,link_tracker: Move convert_links_text to link_tracker
This method being needed in the new social app, it made sense to move it to
the link_tracker module to make it available for mass_mailing_sms and social
to avoid unnecessary duplicated code.

LINKS:

closes odoo/odoo#34973

Taskid: 2045210
Pr: 37143
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-09-20 14:44:57 +00:00
qmo-odoo b16ce3f89e [IMP] mass_mailing_sms: add missing SMS information to UTM campaigns
This commit adds the concept of sms into the utm.campaign

  * Add "Send new sms" button to the cta
  * Add a SMS stat button
  * Add a sms page in the notebook

LINKS

Task ID 2074813 (FP request UTM refactor)

closes odoo/odoo#37185

Pr: #37185
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-09-20 14:22:06 +00:00
Debauche Stéphane 1692d1ff3e [FIX] mass_mailing: ease marketing automation inheritance
Purpose of this commit is to add an anchor in mass mailing view in order
to ease some marketing automation fixes.

Also reset the sms composer context when sending sms from an sms mailing
as it may create some issues when sending manually an sms from a marketing
activity (see enteprise). Indeed wrong participant is chosen.

Task ID 2073158 (marketing automation fixes)
PR #37185
PR odoo/enterprise#5693
2019-09-20 14:05:41 +00:00
Patrick Hoste 545b00ee79 [IMP] mass_mailing_sms: fix various issues and ease marketing automation integration
Including

  * allow to keep archives when performing a mass sms. This performs a log
    in mass in addition to sending SMS in batch, which could slow your
    sending;
  * move writing on failed traces in its own method to ease inheritance in
    marketing automation sms;

Task ID 2053632

closes odoo/odoo#36503

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-09-16 09:51:53 +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
Thibault Delavallée 14648272da [ADD] mass_mailing_sms: support SMS in mass mailing
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

Create a new application called "Mass SMS" that follows the structure of
mass_mailing application.

General guidelines

  * use the fa-comment icon for this module;
  * add a "Notification type" field to the mailings: email or sms. Set it
    invisible and set as domain from context when choosing mass mailing or
    mass sms application (menus / action specific);
  * adapt the metrics from Mass Mailing to SMS
    * sent = received = whether the SMS was sent or not;
    * opened => we don't have this information;
    * replied => we don't have this information;
    * clicks = from link tracker (no change of behavior);
    * bounced = SMS that failed to be delivered because the format is wrong;
    * exception = any issue when sending SMS;
  * keep the Mailing Lists menu, hide email related fields on contact model;
  * settings: hide the "Specific Mail Server" feature

Mailing form view

  * add an "SMS Content" tab between Mail Body and Options. In there, we should
    have the following fields:

    * content
    * opt-out link: provide a link to the Unsubscribe page. Make it as short
      as possible;
    * SMS Template

  * add an "SMS Text Message" Medium;

Mailing actions

  * add an "SMS Sent" smart button. Use the fa-comment-o icon and it should
    redirect to the same list views as the "Email sent" smart button and list
    the contacts to which an SMS was sent;
  * add a "Mobile" field in the list views of the "Email sent" smart button:
  * adapt the TEST button > Test Mailing modal to SMS (we should have 1 button
    for Email and 1 for SMS); update description;
    * default value for the Recipients field should be Name of the current
      user, work mobile/phone number;
    * If there are no Work Mobile/Phone numbers set on res.users, display
      (123)-456-7890 instead;
    * rename the Send Sample Mail button into Send Sample SMS;

  * adapt the SEND NOW button > Confirmation modal to SMS. Change the message
    into "This will send the SMS Text Message to all recipients. Do you still
    want to proceed?"
  * hide the following elements:  Subject, From, Reply to, Attachments, Mail
    Server, Mail Body tab; Opened, Replied;
  * adapt the label of the following "warnings" to SMS
    * x SMS Text Message(s) have been ignored and will not be sent.
    * x SMS Text Message(s) are in queue and will be sent soon.
    * x SMS Text Message(s) could not be sent.

Mailing kanban view

  * hide the following stats: https://nimb.ws/grvBn0: Opened, Replied;

Mailing list / contact management

  * following fields should be left empty: https://nimb.ws/3HBeJL: Opened,
    Replied;
  * when browsing through mailing lsits and contacts through the Mass SMS
    application, update actions and views to hide fields related to
    email and display only phone-related information;

UTM Campaign

  * form view > Related Mailings tab: the following fields should be left
    empty if notification type = SMS: https://nimb.ws/nfvr1O: Opened, Replied

Mass Mailing > Reporting (mail.trace.report model)

  * adapt the reporting based on the fact that we do not have the following
    metrics for SMS: Opened, Replied;

Mass Mailing > Configuration > Blacklist

  * do not display any email information (phone blacklist is about phone);
  * support phone blacklist. Phone blacklist is therefore a separate model
    from mail.blacklist to simplify management. It is included in sms sending
    process like mail blacklist when mailing in mass;

Opt-out and blacklist handling

  * we do support mailing lists because they could come from different sources
    and are a way to communicate with a specific audience (and not just a list
    we bought), e.g. subscribe to this list to be kept updated whenever this
    product is back in stock, or to receive results of this ...
  * if the SMSing is from a list, opt-out removes ourselves from the list;
  * if it is from the contact ==> Sent to blacklist;
  * allow to attach unsubscription links in sent SMS, redirecting to a new
    route in mass mailing SMS allowing quick unsubscribe and/or blacklist
    of phone numbers;

Error management

  * if the user clicks on Send Now / Schedule / Test and does not have enough
    credits, open the "Insufficient credits" modal in a lazy option (aka when
    having failed statistics linked to insufficient credits);
  * on the mailing, we however display this failure as :
    * a message on the mailing kanban view
    * a message on the top of the form view + same behavior as the mailing and
      "Could not be sent" https://www.screencast.com/t/BExgd1Gc;

LINKS

Task 1997464
PR #34424
Original SMS addition: Task 1922163 (4287481)
2019-08-12 12:00:22 +00:00