Commit Graph
509 Commits
Author SHA1 Message Date
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
Thibault Delavallée aaefa35e29 [MOV] link_tracker, various: more link shortening tools to mail.render.mixin
PURPOSE

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

SPECIFICATIONS

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

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

LINKS

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:25:04 +00:00
Thibault Delavallée 3d86a29aeb [MOV] mail, various: move replace_local_links to render mixin
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
2020-03-24 10:24:44 +00:00
Thibault Delavallée 822f468059 [MOV] mail: move rendering code to mail render mixin
We also have to update code calling directly the rendering itself. Indeed
some code bits does some rendering directly on jinja-enabled input and not
through templates. Those calls have to be updated accordingly.

LINKS

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:24:19 +00:00
Thibault Delavallée a03f6483d6 [REF] mail: clean code about rendering in mail_template
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
2020-03-24 10:24:18 +00:00
Thibault Delavallée fd9b259026 [REF] mail: merge blacklist and address mixins
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

closes odoo/odoo#48115

Related: odoo/upgrade#967
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-03-20 14:58:44 +00:00
jvm-odoo 1a7e0fb01b [FIX] mass_mailing: remove inactive lists from mass mailing
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

closes odoo/odoo#47094

X-original-commit: 4346f1da7a26a11f49c8e76f6ed8d6d6078a1d8a
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-03-06 14:27:02 +00:00
Jérémy Hennecart fc8e4465e1 [IMP] mass_mailing: improve ui backend
- 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
2020-02-27 09:59:23 +00:00
Aurélien Warnon a6d9decdd5 [REF] mass_mailing: clean unused utm statistic fields
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

closes odoo/odoo#38246

Related: odoo/upgrade#823
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-02-24 13:56:00 +00:00
oco-odoo 5b74306a17 [REF] mass_mailing, project: remove deprecated '_period_number' attribute
This parameter declared on mailing and project classes is not used anymore.
Let us remove it to clean model definitions.

closes odoo/odoo#39401

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

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

closes odoo/odoo#43831

Related: odoo/enterprise#7894
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-01-28 13:58:05 +00:00
Debauche Stéphane 1ec887b773 [FIX] mass_mailing: correctly support mailing domain from default context value
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
2020-01-28 09:14:14 +00:00
Tiffany Chang (tic) abaae1e463 [IMP] mass_mailing_(sms): split systray activities
Due to 'mass_mailing_sms' inheriting mailing.mailing from
'mass_mailing', activities for these two modules would show up as one
"Mass Mailing" line in the systray. This commit adds additional logic
to remove this "Mass Mailing" line and replace it with 2 lines: "Email
Marketing" and "SMS Marketing" with their appropriately matching module
icon. For consistency, when only the 'mass_mailing' module is installed,
it will still display "Email Marketing".

Task: 2169498
2020-01-21 12:37:58 +00:00
Nicolas Lempereur 56fb4a565f [FIX] mass_mailing: set bounced mail as bounced
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 #43084

closes odoo/odoo#43091

X-original-commit: b0e0cee9f9623d972c4dee26d3536600dc95f276
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-01-09 18:30:27 +00:00
Thibault DelavalléeandAurélien Warnon 110decad00 [REF] mass_mailing(_sms): force domain reset when changing model / type
In this commit we rewrite the compute on mailing domain to simply reset it
once the mailing domain is changed. Indeed trying to keep a previous domain
based on try / except has no meaning from functional point of view. If model
changes then domain should change as it is a business record, not just a
technical domain to try to apply.

LINKS

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

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

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

SPECIFICATIONS

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

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

LINKS

Task ID 2088577
PR #41877
Enterprise PR odoo/enterprise#7278
2019-12-16 15:58:16 +00:00
Thibault Delavallée 69ccabb212 [FIX] mail: restrict access to mail.mail model
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
2019-11-29 13:35:14 +00:00
Thibault Delavallée 1838191eec [REF] mail, various: improve mail creation calls, notably author and email from default computation
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
2019-11-29 13:35:14 +00:00
ryv-odoo 4c6a625f65 [REM] mass_mailing: remove useless db param in url
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

closes odoo/odoo#40568

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-11-20 14:52:03 +00:00
laa 72aa049844 [IMP] mail, mass_mailing: add dynamic placeholder mixin and use it in mailing and templates
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>
2019-11-07 16:19:37 +00:00
Thibault Delavallée de0951eb91 [REF] mail: use create multi on mail.mail
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
2019-10-23 15:29:41 +00:00
Christophe Simonis d74b451805 [MERGE] forward port branch 13.0 up to f4105eb9c7 2019-10-09 02:08:17 +02:00