Commit Graph
530 Commits
Author SHA1 Message Date
Thibault Delavallée c8aabac87d [IMP] mass mailing: update reply_to_mode keys
Propagate reply_to radio keys (update and new) to mass mailing in order to have
a coherent naming (was thread and email). This naming is also coherent with
gateway naming (message_update and message_new).

LINKS

Task ID-2117639
COM PR odoo/odoo#40931
ENT PR odoo/enterprise#17941
UPG PR odoo/upgrade#2419
2021-04-26 14:18:33 +00:00
shreya thakrar 59ce7d3969 [IMP] mail, mass_mailing: ease "reply to" fields understanding
PURPOSE

Right now, `reply_to` field on email template is misleading due to poor
explanation. This commit improves the placeholder and tooltip of the fields
to make the purpose of the field clearer especially for non technical users.

SPECIFICATIONS

Update reply-to field placeholder to "Preferred email address when sending
via mass mailing options".

Update reply-to field helper message to "Preferred email address when sending
via mass mailing options. <br> Only used when the answer is not added into
the original discussion.""

Update the no_auto_thread field label to "Reply to" in composer and introduce
a new radio button replacing the checkbox

  * The original discussion (thread)
  * Another email address (new)

Rename fields on mail_thread and wizard: ``no_auto_thread`` should be replaced
to ``reply_to_force_new`` to ease understanding and be prefixed by reply_to.

LINKS

Task ID-2117639
COM PR odoo/odoo#40931
ENT PR odoo/enterprise#17941
UPG PR odoo/upgrade#2419
2021-04-26 13:53:20 +00:00
Dharmraj Jhala 9ef6cc2663 [FW][FIX] mass_mailing: show correct recipient count in merge wizard
Right now, when o2m/m2m are set from default_get from web client,
the compute methods from the records being set yield `NewId` when
we try to get ID for the record, even if the records are existing.
It can result into wrong computation when the ids of the records
are used in preparing the data.

The same thing happens in the wizard that is used to merge mailing
lists. When we select multiple mailing lists and open the wizard
to merge them, they are set in the `src_list_ids` of wizard, but
number of recipients are always zero for them, because the method
that computes `contact_nbr` (recipients) on mailing lists fetches
data from the query, but we can't match (or find) the stats from
query result because we don't get the actual ID in recordset for
existing records.

This commit fixes the behavior by using `_origin` on the records
while finding data in the compute method, and thus getting the
correct recipient count.

Task ID-2471692
COM odoo/odoo#67213

closes odoo/odoo#69820

X-original-commit: 71430334bffa4b5da3f9374c734e6231cb42a7c7
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-04-26 09:03:10 +00:00
Thibault Delavallée b96d941aaa [IMP] mail, (test)_mass_mailing, test_mail_full: improve email-based mailing tests
PURPOSE

Purpose is to have more tests when sending mail mailings, notably about
canceled or failed mails or sms as well as jinja and links rendering.

SPECIFICATIONS

In this commit we improve Email Marketing mailing tests. We notably

  * add tests for void and invalid email and numbers. It allows to check they
    correctly update their trace status;
  * add tests for unsubscribe and view links embedded in mass mailing emails;
  * add tests to simulate a click on links sent through mass mailing and
    ensure click statistics are effectively updated;
  * add tests to simulate bounce emails coming back to the mail gateway;

Default content of mailings used in test is updated to ensure jinja is
correctly rendered, including links and some corner cases. This will also
helps ensuring behavior is kept when converting to QWeb.

Various docstrings are added to helpers and custom asserts.

LINKS

Task ID-2508643
Followup of odoo/odoo#68874 (improve mail tests)
Prepares Task ID-27033 (support QWeb in templates)
Prepares Task ID-2377974 (clean trace and status management in mass mailing)
COM PR odoo/odoo#69461
ENT PR odoo/enterprise#17780

