Commit Graph
146522 Commits
Author SHA1 Message Date
Touati Djamel (otd) dc8948d79c [FIX] mrp_account: Update the AAL when changing the MO analytic account
Analytic Accounts can be defined in the MO and can be changed in any MO stage. So the analytic account line will also have to be updated to be linked to the new AA

opw-2674347

closes odoo/odoo#79955

X-original-commit: 65a18382c1712968148898998e3778b77f199dea
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2021-11-18 08:37:45 +00:00
Adrien Widart 65a2e46572 [FIX] stock: auto assign backorder
When a backorder is created, the quantities are not reserved. This is an
issue: the module should try to directly assign these quantities if the
reservation method of the associated operation type is "At Confirmation"

(Forward port of 723d4b35f9fa9c49249c1b4e9b8dc93e51c5d359)

OPW-2658469

closes odoo/odoo#79980

X-original-commit: ae19ae04192d21ad956af05e5739bde8c6bca746
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2021-11-18 07:53:36 +00:00
Florent de Labarre c5b72fa895 [FIX] sale: dont't show section/note in report
- Create sale order with section and note
- Go to Sale Analysis
--> Issue : you see count of section and note

closes odoo/odoo#79975

X-original-commit: 42920592028c6a66bab333b8a4a12b8305734dca
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-11-17 18:16:08 +00:00
Joseph Caburnay 231dc66f0f [FIX] point_of_sale: can't close session when negative split payment
To reproduce:
1. Create Bank payment method with Identify Customer = True
2. Make order, use the bank payment method in 1.
3. Refund the order, again, use the bank payment method in 1.
4. Try to close the session. Error.

This is because the account.payment object being creating has
negative amount. We fix this issue in this commit by explicitly
providing the destination account based on the partner, and
reverting the destination and outstanding accounts when the
payment amount is negative.

closes odoo/odoo#79966

X-original-commit: e6f1b3893ab33d3d3ddf73e31e4e2ad13f0f2681
Related: odoo/enterprise#22323
Signed-off-by: Masereel Pierre <pim@odoo.com>
2021-11-17 18:16:03 +00:00
Paul Morelle d271f6a2c2 [FIX] mail: fix performance issue on activities filter
Accessing `valid_docs.ids` for each activity to check was costly, and in
my example the whole loop took 125 seconds to execute.

By turning it into a set, the same loop takes 0.2 seconds to execute.

When re-constructing the list based on ids to keep the order, using a
set is also faster, and takes another 0.2 seconds instead of 13.6.

closes odoo/odoo#79969

X-original-commit: f994db760b679c8acdaf4245315f89c1d31a9e1c
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-17 17:26:05 +00:00
Paul Morelle 1d86447395 [FIX] mail: consider more than last 1000 activities
Because activities_to_check was assigned in each loop, the result was
only containing the last chunk of 1000 records, instead of the whole
result.

This commit fixes the issue by concatenating into the list instead of
just assigning it.

X-original-commit: c06c96655b88cc4df59b8cdd5f05a2f600255c49
Part-of: odoo/odoo#79969
2021-11-17 17:26:05 +00:00
Prakash Prajapati 5dcf2633b5 [FIX] product: fix the pricelist report traceback
Currently, if we print the pricelist report after refresh,
the traceback will occur. It has been fixed.

closes odoo/odoo#79968

Task-id: 2584806
X-original-commit: a4c2f01a8e94e7361b25862758c1a20abad6c7aa
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-11-17 17:25:59 +00:00
William Braeckman 66bdf462f5 [FIX] website_payment: fix traceback with specific input
When trying to donate on the website without being logged in, having
'name' in your name would trigger a traceback.

TaskId-2694024

closes odoo/odoo#79967

X-original-commit: 9f6af0187d31fa72c10780657afeed142ae297d3
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2021-11-17 17:25:55 +00:00
William BraeckmanandThibault Libioulle a2036c5dd7 [FIX] project: make better use of cache in dependency tracking
Minor changes to allow a better usage of the cache in dependency
tracking in order to reduce the query count.

See odoo/odoo#79931

TaskId-2693899

closes odoo/odoo#79956

X-original-commit: 52123efd0cbc77564d6dfc12856996b39666ad64
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Co-authored-by: Thibault Libioulle <tle@odoo.com>
2021-11-17 16:36:50 +00:00
William Braeckman a05eff87a1 [FIX] project: fix not checking for user_ids presence
Fixes an issue where new followers would always be checked upon updating
a task. Which could result in a lot more queries than necessary when
changes are cascading.

