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
closesodoo/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>
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 #57310closesodoo/odoo#60262
X-original-commit: 5ccf5b51feaa348d775890e107fd30cd750699d8
Related: odoo/enterprise#14200
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
And other reported English mistakes in source string
Courtesy of Transifex translators
And remove leftover from gengo
closesodoo/odoo#59022
X-original-commit: 26efc84c5cac47a2cc83d7b084f8b71528fec6c7
Related: odoo/enterprise#13781
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Fix traceback when creating a new contact by checking the id list is not empty.
Task ID : 2302578
closesodoo/odoo#58681
X-original-commit: 31f2bb5e494965d31f5e49d47908fd4b5eb64077
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
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
closesodoo/odoo#56298
X-original-commit: d1ab37de0c4782b4f12b44f9858446b4c9c7dc08
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
closesodoo/odoo#55695
Related: odoo/upgrade#1584
Related: odoo/enterprise#12323
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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.*
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
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 `‌` (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
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
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).
closesodoo/odoo#55452
X-original-commit: 3e1633d5b3590ec5657b851c21cbae059944d964
Related: odoo/enterprise#12218
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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).
closesodoo/odoo#53683
Related: odoo/enterprise#11467
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
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.
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
closesodoo/odoo#49836
Related: odoo/upgrade#1094
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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>
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>
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
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>
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
closesodoo/odoo#48602
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
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
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
closesodoo/odoo#49139
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
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
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>
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
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
closesodoo/odoo#48531
X-original-commit: 63712e106dfae6ef99d93a0ba2ff4102ed430719
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
PURPOSE
Move links shortening tools on mail.render.mixin to have rendering and
post procesing tools available on that mixin.
LINKS
Task ID 1963529
Community PR odoo/odoo#32397
We also have to update code calling directly the rendering itself. Indeed
some code bits does some rendering directly on jinja-enabled input and not
through templates. Those calls have to be updated accordingly.
LINKS
Task ID 1963529
Community PR odoo/odoo#32397
PURPOSE
Clean and rename code about language management and template rendering in mail
template model.
SPECIFICATIONS
Clean method naming and try to make code easier to understand and call. Also
add and/or clean docstrings of rendering methods.
Notably
* ``_classify_per_lang``: for each lang-contextualized template, give the list
of record ids;
* ``_render_template``: now working only on a valid list of IDs instead of
allowing both int / list and having a return type depending on the input
type. It allows to simplify code and delegate some processing to callers;
Introduce new API method
* ``_render_lang``: for each record id return the lang matching it;
* ``_render_field``: render a field of mail.template, on given set of record
ids. Usage: template._render_field('body_html', records.ids). Language
computation is available for this method;
Remove the "multi mode" support of rendering that either returned a rendered
value, either a dict based on given ids. Now all methods always work in batch
and caller have to fetch the correct result if necessary.
LINKS
Task ID 1963529
Community PR odoo/odoo#32397
PURPOSE
Perform some code cleaning in mail module
SPECIFICATIONS
mail.address.mixin is used only for mail.thread.blacklist mixin. Let us
merge those two and simplify class organization.
LINKS
Task ID 2222033
closesodoo/odoo#48115
Related: odoo/upgrade#967
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Issue
- Install Mass Mailing
- Create 2 mailing list (x & y) with differents
contacts
- Create a mass mailing with x & y, send it
Ok, sent to everyome
- Archive mailing list y
- Duplicate the last mass mailing, send it
Not ok, sent to y contacts too
When a list is archived, I can't manually
remove it from the mass mailing (it disappears)
Cause
When archiving a list, it still remains in
contact_list_ids
Solution
Prevent archiving a mailing list if any mass mailing
using it exist with state != 'done'
Re-evaluate the domain field at copy
OPW-2202111
closesodoo/odoo#47094
X-original-commit: 4346f1da7a26a11f49c8e76f6ed8d6d6078a1d8a
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
- Replace the fa-clock icon on the kanban view for
the fa-calendar-check-o icon to be consistent with
others modules.
- When you wanted to create/edit a mail template using
the web_editor, when it was open in a modal, a part of
the body was behind the editor panel. Now the body is
correctly display when opened in a modal.
task-2198656
This commit cleans several unused computed utm statistics fields related to
mass_mailing along with their compute methods.
Upgrade PR odoo/upgrade#823
Task 2082816
closesodoo/odoo#38246
Related: odoo/upgrade#823
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This parameter declared on mailing and project classes is not used anymore.
Let us remove it to clean model definitions.
closesodoo/odoo#39401
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
When simply need to parse a domain, it is easier
Add .strip() on ir.ui.view as ast.literal_eval produces an syntax
error if the node starts with spaces (as done in the xpath of
hr_attendance.view_employee_form_inherit_hr_attendance)
closesodoo/odoo#43831
Related: odoo/enterprise#7894
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Currently mailing_domain is a computed editable stored field. Its mailing
domain is either computed based on current model (taking into account
blacklist, opt-out, ...), either manually crafted.
However current implementation does not support default values coming from
context as they are reset by the triggers of the computed field. This
commit fixes that behavior.
Tests are added because somehow we should find a way to stabilize mailing
domain computation.
Co-Authored-By: Stéphane Debauche <std@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
Task ID 2119333
PR #40949
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
Fix a mixup between `bounced_msg_id` that is sometimes tought as a list
of string or directly as a string.
Now `bounced_msg_id` is always a list or `False` if there is no bounce.
opw-2157793
closes#43084closesodoo/odoo#43091
X-original-commit: b0e0cee9f9623d972c4dee26d3536600dc95f276
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
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>
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
From now on mail.mail is considered as a technical model. Indeed people should
not really manually craft mails by hand. Instead various functional flows
should either send mails, either craft mails based on some user input.
We therefore make mail restricted to admin users. Flows creating mail.mail
are updated to use sudo, and ensure it was done in a context that makes
sense to delegate this power to the user.
Task ID 1853147
PR #32243
Purpose of this commit is to correctly compute author_id and email_from
in mail_message and mail_mail as they depends from each other. Moreover it
is a good idea in various flows to specify email and author when giving
creation values to avoid default computation that is not always guaranteed to
be accurate notably when involving super user.
Mail message creation could lead to desynchronized values between author
and email_from. This is improved with this commit by correctly inheriting
from default_get and computing both of them at the same time instead of having
two default values. Indeed they depend on each other.
Same thing is done for mail composer. Mail Thread offers a tool method to
find email_from / author_id based on having one of those values or current
user and it is called whenever necessary.
Some calls to mail template send_mail are also cleaned.
Task ID 1853147
PR #32243
Methods _get_unsubscribe_url and _get_tracking_url
create url with a db parameter (GET), but it isn't used
in the targeted controller. Then we removed it.
task-2087379
closesodoo/odoo#40568
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
PURPOSE
Upgrade the "mass_mailing" and "mass_mailing_sms" modules with a dynamic
placeholder generator as it already exists in "mail module" as depicted in
https://www.screencast.com/t/cnFA0gIY.
SPECIFICATIONS
As duplicated code already exists for that and that a third version of this
code has to be added, instead create a mixin for this dynamic placeholder
generator to avoid code duplication.
Thereby
* a mail.render mixin for the dynamic placeholder generator must be
created in mail;
* dynamic placeholder generator code present in mail.template.py must be
moved to that mixin and replaced by a simple inherit;
* use the mixin in
* mail templates: mail.template.py (mail module);
* mass mailings: mailing.py (mass_mailing module);
* sms templates: sms.template (mass_mailing_sms module);
In a near future, some code will be added in this mixin, notably the template
rendering that could be moved outside of mail.template core model and moved
in that rendering mixin.
LINKS
Task ID 2070612
PR #36722
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Purpose is to prepare future cleanups and speed improvements. In this commit
we use create multi on mail.mail, allowing to batch their creation when
necessary.
Task ID 1853147
PR #39272