X-original-commit: 7b940ad46bde30f9bf16837f7bff5a70cd88c640
2021-04-20 09:18:21 +00:00
nounoubensebiaandThibault Delavallee e58379f769 [IMP] mass_mailing: create "add to mailing list" wizard
This commit introduces a new wizard that allows adding existing contacts of a
specific mailing list to another mailing.list.

It's typically used on the list view of a mailing.list where you tick a bunch
of contacts and add them all at once to another mailing.list (existing OR new
one that you create on the fly).

That tool will help users manage their mailing.list a bit easier and avoid some
tedious copy/pasting if mailing.lists need to share common contacts.

Wizard has two options: either simply create a new mailing list, either create
it and use it directly in a new mailing. It allows to cover the following
user flow
  * select contacts;
  * add them in a new list created on-the-fly;
  * jump on a new mailing targeting this mailing-list;
  * fill body, launch, enjoy !

Task-2453990

closes odoo/odoo#65965

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Noureddine Bensebia <neb@odoo.com>
Co-authored-by: Thibault Delavallee <tde@odoo.com>
2021-03-23 13:52:12 +00:00
Lucas Perais (lpe) 8f033a2b50 [FIX] mass_mailing: typo that broke ensure_one down the line
Sometimes it crashed when the domain used for the mailing cron
returned more than one record

source commit: 1738f9c8f7

closes odoo/odoo#67556

X-original-commit: cb97f7c64a1fa575799a7832cb52e433436581e0
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-09 16:35:48 +00:00
Julien Castiaux 2ba1e83253 [IMP] mass_mailing: use cron trigger to send "now"
The "launch" button of an email campaign mark the current campaign ready
to be processed. As sending all the mails is a pretty heavy operation,
it is done asynchronously in a cron. The cron was running every hour, it
means the cron was running even if there was no active campaign and it
has a best precision of 1 hour.

We now use the new mechanism of cron triggers (4b28f11) to schedule the
con execution at the time the campaign is configured to be sent. It
achieves a better precision and ensures the cron only runs when there are
stuff to process.

We still let the cron run once a day as a security until the cron
mechanisme proves reliable.

closes odoo/odoo#65124

Task: 2416741
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2021-03-09 09:31:24 +00:00
Thibault Delavallée d2079b1fca [DOC] mail: clean some docstrings and helpers
As I was passing by I found some docstrings or helpers could be updated or
rephrased a bit more clearly. This is free as in free beers, without beers.

Some code about mail features (posting) may also be re-indented to ease
understanding of future modifications. Or just because we had to read
it and go through many files. Still free beers.

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
2021-03-05 15:20:53 +00:00
Damien Abeloos 62ae7896f5 [IMP] mass_mailing: add various usability improvements
* When clicking on a button that is a preview for a "mass mailing",
  always open it in a new window for the user that is editing the form, so
  that changes are not discarded (when leaving the page).
    - The option "Open in a new window" remains effective for the recipients of the mail.

* Rename Mailing Campaign to Campaign : this is just a mailing campaign,
  they are used everywhere in the marketing scope now. And it can be part of
  a multi-channel campaign.

* Show/hide mailings count depending on settings :
    - Mailing Campaign must be activated in the email marketing settings in
    order to display the Mailings count in the utm.campaign kanban view

* When there is no matching recipient for a mailing campaign,
  properly display 0 / 0 instead of 0 / 1 to better indicate that it is
  not expected that anyone will receive an email.

Task ID : 2410217
PR : https://github.com/odoo/odoo/pull/63370
2021-03-03 12:12:52 +00:00
Julien Castiaux 412973f7d8 [FIX] mass_mailing: wrong clicks_ratio compute
Fine tuning of 2d63fff13be6d19170fb58fd0248e879e2be2de8

closes odoo/odoo#67173

X-original-commit: d4210430a911fb23d6fce5dbd4279f03f134cd2e
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2021-03-03 15:36:54 +00:00
ijas ahammed 836f962404 [FIX] mass_mailing: allow duplicating mailing contact from mailing list
Before this commit:
While trying to duplicate a mailing contact within particular
mailing list, it  throws an user error saysing that 'A mailing
contact cannot subscribe to the same mailing list multiple times.'