See odoo/odoo#79931

TaskId-2693899

X-original-commit: 09adeb7fe2b4345bd476058b2bf85ac1c08a1d1f
Part-of: odoo/odoo#79956
2021-11-17 16:36:50 +00:00
Thibault Delavallée 5a315a4364 [FIX] crm: ensure computation of PLS uses deterministic recordsets
closes odoo/odoo#79573

X-original-commit: 406270973250d05f1b9c63694b17391390f19c55
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-17 16:36:40 +00:00
Thibault Delavallée 6349319b0a [FIX] crm: fix randomness in assign tests
Seed is now fixed at beginning of each test to ensure random state is set
once for all and avoid random issues.

Task-2643740

X-original-commit: 85ebcaeaf909cd46743c20bf052360a65e60ea82
Part-of: odoo/odoo#79573
2021-11-17 16:36:39 +00:00
JF Aubert 047f2e556f Cherry pick of 20858c2a8805d9ec08edb98b090badf6c73fc342 failed
stdout:

stderr:
13:41:03.985365 git.c:344               trace: built-in: git cherry-pick 20858c2a8805d9ec08edb98b090badf6c73fc342
error: Cherry-picking is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: cherry-pick failed
----------
status:

closes odoo/odoo#79933

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2021-11-17 15:52:19 +00:00
Fabio Barbero 8467ad6518 [IMP] website_slide: change sample text
Purpose
=======
Make placeholder look more like sample text to avoid users confusing it
with actual text, add "Sample" ribbon to default course context to avoid
confusing some users.

Specifications
=============
Change default placeholder text, add css rule for placeholders in
website_slide to make the colour lighter and disappear on focus.

PR: odoo/odoo/pull/78845
Task-2674361

closes odoo/odoo#78845

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-17 15:52:15 +00:00
Joren Van Onder f7250550d0 [FIX] payment_authorize: don't error on long account names
The maximum length for nameOnAccount is 22 characters [1]. Entering a
longer name results in an unclear error message:

  Server Error
  We are not able to process your payment.
  E_WC_26: Please provide valid account holder name.

A maxlength="22" on the input was considered as well, but it would be
confusing for users and bank transactions with the first 22 characters
should be accepted.

opw-2688384

[1] https://developer.authorize.net/api/reference/features/acceptjs.html

closes odoo/odoo#79950

X-original-commit: 64b86f36264c2e655681c7b6bed69e89891107bf
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: jorenvo <jov@odoo.com>
2021-11-17 15:00:47 +00:00
luvi e756d9bc80 [FIX] web: anchor scroll crash
This commit fixes some issues happening when scrolling
with an anchor in Odoo. When the anchor was contained inside
of a notebook and no scrollable was found, a crash happens.
This fix improves the behavior in notebooks by showing the
correct pane before scrolling in form renderer. The scrollTo
util has been improved to remove duplicate lines and handle
multiple situations (0, one or more scrollables). Tests haven
been written to test such behaviors.

closes odoo/odoo#79935

X-original-commit: 4c2b807d1cb32e52a1b1fb5e6c80fb7e933940bc
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-17 13:51:54 +00:00
Patrick Hoste b5c87d86ca [IMP] website(_event): replace old event snippet by new dynamic one
PURPOSE

Replace the old event snippet which was a simple template with a
javascript file doing a rpc by a new one directly inherited by the
dynamic snippet.
The old snippet was displaying a list of the upcoming events based
on the user's localization. With this commit, it will be completely
replaced by the new snippet. The migration will convert the old
snippets to avoid versioning and keeping ugly code.
The new snippet allows the user to set multiples tags to display
only the wanted events on the website.

LINKS

Task-2489680
PR : odoo/odoo#68644

Related: odoo/upgrade#2406
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-17 13:05:53 +00:00
anhe-odoo 2a0ef92a1e [FIX] hr_expense: Make expense lines readonly on report
Expected Behaviour

When creating a journal entry for an expense, the journal
shouldn't be editable once it has been submitted for approval.

Observed Behaviour

Even when the journal entry has been validated by the manager,
the list of expenses is still editable, which can cause serious
trouble.

Reproducibility

This bug can be reproduced following these steps:
- Create a new expense
- Create the related journal entry (Create report)
- Submit the report for approval
- Validate the report
- Try to edit the expenses list

Problem Root Cause

As it can be seen in the PR, this issue came from the fact the
expense list isn't in read-only mode

Related Issue(s)

opw-2659436

