When mailings have no responsible, KPIs emails are broken as there is no
from and to on the mail. This leads to mails being invalid and set in
exception.
Moreover currently author and from / to of those D+1 emails are not coherent
as author is current user (generally odoobot as this is generated through
a cron) while from and to are based on mailing responsible.
In this commit we make statistics emails more coherent
* when a responsible is set on the mailing: author, from and to are linked
to the responsible;
* when there is no responsible, current user is set as it may be sent by
regular people;
* reply-to is set to company email as it is often the case with 'marketing'
emails;
Task-2686586 (Repair mailing statistics email)
X-original-commit: 95a21ca16f560cf4341c547f6bc909d3261acd1b
Part-of: odoo/odoo#79877
When there is an issue updating mailing state (concurrent access, or some other
error that may happen), mailing statistics emails may be sent in loop. As we
do not think timing is so important, we now use the email queue to send
statistics emails.
Task-2686586 (Repair mailing statistics)
X-original-commit: f78ac45c2eafc3cf6b213e1f1608e76e243bd8d2
Part-of: odoo/odoo#79877
Currently if someone replies to a mass mailing email, then performs a click on
tracked links, final trace status is set to opened. Indeed both reply and
click set the trace as opened, as replying or clicking imply opening the
mail.
Update is the following
* user replies -> set status to open, then set status to reply, and update
open_datetime and reply_datetime;
* user clicks -> set status to open, then update click_datetime;
In the end the trace is left as opened while it is replied, with a click
datetime attached to the trace. To avoid unnecessary status update, a trace
is set to opened only if it is not already opened or replied. Other statuses
should not override themselves.
Task-2692316
X-original-commit: ce88d364369c8b58256e8d93b7cb506a2c262a34
Part-of: odoo/odoo#79877
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
When writing on more than one record (e.g. via
_process_mass_mailing_queue cron)
X-original-commit: b18614bf99df47de77650f431e2062b8d2eacd06
Part-of: odoo/odoo#78259
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
closesodoo/odoo#74113
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Jinja as a templating engine was problematic in differents respect:
- introduce external dependency to Odoo (less controll)
- add another templating mechanism in the stack
- specific feature in qweb cannot be reused
- difficulty in rendering easily editable templates
- more knowledge required with no betterment
By replacing jinja with qweb we can now build tools to edit a qweb
that will work with the previously jinja encoded document
(essentially `mail.template` records).
There is a catch however. Some email fields (eg. email_to) used jinja
syntax for rendering dynamic variables (ie. ${object.something} and
${object.something_that_should_not_be_escaped | safe}).
We still want user to use dynamic variables for some char fields (eg.
subject, from, to, ...). We made a new rendering engine called
"inline_template" that will render an expression enclosed by `{{` and
`}}`.
To be able to edit the templates from the backend interface, a
plugin to the Odoo editor has been made for seamlessly edit the
document.
This qweb plugin includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
(for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif, and t-else)
in order to see only one at once
- a floating select input to switch visibility of a particular logical
branching
Task-27033
X-original-commit: odoo/odoo@68182baff4
Part-of: odoo/odoo#77377
Currently we are getting all records of mailing.mailing instead of
getting only records with mailing_type=mail. This bug was produced
by commit[1].
Now we have computed only that records which have mailing_type = mail,
So we can get perfect count in mail stats button in campaign.
commit[1] -> odoo/odoo@3f6625ef13
Task-2417993
closesodoo/odoo#76622
X-original-commit: 4f2924c5fcab672882ca78a9e6eb38b363d2d1b3
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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>
This commit fixes a behavior when we send a batch of mailings
with no recipients.
When there is no recipients passed down, each mailing should
use it's own recipients and not the recipients of the first mailing.
closesodoo/odoo#75652
X-original-commit: 88d74fde5ce1ec70a88679429fda02180ce7fa81
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
PURPOSE
Improve user experience by correctly contextualizing trace display when coming
from a mailing.
SPECIFICATIONS
Display relevant fields, hide other one (sms number when coming from a mail
mailing, email when coming from an sms marketing). Set some technical fields
as optional (message ID, status update). Use badge for status. Allow to open
recipient document directly from list view.
Improve wording (mail -> email). Reorder form view to try to have less noise
by hiding void fields and replacing the status bar (not clickable and any not
a business flow) by a classic field.
LINKS
Task ID-2377974
Community PR odoo/odoo#61467
Enterprise PR odoo/enterprise#14633
Purpose of this commit is to keep blacklist and optout lists computation
at mailing level and correctly call it in composer. This allow to have
a clearer and more readable code as well as more robust.
Currently it is done by adding this information in context before invoking
the mail composer. It is now correctly done in composer: if a mailing is
linked to the composer, it calls both blacklist and optout lists methods.
LINKS
Task ID-2377974
Community PR odoo/odoo#61467
PURPOSE
Clean mailing code and ease understanding by replacing some old selection
keys by new ones better highlighting their use and aligned with other keys
used notably in mass mailing or SMS.
SPECIFICATIONS
Use shorted and mail-related keys. Indeed we already have sms_ and sn_ for
sms and snailmail related failure type. We therefore update failure_type for
mail as
* "UNKNOWN" -> "unknown", a generic unknown of uncategorized error;
* "RECIPIENT" -> "mail_email_missing", indicates email address is
invalid;
* "SMTP" -> "mail_smtp", connection issue;
"BOUNCE" key is never used and removed. Actually we use a bounce state for
bounced emails / traces so this key has no use.
LINKS
Task ID-2377974
Community PR odoo/odoo#61467
Enterprise PR odoo/enterprise#14633
Upgrade PR odoo/upgrade#1907
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
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
In this commit some reorganization is performed within mail compose message
code. Purpose is to reorder a bit methods by main usage: onchange, CRUD,
actions, values generation with rendering and template management.
Some renaming is performed on action methods, notably send_mail that has some
impact on sub-addons. Finally we also set onchange and sub-onchange methods
private.
No functional change should be implied by this commit.
LINKS
Task ID-2377974
Community PR odoo/odoo#61467
Enterprise PR odoo/enterprise#14633
Purpose
=======
Now that we try to not spoof the FROM SMTP headers, we want to improve
the default mail FROM used in mailing. By default, it's the email of
the current user, but if no mail server is configured for it, we will
use the notification email instead and encapsulate the email of the
user in it.
e.g.:
Original: "Admin" < admin@odoo.com >
Final: "Admin (admin@odoo.com)" < notifications@odoo.com >
Show a warning message if the configured mail server can not be used
for the email from.
Task-2367946
odoo/odoo#61853odoo/upgrade#1903
PURPOSE
This commit aims to apply some cosmetic changes on the mass mailing
tree view to improve its usability.
SPECS
- New precedence order for the mass mailing views: With the kanban view,
mailings tend to pile up. When there are a lot of mailings, it can become
tricky to find a specific mailing given that the names of the mailing are
often generic and redondant (e.g. "Don't Miss Out", "Special Offer", ...)
For this reason, we will encourage people to use the list view by giving
the list view a higher precedence over the kanban view.
- Add progress bars for the delivered rate and the open rate (in the tree view).
- New column order for the tree view.
- Remove the unused and invisible field 'mailing_type' from the tree view.
- Set the fields 'mailing_model_id' and 'campaign_id' as optional.
- Minor decorator update.
LINKS
Task id: 2588188
closesodoo/odoo#73276
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
To reproduce the error:
1. Open Email marketing
2. Go to the calendar view
3. Click on a cell
Explanation:
The function 'default_get' defines an argument named 'field' that conflicts
with the 'field' variable imported from the default 'odoo' package. When
two identifiers conflict, Python will use the variable defined in the closest
enclosing scope.
When the 'default_get' function accesses the 'Datetime' attribute of 'field',
the function will raise an exception as the identifier 'field' will refer to
the argument of the function and the property 'Datetime' will not defined on
that variable.
To solve the issue, we will rename the argument of the function 'default_get'
to 'fields_list' so that it will no longer conflict with the imported variable
'fields'.
Links:
Task id: 2581357
closesodoo/odoo#72857
X-original-commit: a9f6f708d40d0ecafb4a903eb9ff810a6c959416
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Traces are always linked to documents as mailings are sent on
documents. Those fields should be required to ensure database
coherency.
Task ID-2525759
closesodoo/odoo#71786
Related: odoo/upgrade#2513
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
As the mailing.list model has his own custom merge method, this model should
not be candidate to activate the generic merge method comming from data_merge
module.
This change is done here to avoid creating a bridge module in enterprise
only to add this flag. We can consider that the flag is linked to the custom
merge method itself. If a model has a custom merge method, it should be marked
as 'having a custom merge method'.
Task ID: 2459416
Linked ENT PR: odoo/enterprise#17553
Currently ``mail.render.mixin`` offers rendering tools, some of them being
based on a ``model`` field. It allows to know which model to use to fetch
records on which we perform rendering. However this field is not defined at
mixin level but in inheriting models without being clearly implemented that
way (see ``mail.template`` or ``sms.template`` models).
In order to clean this mixin it is now defined at mixin level, using a
not stored computed field allowing to define how to find this model. Sub
models are updated accordingly.
Other cleaning is done in the render mixin
* rename ``_render_template_qweb`` to ``_render_template_qweb_view``
to indicate it works on views, not on raw qweb templates;
* extract some common available variables for rendering in a method then
called / upated for jinja and qweb views;
* correctly set same rendering context for jinja and qweb views rendering;
* allow to propagate an additional context from _render_field to sub
rendering methods;
* allow to propagate options through rendering methods (notably for escaping
or safe attributes in jinja);
* allow to specify engine used to render lang;
* clean or update some docstrings;
Some tests are also added, as render mixin lacks some more detailed test to
ensure various use cases will be correctly migrated to other engines like
QWeb.
Task ID-2534550 (Template usage improvement)
Task ID-2477164 (Composer mixin)
Prepares Task ID-27033 (QWeb in templates)
COM PR odoo/odoo#70889
ENT PR odoo/enterprise#18352
Co-Authored-By: Stéphane Debauche <std@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
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
There is a missing depends on subscription_ids fields, meaning it is not
correctly refreshed when contacts are updated. When dealing with m2m using
the o2m model as relational table, depends have to be specified on field
itself to allow recomputing the fields.
Task ID-2431217
COM PR odoo/odoo#71140
X-Original-Commit odoo/odoo@11ffeddf23
X-original-commit: 37bad522bcaf9a6db2f676286fb9ceb1a188dcab
Having those fields as translatable lead people to think those will be
translated into recipient's language. This is incorrect as translations
in Odoo are based on current user, not about any recipient who would
see the field value.
In this commit we therefore remove translation capabilities for
subject and preview. Indeed mailings currently offer no multi languages
support. Instead people should create separate mailings targetting
some specific recipients, based on lang or country for example.
Task ID-2535807
closesodoo/odoo#71093
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Make the email body take the entire space to avoid having some wasted space,
this will also make the user have more focus when designing an email.
Revamp the settings notebook page in order to give more clarity to the user,
and move some fields from the main form have been moved to this section to
have more space in the bottom for the email body.
In the mailing form, when the mailing is sent or is being sent, set fields
which are no longer useful for the user to change to readonly mode.
Add a wizard that enables the user to schedule a mailing, the schedule field is
still kept in the form for the user to be able to change the date when the
mailing is in the queue (if they want to send it sooner).
Display an action helper-style content when the email is empty, because,
currently, the user is left with a big white screen when the email has no
content which is not desirable.
Update the html_empty function to take into account style attributes to better
match the editor's void content.
Hide A/B testing fields from SMS mailing form view as these are not supported
for SMS marketing.
Task-2469409
closesodoo/odoo#68882
Ent-pr: https://github.com/odoo/odoo/pull/68882
Related: odoo/enterprise#18391
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Let's make use of Many2oneReference as a better tool to link the model and the id.
closesodoo/odoo#70518
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
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
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#67213closesodoo/odoo#69820
X-original-commit: 71430334bffa4b5da3f9374c734e6231cb42a7c7
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
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
closesodoo/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>
Sometimes it crashed when the domain used for the mailing cron
returned more than one record
source commit: 1738f9c8f7closesodoo/odoo#67556
X-original-commit: cb97f7c64a1fa575799a7832cb52e433436581e0
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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.
closesodoo/odoo#65124
Task: 2416741
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
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
* 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
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.
closesodoo/odoo#67094
Task-id: 2431344
X-original-commit: b92ebf3a47b7b1263669ac020ac8c213027400ea
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
closesodoo/odoo#67111
X-original-commit: ca1f2e9d1285a02ebaf2502eaeb3d38feea6c477
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
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
closesodoo/odoo#65277
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
- 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/16105closesodoo/odoo#65469
Related: odoo/enterprise#16105
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
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
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
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#1990closesodoo/odoo#53221
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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>