After this commit:
User can duplicate a mailing contact from a mailing list without
the user error. In this case, we simply remove the default_list_ids
from the context, because all the mailing lists will be simply be
copied over from the existing contact and so we don't have to
re-add the default ones.

closes odoo/odoo#67094

Task-id: 2431344
X-original-commit: b92ebf3a47b7b1263669ac020ac8c213027400ea
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-02 16:09:12 +00:00
Julien Castiaux 917964266e [FIX] mass_mailing: wrong clicks_ratio compute
The `clicks_ratio` field was computed outside of its compute method,
this is illegale as the ORM cannot protect the field from being included
in the "towrite" structure.

Backport of 7acc035

closes odoo/odoo#67111

X-original-commit: ca1f2e9d1285a02ebaf2502eaeb3d38feea6c477
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2021-03-02 17:44:20 +00:00
nounoubensebia 52df97e4f3 [IMP] mass_mailing: improve list duplication and protect "opt-out-ness" of contacts
Before this commit, on duplication, the contacts who opted-out from the
original list have the opt-out field set to False on the duplicated list.

After this commit, on duplication, for a contact who has opted-out from the
original list,the opt-out field will be set to True on the duplicated list,
Because when a recipient opt-out from a mailing list, chances are high that he
does not want to be included in the new duplicated list.

This commit also brings some fixes to the update and create methods on the
mailing_contact_subscription model so that

- The unsubscription_date is set to now only when no unsubscription_date is
  given, because when another value for unsubscription_date is given by the
  user it should be applied

- The opt_out field is set to True when the user sets an unsubscription_date,
  because when a date is set for unsubscription_date, it means that the user
  has opted-out from the list

We also update name of mailing list when duplicating it, adding a copy
mark to it.

Finally we also avoid copying mailing_ids through m2m relationship as it
may impact existing mailings.

Task ID-2431383

closes odoo/odoo#65277

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-02 14:19:34 +00:00
nounoubensebia 2b4ccc326b [IMP] mass_mailing, mass_mailing_sms: revamp mail trace form
- make all the mailing trace fields readonly inside the form,
  beacause a user would not want to edit a mailing trace as
  this will make the related statistics about the mailings
  incorrect
- change the mailing trace form view interface to give more
  clarity to the user and to better separate between different
  fields
- add a stat button to redirect the user to the coressponding
  mailing contact so that he can easily access the mailing
  contact in order to blacklist/output/correct the email address
  or the phone number
- remove the warning messages in the mailing trace form view
  because the user already has all the information in the
  status bar of the form
- update the inherited mailing trace form view located in the
  mass_mailing_sms module to adapt to the new changes in the
  trace form view of the mass_mailing module

Task-2440420
Enterprise PR: https://github.com/odoo/enterprise/pull/16105

closes odoo/odoo#65469

Related: odoo/enterprise#16105
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-02-11 12:08:03 +00:00
Thibault Delavallée 1b8aa71e6b [FIX] mass_mailing: fix batch call of action_send_mail
Loop inner calls should use mailing not self.

Task ID-2455433

closes odoo/odoo#65755

X-original-commit: d63734eb6e00c079ad9c0658674efb2321610173
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-02-09 07:55:23 +00:00
Raphael Collet 60e0c99ede [REV] mass_mailing: correctly support mailing domain from default context value
This partially reverts commit 1ec887b773,
which was a hack to deal with the issue.  From now on, the first call to
onchange() no longer computes editable fields when they are given a
default value.

X-original-commit: c01657d345f59e3ccea70a5004732050fae99320
2021-01-13 16:19:15 +00:00
Thibault Delavallée 576556d846 [FIX] mass_mailing: let subscription_ids won over default_list_ids
When creating new contact coming from a mailing list a default_list_ids
context key is set. It is used to give a default value to list belonging
and also to compute opt_out.

However subscription_ids field is displayed on contact form view, allowing
to add the contact to mailing lists. We may end up in situation where a list
is given twice to a contact: once through default_list_ids and once through
subscription_ids field manually completed by users.