closes odoo/odoo#79915

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-11-17 10:44:40 +00:00
alt-odoo b272cc0713 [FIX] website_sale: incorrect view called in borderless product view
We should call view portal_rating.rating_widget_stars_static instead of
portal_rating.rating_widget_stars_static_compressed.

closes odoo/odoo#79914

X-original-commit: 500ffd175869508893eaf10b06137ec7e044252a
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Alex Thuyls (alt) <alt@odoo.com>
2021-11-17 10:44:36 +00:00
awa-odoo 7c96f286db [IMP] base_import: add a test for the multi-mapping feature
This commit simply adds a small test for the import multi-mapping feature that
allows the end-user to map multiple columns of his import file to the same
field.

The values in the files are merged together, meaning concatenated for Char/Text
fields and accumulated for Many2many fields.

This commit is done as a preliminary step before fixing an issue related
to this feature in v15.

Task-2687407

closes odoo/odoo#79913

X-original-commit: ac832586e68e0873d69c0b10a3f8cc8b08ea506e
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-17 10:44:32 +00:00
std-odoo 8125165b00 [FIX] base_import: improve the import speed
Purpose
=======
Since v15, the time to import records in Odoo is much slower than in
v14. With a profiling, we know that the cause is `fields_get`. Indeed,
this method is heavy and call many times (#rows * #columns * ~#batches).

So the import time (in seconds) for ~1000 leads in CRM is;

Batch size | v14 | v15 | v15 fix
--------------------------------
2000       |   7 |  20 |      14
 200       |  11 |  48 |      15
  20       |  17 | 423 |      23

We can see that just by calling `._fields.get` instead of `fields_get`
we gain a lot of time. The reason for that is `fields_get` just read in
a python dictionary (which is really really fast), while `fields_get`
checks the access right, get the description of each fields (which
might make SQL queries to retrieve translation, etc).

Task-2687407

X-original-commit: 96e72a8b1657df00d5ed7ca6db7bd99e352d7096
Part-of: odoo/odoo#79913
2021-11-17 10:44:32 +00:00
Florian Damhaut fb6525f82d [FIX] microsoft_calendar : Only sync-write on existing element
In case of m event being removed by a change in recurrence further change is then only applied on the existing events and not all past events

closes odoo/odoo#79889

X-original-commit: 067d911b9bb105d8d86dd6bcf85181dd3cbadd8f
Signed-off-by: Arnaud Joset <arj@odoo.com>
2021-11-17 09:11:55 +00:00
alt-odoo 404ec3d44d [FIX] l10n_fr_fec: correct translation of journal name in FEC export
Before this commit, when exporting the FEC report, we were using the account journal
name in the initial language set. As it could be confusing for the French administration
to see names in a foreign language, we should use the user language instead to allow the
export of FEC report in French even if another default language was used.

closes odoo/odoo#79908

X-original-commit: 8ba4b76017a92c63e369877f30583485bedbd57a
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Alex Thuyls (alt) <alt@odoo.com>
2021-11-17 08:26:28 +00:00
Thibault Delavallée 0afbba8b5b [FIX] calendar: fix recipient of "event update" template
This template runs on calendar event records. It can therefore not really
use 'email' as field to compute a To. Let us void this field as it is used
mainly for a backend action that sets recipients.

Task-2657930 (Email templates fixup)

closes odoo/odoo#79895

X-original-commit: 5b3ad80f427fc2ac0e91622a94f0f63b3d2bf721
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-17 08:26:25 +00:00
Thibault Delavallée 2e5c7fda07 [FIX] website_crm_partner_assign: fix template using unknown variable
Jinja was tolerant to missing variables, QWeb not at all. Let us fix templates
that use outdated or invalid variables.

Task-2657930 (Email templates fixup)

X-original-commit: 1c179d58bf2d4e4c3c9b05d08475966d75754cc6
Part-of: odoo/odoo#79895
2021-11-17 08:26:24 +00:00
Adrien Widart 2a19948833 [FIX] mrp: configure in and out moves of draft MO
In multi steps configurations, the additional products of a MO could be
missing in the associated picking

To reproduce the issue:
(Use demo data)
1. In Settings, enable "Multi-Step Routes"
2. Update the current warehouse:
    - Manufacture: 2 steps
3. Create a MO for product "Table Top"
4. Edit the MO:
    - Add 1 x Screw in the components
5. Confirm the MO
6. Open the generated Picking

Error: The operations only contains one line for "Wood Panel". There
should be a second line for the "Screw"

When adding the new component, a new stock move is created but the
latter does not have any `group_id` defined. This is the reason why the
generated picking does not include this stock move.

OPW-2671995

closes odoo/odoo#79894

X-original-commit: 720f29fc6b7626ae734187242870a27065441ac2
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2021-11-17 08:26:19 +00:00
Khalid El Haji 3249e96a85 [FIX] hr_presence: Import missing cron in manifest file
This PR addresses issue #68761. The issue describes a bug
that results in a field not being automatically updated.

closes odoo/odoo#79875

X-original-commit: 9d65b89c14d9c7e343f9f4d5322ab93dc44cb4f8
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-11-17 07:39:41 +00:00
Alexandre Kühn 9dbeb68515 [FIX] mail: send button on mail channel show 'send'
closes odoo/odoo#79898

X-original-commit: 665f22de5ba6d73c28cc090a67d1179f8a6d99f0
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-11-16 22:53:20 +00:00
Michael (mcm) adc45af6de [FIX] web: set _super with Object.defineProperty
Before this commit, `_super` was set like this
`this._super = patchFn.bind(this);`
this triggered an update in owl reactivity.

To prevent the update, we use Object.defineProperty
`Object.defineProperty(this, "_super", { value: patchFn.bind(this) })`

closes odoo/odoo#79893

X-original-commit: a7a2b3022c88d1fbf9c242ad3668db35fc704c13
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-11-16 20:54:59 +00:00
Xavier BOL (xbo) b66b36db9c [FIX] project: fix access error when project user goes to project form
Before this commit, when a project user wants to see the project form
view, he has an access error because he does not have any access to
`project.collaborators`.

This commit adds `ir.model.access` to give read access to the project
user to `project.collaborators` model.

task-2692587

closes odoo/odoo#79899

X-original-commit: 012b014d0b95f10f7b512ac547b166e28bf32b65
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-11-16 20:05:16 +00:00
Tom De Caluwé 4fd5fd4a97 [FIX] web_editor, website: fix removal of last item inside active slides
A bug currently makes the carousel snippet collapse/disappear when its
active contents are removed. This happens because after the removal,
the carousel no longer has an active item.

The solution that was chosen was to not allow the removal of slides
unless using the dedicated option which is there for that. This solution
has the advantage to also allow users to create empty slides (using a
background image for example) by simply removing the columns inside.

Note: Newly created carousels will include the oe_unremovable class on
their slides. As such they will no longer depend on isEmptyAndRemovable
checking them for having a carousel-item class on the parent.

task-2506165

closes odoo/odoo#79892

X-original-commit: 0cf36a227e7b90fb64b1bc8024de813894d10d14
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-11-16 19:21:14 +00:00
Aaron Bohy 5d12f9ad96 [FIX] web: FieldDomain and DomainSelector in debug
Before this commit, the FieldDomain (using the DomainSelector)
didn't work well for manual edition of large domains (i.e. via the
"code editor"). For instance:
 - the editor was an input, so limitated to 1 line
 - the user friendly representation of the domain was redrawn each
   time the input was blured (we don't need this, and it flickers)
 - the count (search_count rpc) was recomputed at blur as well
   (could thus freeze the interface)

This commit fixes those issues as follows:
 - use a (automatically resizable) textarea instead of the input
 - do not format the content of the textarea when it is blured
 - do not update the user friendly part of the widget when the
   textarea is blured
 - do not recompute the count when the textarea is blured
 - add a button to allow to manually re-compute the count

For both debug and non-debug mode, we also no longer wait for the
count to be fetched to render the widget. We display a spinner
until the rpc is done.

Task 2619505

closes odoo/odoo#79886

X-original-commit: f4e3a754a1b66dd95fa3bfb50ec1fb8ac98864ed
Related: odoo/enterprise#22295
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-16 19:21:06 +00:00
Fabio Barbero 1a9b6422ff [IMP] digest: organise digest view
Purpose
=======

Give the user a more organized view of the digest KPIs in the backend and
improve global wording of digest sections and KPIs.

Specifications
==============

Reorganize order of KPIs in digest view. Fix some typos, move buttons in
list and form views.

Task-2582128

closes odoo/odoo#77507

Related: odoo/enterprise#21340
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-16 19:20:57 +00:00
Fabio Barbero 0324e12e7a [IMP] digest: fix spelling mistake
Fix spelling mistake in unsubscribe actions now that unsubscribe with token
has been merged with odoo/odoo@0ac3de1 .

Task-2582128

Part-of: odoo/odoo#77507
2021-11-16 19:20:57 +00:00
fde251330d [FIX] website: fix sharers of share snippet
The whatsapp sharer was fixed via [1]. This uses https for all sharers
and fix the pinterest one using the logo image with their new API.

[1]: https://github.com/odoo/odoo/commit/62575b75ff48a34df23f8742737226949f13c13c

closes odoo/odoo#79891

X-original-commit: 45497060d9185e7fddb3fc6fcfcbcb81040c8d8b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: jpr-odoo <jpr@openerp.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-11-16 18:39:20 +00:00
Odoo's Mergebot 2dfad96bce [FW][MERGE] digest, mass_mailing: fix usage of digests / statistics emails
Provide fixes related to digest and mass mailing statistics email after some
testing.

Fixes notably
  * use queue to send emails;
  * ease unsubscribe for non admin people using a route and a token to allow
    unsubscribe when being not logged;
  * improve tone down of digests when users have no activity, gradually going
    to quarterly digests instead of sticking on weekly;
  * fix statistics emails being broken due to some change in digest layout;
  * fix statistics emails author / from / to computation;
  * fix unsubscribe display and usage;
  * fix 'body' part of digest location;

Tests are added in digest and mass mailing to test a bit more in-depth those
features.

See sub commits for more details.

Task-2641394 (Digest emails sending improvement)
Task-2582128 (Digest onbarding and usage improvement)
Task-2686586 (Repair mailing statistics email)
Task-2688856 (Digest tone down improvement)
Task-2692316 (Mailing trace status overrides)

closes odoo/odoo#79877

Forward-port-of: odoo/odoo#77609
Forward-port-of: odoo/odoo#76591
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-16 17:58:41 +01:00
Thibault Delavallée 49085a1228 [FIX] digest: improve tone down
Currently digest sending is toned down when being sent if subscribed users
did not connect since more than 3 days. It allows to avoid spamming people
not being active or present anymore.

This is currently limited to daily digests that are set to weekly. However
it may continues to send digests each week until the digest is de-activated.

In this commit we tone down the digest from daily to quarterly depending
on users activity. It is still based on overall activity and not individual
users to avoid complex computation on heavy digests. This will be done in
further cleaning of digests.

Task-2688856 (Digest tone down improvement)

X-original-commit: f916354baec5bb69511069a829ab1648a5ebaccd
Part-of: odoo/odoo#79877
2021-11-16 16:58:39 +00:00
Fabio BarberoandThibault Delavallée 0ac3de16a9 [FIX] digest: ease unsubscribe
Purpose of this commit is to ease usage of unsubscribe button for periodic
digests for non-admins. Users land on page that says "You have unsubscribed
from ..." and not on digest form view anymore.

It is done using a public route with a token, allowing to unsubscribe even
when being not logged, for example when receiving digest emails that are
unwanted.

Task-2641394 (Digest emails sending improvement)
Task-2582128 (Digest onboarding and usage improvement)

X-original-commit: a4b98a82d04b398406958d82f466c09f6021a989
Part-of: odoo/odoo#79877
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2021-11-16 16:58:39 +00:00
Thibault Delavallée d27a6f7276 [FIX] digest, mass_mailing: correctly set body before odoo mentions
Body is used in statistics as an additional content to digest layout. However
it is strangely located after Odoo mentions (Send by, ...). Currently link
trackers statistics are therefore at the end of the email. They belong to
the "core" section of the emails.

Task-2686586 (Repair mailing statistics email)

X-original-commit: c9a503eec9a40809b6a88d56f84c06a66ad6dbeb
Part-of: odoo/odoo#79877
2021-11-16 16:58:39 +00:00
Thibault Delavallée db5315efad [FIX] digest, mass_mailing: fix crash about impossible 'unsubscribe'
Mailing statistics emails are build on digest layout. This layout contains a
reference to the digest unsubscribe mechanism, which obviously does not work
with mailing statistics emails as they currently have no opt-out mechanism.
This commit fixes that part of the template so that unsubscribe is displayed
only with digests.

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

X-original-commit: febe4506cf14ba9308d85538515eb61c4638b18d
Part-of: odoo/odoo#79877
2021-11-16 16:58:38 +00:00
Fabio Barbero 72637878a1 [FIX] digest: display unsubscribe even if no preferences to display
A wrongly-placed t-if prevented from displaying unsubscribe link (and the
"Sent by Odoo" sentence by the way, even if less annoying).

Task-2582128 (Digest onboarding and usage improvement)

X-original-commit: 669209b473d1e9581518033b74064fff7f677393
Part-of: odoo/odoo#79877
2021-11-16 16:58:38 +00:00
Thibault Delavallée 4ea673bfd8 [IMP] digest: add tests about tone down and unsubscribe
Purpose is to ensure behavior of digests and prepare future fixes and
improvements. Tone down and unsubscribe links are currently not tested.
This commit fixes that by adding relevant tests.

Task-2641394 (Digest emails sending improvement)
Task-2582128 (Digest onbarding and usage improvement)

X-original-commit: f340859a3508ebb369b7116f64c81d8f03774e61
Part-of: odoo/odoo#79877
2021-11-16 16:58:37 +00:00
Thibault Delavallée 9c25a65fa2 [FW][FIX] digest: use email queue to send digest emails (and improve tests)
When there is an issue updating digest state (concurrent access, or some other
error that may happen), digest emails may be sent in loop. Indeed they are
currently sent in the same transaction that the one that updates digest state.
This means that emails may be sent even if digest update fails.

As we do not think timing is so important, we now use the email queue to send
digest emails. That way email creation is rollbacked and they are not sent
if digest update fails for some reason.

Tests are updated to take into account we now create outgoing mail.mail. Some
tests are also added about mail values and subscription, and cleaned in a more
general way.

Task-2641394 (Digest emails sending improvement)
Task-2582128 (Digest onbarding and usage improvement)

X-original-commit: 96a14816cb48d9324482eec3de0ed3fccc0d7ecf
Part-of: odoo/odoo#79877
2021-11-16 16:58:37 +00:00
Thibault Delavallée 54780667a9 [FIX] digest: add missing depends on is_subscribed field
Currently subscribed field is not computed again if user_ids field value
changes on a digest. This has probably few consequences in current code
but better be sure this field is correctly updated in a given transaction.

Task-2641394 (Digest emails sending improvement)
Task-2582128 (Digest onboarding and usage improvement)

X-original-commit: 3a7c1348750d0977a663e50be05bad9f2679f8ff
Part-of: odoo/odoo#79877
2021-11-16 16:58:37 +00:00
Thibault Delavallée 73672cfc9f [FIX] mass_mailing: fix mail related values of statistics emails
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
2021-11-16 16:58:36 +00:00
Thibault Delavallée 8df08eac57 [FIX] mass_mailing: use queue to send statistics emails
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
2021-11-16 16:58:36 +00:00
Thibault Delavallée c59039b195 [FIX] mass_mailing: avoid clicks overriding reply trace state
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
2021-11-16 16:58:35 +00:00
Thibault Delavallée 581286346a [FIX] mass_mailing(_sms/_crm/_sale): fix digest layout change breaking mailing statistics
Recently some "de-t-rawify" [1] was done through Odoo. A change in digest
layout broke mailing statistics. Indeed mailing statistics are build on digest
main layout to re-use it. In mailing case a ``kpi_name`` value was missing when
rendering statistics columns, leading to a crash. This is now fixed in both
mailing and sms marketing.

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

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

[1] odoo/odoo@c56e8c9f5a

X-original-commit: c9905ceb3172d8e80e3aff4ae9bc925dcb6b6519
Part-of: odoo/odoo#79877
2021-11-16 16:58:35 +00:00
Thibault Delavallée dad888de50 [REF] test_mail_full: cleanup test data, use default one
Purpose of this commit is to have as less custom test data as possible. In
some sms tests we can re-use existing mailing, leading to more standard
tests and expected results.

We also improve ``gateway_sms_sent_click`` tool that now creates random IP
addresses allowing to have various clicks on a given tracker. Indeed as IP
is unique several clicks are currently set into the same click record, which
will now not be the case anymore.

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

X-original-commit: f76b154412a111067203979075fa65f198cc39f4
Part-of: odoo/odoo#79877
2021-11-16 16:58:35 +00:00
Thibault Delavallée 35ccabf051 [IMP] digest: add private methods to manage digest members
Purpose is to ease digest management and testing. Public methods still work
as before this commit, simply calling the private implementation. New private
methods allows to better manipulate subscribed users. Those will be used
notably as shortcuts in tests.

Task-2641394 (Digest emails sending improvement)
Task-2582128 (Digest onbarding and usage improvement)

X-original-commit: 3045c49f0e10bd50757fcbaa75f9aaad49a966ce
Part-of: odoo/odoo#79877
2021-11-16 16:58:34 +00:00