In this commit we therefore merge those two values when creating contacts.

Also improve some wording while we are at it.

LINKS

Task ID-2300385
COM PR odoo/odoo#59872
ENT PR odoo/enterprise#14031

X-original-commit: 30bab79183b4b9f1a571d6ebd9bbc1f3c0692457
2020-12-11 18:12:17 +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
Victor FeyensandThibault Delavallée 3dc757008f [IMP] mass_mailing: support batch creation
See merge commit for more details.

Task ID-2330149
COM PR odoo/odoo#61246
ENT PR odoo/enterprise#14561

Co-Authored-By: Thibault Delavallée <tde@odoo.com>
Co-Authored-By: Victor Feyens <vfe@odoo.com>
2020-12-03 10:18:56 +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
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
Achraf (abz) f982d94cfb [FIX] mass_mailing: Create campaign from opportunities
Issue

    - Open any opportunity
    - Go to "Extra Information" and click on "Campaign" field
    - try to create new campaign

    Traceback is raised

Cause

    "self.ids" is empty and the "tuple(self.ids)" on the SQL query return "()"

Solution

    Initialize campaign field with default values

opw-2376082

closes odoo/odoo#61476

X-original-commit: 5797be02e32e68e0a188bfdc8b85068fb8fa5435
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2020-11-06 13:01:29 +00:00
Priyanka Kakadiya 7f5ef74b90 [FIX] mass_mailing: do not add opt_out by default on mailing domains
In mass mailing (_sms) when you set `Mailing Contact` as target model the
`opt_out` field is added to the default domain. However as it is a computed
field depending on a single mailing list given in context it should not be
used that way. Moreover current implementation raises a warning as only some
custom views can use this field accordingly.

This commit removes `opt_out` field being set by default in mailing domain and
also removes the UserError raised by the search function, thus avoiding
unwanted warnings.

Opt-out field is automatically taken into account when sending mass mailing on
contacts (see ``_get_opt_out_list``) so removing it from domain is actually
even better for coherency. Opt-out is not an option in sending process.

Task Id-2300427
PR #57310

closes odoo/odoo#60262

X-original-commit: 5ccf5b51feaa348d775890e107fd30cd750699d8
Related: odoo/enterprise#14200
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-19 14:31:54 +00:00
Martin Trigaux 2683184aa6 [FIX] *: fix all the typos
And other reported English mistakes in source string
Courtesy of Transifex translators

And remove leftover from gengo

closes odoo/odoo#59022

X-original-commit: 26efc84c5cac47a2cc83d7b084f8b71528fec6c7
Related: odoo/enterprise#13781
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-05 09:36:34 +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
Olivier Dony d6e734d436 [FIX] mass_mailing: speed up recipients filtering
Using a `set` to lookup recipients that already received an email is
much faster on average than with a list. `x in list` is O(n) on
average, whereas `x in set` closer to O(1) on average.

Example: for a sample mailing with 50k recipients that is half-through,
filtering the remaining half (25k) took 10s with a list, and 1s with
the set.

X-original-commit: 7948698cc6e6b0af5fc84847ea7ec166882eda0b
2020-09-05 04:34:13 +00:00
std-odoo 0c6dcb5b88 [FIX] mass_mailing: fix performance issue on the "total" field
Issue
=====
There's a performance issue when computing the total field on the
mailing model. When there're a lot of record (e.g. 500.000 leads).

This is because when we compute the field, we are fetching all the
records and then we calculate the length of the array.

We can just use a `search_count` and let Postgre count the records.

Task-2313123

closes odoo/odoo#56298

X-original-commit: d1ab37de0c4782b4f12b44f9858446b4c9c7dc08
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-08-21 12:11:11 +00:00
Raphael Collet 8486007832 [FIX] mass_mailing: query without ids in compute methods 2020-08-20 13:39:04 +00:00
std-odoo 13d1f3e012 [IMP] mass_mailing: allow to customize the mail preview
Purpose
=======
Allow to customize the preview text in mass mailing.

Specifications
==============
We do not generate the preview text anymore, instead we add
a new field to let the user choose want he want to put into
the preview. As the preview is added in the mail body, it
supports dynamic placeholders.

Rename "View in browser" into "View Online" because the text
will be displayed in the preview if the snippet is added at
the beginning of the email. And we want to make it shorter.

Remove the alt attribute of the image tag which are not part
of the "email content" in the mass mailing template.
So, we improve the email preview in the mail clients
(otherwise the mail client include the alt attribute into the
preview).

Task-2313872

closes odoo/odoo#55695

Related: odoo/upgrade#1584
Related: odoo/enterprise#12323
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-08-18 08:47:28 +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
std-odoo ed4846dd9d [IMP] mass_mailing: add preview block for mailings
PURPOSE

When displaying an email in a list the mail client (gmail, outlook...) computes
a preview based on the content. This preview is generally not well computed as
it contains a lot of garbage and tags while it should contain only relevant
text.

SPECIFICATIONS

To build this preview, all mail clients read the content of the email.
The only way to be able to customize the preview is to add an invisible
HTML element at the beginning of the email with the wanted preview text.

We add at the end of the preview `&zwnj;` (zero-width non-joiner) to
fill the end of the preview in order to not have the beginning of the
mail at the end of the preview. It doesn't work with simple space as
the mail clients trim each HTML element content.

Task ID-2172125
PR #49886
2020-08-05 13:55:04 +00:00
Sébastien Mottet (oms) ac0579263b [IMP] mass_mailing: add 'view in browser' link in mailings
PURPOSE

Add a block that allows recipients to check the email in a browser in case
their mail service provider does not render it well or to see it full screen.

SPECIFICATIONS

A thumbnail has been added in the snippet thumbnails list of the mail editor.
It allows to add an header snippet. This snippet contains a link allowing the
recipient to see the mail in its browser instead of its mail client.

Add a route to display a mailing content. This route should be recipient
dependent as mailings could contain jinja markers. Using the same access token
and check as unsubscribe route this public route allows to display a mailing
content directly rendered for a given customer.

_get_unsubscribe_url method is moved from mail_mail to mailing as it does
not really belong to the mail model. Indeed it is mailing dependent.

A view URL leading to the view in browser route is added. It is managed like
the unsubscribe url: magically avoid shortening, magically rewrite when
sending email.

Task ID-2239327
PR #49886
2020-08-05 13:55:04 +00:00
Thibault Delavallée fd62fa16ad [FIX] link_tracker, mass_mailing: make convert_link work in batch
In this commit we correctly use mailing variable inside a loop
on self to enable multi-mode on convert_links method.

We also update link_tracker shortening methods docstrings. We
add some explanation, notably about parameters. A variable is
fixed to better indicate parameter content (html -> content).

closes odoo/odoo#55452

X-original-commit: 3e1633d5b3590ec5657b851c21cbae059944d964
Related: odoo/enterprise#12218
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-08-05 10:39:09 +00:00
Martin Trigaux 400cc4f14e [FIX] *: correct all or improve code translation lookup
This commit fixes all issues detected by the new pylint
gettext-variable test.
It converts some calls to the new syntax
  _("Foo %s", bar)

to progressively migrate the code to the new syntax.

A few calls were not technically incorrect but still detected by the
linter.

  _("Foo" +
    "Bar")

has been converted to

  _("Foo"
    "Bar")

as it has the same effect and make sure the argument is of type
asteroid.Const instead of BinOp).

closes odoo/odoo#53683

Related: odoo/enterprise#11467
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-06-30 10:19:59 +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
std-odoo b16843230d [IMP] mass_mailing: send a statistics email to the mailing responsible
Purpose
=======
Provide a follow-up/overview of the Mailing 24 hours after its been sent.

Specifications
==============
Send an email to the responsible of the mailing 24 hours the last email
of the mass mailing.

During the link trackers creation, extract the button label if exists
(so we can display them in the statistics email).

Technical remarks
=================
The statistics email is sent to the responsible of each mailing in the
CRON of mass mailing.

Task-2227411

closes odoo/odoo#49836

Related: odoo/upgrade#1094
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-06-12 11:49:45 +00:00
Jérémy Hennecart c15f9efed0 [IMP] mass_mailing: add email marketing tour
PURPOSE

Improve the Email Marketing tour and onboarding to create a "wow effect" when
users test the app.

SPECIFICATIONS

Create a tour for mass_mailing to let user visit Odoo Email Marketing through
a simple mailing creation flow.

This require the following functional changes

  * by default, if user chooses to contact mailing lists and there is a single
    mailing list available, add it as default value for chosen list;
  * create a master mailing list data containing the admin user so that he can
    easily follow the tour and test the mailing application;

LINKS

Task ID 2194876
Community PR odoo/odoo#48259
Upgrade PR odoo/upgrade#983

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-05-29 09:48:40 +00:00
Sébastien Mottet (oms) fd87ff4843 [IMP] mass_mailing(_sms): "Click" stat button now redirects to link trackers
PURPOSE

Clarify the use case in which a specified email address is set as replies may
not be traceable. Make the %Click KPIs visible for Emails as well. Allow users
to report on the links that have (or not) been clicked from their
mailing.

SPECIFICATIONS

Display list of link trackers linked to the mailing on 'click' stat button
click.

Task ID: 2202495
PR #48339

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-05-27 11:00:29 +00:00
Sébastien Mottet (oms) 60e4e9912a [IMP] mass_mailing: improve displayed info text and KPIs
PURPOSE

Clarify the use case in which a specified email address is set as replies may
not be traceable. Make the %Click KPIs visible for Emails as well. Allow users
to report on the links that have (or not) been clicked from their
mailing.

SPECIFICATIONS

Add an info text for the "specified email address" option in the "reply to"
field. If target model does not accept incoming emails warn the user it is
likely to fail.

Number of emails/sms sent is now display as clickable text instead of stat
button and clicked stat button is now also visible in mass_mailing.

Task ID: 2202495
PR #48339
2020-05-27 11:00:27 +00:00
Siddarth Gajjar a1d27a153c [REF] {website_}mass_mailing: display social links in mass mailing templates
PURPOSE

Using Email Marketing or Marketing Automation without website installed will
not populate the links for your social media accounts.

SPECIFICATIONS

Move social_links template directly into mass_mailing and use company
information available through social_media module as default values, then
overridden by website information.

TaskID 2036094
PR #51025
Enterprise PR odoo/enterprise#10497

Related: odoo/upgrade#1212
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-05-20 08:26:24 +00:00
Sébastien Mottet (oms) 28734ac268 [IMP] mass_mailing: propagate UTM on replies
USE CASE

Send a mailing to some recipients. Set reply-to of this mailing to an alias
creating records on a model inheriting from utm.mixin. UTM informations on
mailing are not propagated to the newly-created records.

SPECIFICATIONS

When an user answers to a mail of a mailing with an alias creating records
on an UTM enabled model, propagate UTM from the mailing to the new record.

In order to set UTM informations during record creation, "message_new" has
been overridden in mass_mailing. That way it is automatically available on
all models inheriting from utm.mixin.

A test simulating this scenario has been added. It checks if UTMs info are
correctlwy set on the created record by comparing them to the mailing's UTM
info.

Task Id 2210334

closes odoo/odoo#48602

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-05-19 10:21:28 +00:00
Thibault Delavallée 5a3fc46847 [FIX] mass_mailing: correctly consider replies for traces
Consider an email going through the mail gateway. Its headers References
and In-Reply-To are used in mail gateway to find if it is an answer to an
existing discussion thread.

Notably in mass mailing it is used to set mailing traces (called statistics
before 13.0) as opened and replied. However currently only the References
header is used.

In this commit we now use References or In-Reply-To like what is done in
mail gateway.

== 13.2 FORWARD PORT SPECIFIC ==

Code in tests has been updated to use new mockups tools and variables available
in test_mail

LINKS

Task ID 2257717
PR #51445

Forward-port-of: #51319
Forward-port-of: #51247
X-original-commit: 9921e38692e7dc4547afc34acc395da340eca410
2020-05-18 17:14:41 +00:00
Thibault Delavallée 9a9225fbb7 [FIX] mass_mailing: fix statistic replied state computation
Trace status is a computed field based on other fields. Those store the
datetime at which a specific action has been performed: opened, replied,
bounced, ... depending on those fields status of trace is computed.

Previous backport fixed mailing trace management to match heuristics used in
12.0 . However when replying, trace is considered as open instead of replied.
It is now fixed as we consider replied being more important than opened.

Task ID 2257717
PR #51445

Forward-port-of: #51319
Forward-port-of: #51247
X-original-commit: 8df2b0b8baabb35fdd44f5cbcc1cf72ebb03cc79
2020-05-18 17:12:56 +00:00
std-odoo 1c7c837a10 [FIX] mass_mailing: improve opened traces tracking
Purpose of this commit is to improve tracking of opened traces. Notably
a token is added to ensure we do not mess with traces and have unique
tracking URLs.

MIGRATION REMARK

Emails sent before the migration will not be marked as opened anymore after
migration. We recommend to avoid sending statistically important mass mailings
about one week before migrating database. Indeed statistics show that most of
open emails happen within the first week after being sent.

Task 2223146

closes odoo/odoo#49139

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-05-18 08:30:59 +00:00
Thibault Delavallée 9721488817 [FIX] mass_mailing: do not force trace state that is computed
State field on trace model is computed based on other (datetime) fields.
It seems therefore unnecessary to force its value.

LINKS

Prepares task ID 2238597 (notification and trace models cleaning)
Task ID 1906925 (mass mailing tests cleaning)
PR #50169
2020-04-24 15:35:43 +00:00
Thibault Delavallée f7e9a24962 [IMP] mail: add some docstrings and helpers
PURPOSE

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

LINKS

Prepares task ID 2238597 (notification and trace models cleaning)
Task ID 1906925 (mass mailing tests cleaning)
PR #50169
2020-04-24 15:35:43 +00:00
Victor FeyensandThibault Delavallee 3f6625ef13 [IMP] link_tracker, mass_mailing: uuse read_group instead of computing len of one2many fields
PURPOSE

Several counter fields are performed inefficiently. They use compute methods
using length of 2many fields instead of making use of more efficient ORM
methods like read_group.

SPECIFICATIONS

There may be a lot of clicks linked to a given link tracker. Compute the count
of clicks in batch with a read_group to improve performance.

Same for utm campaign mailing count performances.

Some missing indexes are added to speedup queries.

LINKS

Task ID 2196182
PR #44662

Co-Authored-By: Victor Feyens <vfe@odoo.com>
Co-Authored-By: Thibault Delavallee <tde@odoo.com>
2020-04-21 12:28:52 +00:00
Thibault Delavallée bea9bc3d6c [IMP] mail, mass_mailing, phone, survey: call toggle_active / action_(un)archive when possible
Purpose of this commit is to call toggle_active or archive / unarchive methods
instead of manually writing on active field. Indeed this allows to trigger
business code related to archive / unarchive which is normally located
in toggle_archive (called by action_archive and action_unarchive).

Task ID 2170708
Community PR odoo/odoo#46563
2020-04-03 12:59:28 +00:00
std-odoo aa21f9aa34 [FIX] mass_mailing: fix copy of a mailing.mailing
Bug
===
In ffe1d4047d "onchange" were replaced
by computed fields. But in 950296f661499f499b0a5776ce7fd91a66c2a63f,
they use manually this onchange method in the copy, which is not needed
with computed field (bug introduced certainly during a forward port).

Task-2226235

closes odoo/odoo#48531

X-original-commit: 63712e106dfae6ef99d93a0ba2ff4102ed430719
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-03-27 15:59:07 +00:00