Commit Graph
6593 Commits
Author SHA1 Message Date
Olivier Dony 84af9382e2 [IMP] mail: avoid costly queries on messages
The combined domain for moderated messages used to trigger a complex
database query with two OR conditions on the mail_message table.
Unfortunately PostgreSQL seems to be unable to optimize this with
indexes, or to detect that one of the conditions is void (included `AND
FALSE`). On large mail_message tables, this significantly slows down
calls to message_fetch, e.g. 6s instead of ~70ms, while returning the
same results.

As a workaround, move the logic for generating the moderation domain to
the server side, where it can be:
 - optimized out when the user is not a moderator
 - split into 2 distinct DB queries in order to avoid the pathological
   case

After this change, calls to message_fetch with and without messages
to moderate execute in respectively ~50ms and ~150ms, instead of 6s, in
a test database with 25 million messages.

The modified message_fetch signature is backwards-compatible.

+ modified mock server used for the tests, which unfortunately
duplicates most of the business logic.
2018-09-20 12:41:03 +02:00
Olivier Dony ec4f7bc215 [FIX] mail: block negative search for need_moderation
Other operators can only cause nonsensical results, while causing
useless slow queries. This is only really meant as a shortcut for
getting messages to moderate.
2018-09-19 23:50:20 +02:00
XavierDo 97dbdc418d [FIX] mail: keep update of subtypes in dropdown
Since saas-11.4 the subtype dropdown don't keep changes of subtype.

Before saas-11.4 the update was relying on the fact that the follower id
changes on each subtype edition. This is no longer the case.
The test is addapted to remove the hack simulating this behaviour.

The read_followers route is not called if no there is no changes
in the follower ids
https://github.com/odoo/odoo/blob/905e01921f3c3ef43ace6fc537d1d8c0d280002c/addons/mail/static/src/js/followers.js#L195
Leading to the follower list not being update

Note that the subtype update in dropdown was working fine after adding a
new follower: the read_followers will return a None as suptype when called
for a list of partner not containing the current user. Since the subtypes
was falsy, the render was not rendering the dropdown again, keeping
the value of the checkboxes. We can still create some inconsistency by
editing the subtype from the follower list. To avoid that a check is made
when updating subtypes after calling read_followers.

The chosen solution here is to keep the update on subtypes in memory.
This will avoid a call on read_followers to fetch information that we
already know, using the assumption that the operation was successfull
whish should be the case when a user edit subtypes on a record
he has access to.

Others solutions:
-force the call to read_followers with the current user, maybe by removing
it from this.follower after editing subtypes.
-call read_subscription_data explicitely

Obviously follower.js should be refactored to fix this a better way.

Task: #1886982
PR: #27093
2018-09-19 14:10:19 +02:00
Odoo Translation Bot 7fdbc66861 [I18N] Update translation terms from Transifex 2018-09-16 07:08:38 +02:00
Christophe Simonis 6c103589c1 [MERGE] forward port branch saas-11.3 up to ea0b3d600d 2018-09-14 14:56:51 +02:00
Christophe Simonis ea0b3d600d [FIX] mail: declare services used in forward-ported test
Only broke test with enterprise overwrite.
2018-09-14 14:05:24 +02:00
Christophe Simonis f3fa5a5ef7 [MERGE] forward port branch saas-11.3 up to 1e0a92c996 2018-09-13 19:30:33 +02:00
Christophe Simonis 5e4fdaf731 [FIX] mail: correct SyntaxError
Oversight of previous forward-port
2018-09-12 20:04:41 +02:00
Christophe Simonis b1999a0e87 [MERGE] forward port branch 11.0 up to db0e84f3e3 2018-09-12 19:37:17 +02:00
Raphael Collet cd6e9ab4fb [FIX] mail: _compute_need_moderation() 2018-09-12 15:15:10 +02:00
Nicolas Lempereur 8e77632e58 [FIX] *mail_thread: don't modify modified help
The 'help' of window action is often fiddled with, adding thing before,
after or arround it.

For example in CRM leads, we add at the beginning "Click to add a new
opportunity" with an arrow towards the button, and after if there is a
mail alias: "All email incoming to * will automatically create new...".

But for crm.lead, hr.expense, sale.order this would not take into
account that the fiddled "help" can be edited, so if we edit 2 times
help in studio or backend action editing, we would get:

  Click to add a new opportunity
  Click to add a new opportunity
  Click to add a new opportunity
  [Original help content]
  All email incoming to * will automatically create new...
  All email incoming to * will automatically create new...
  All email incoming to * will automatically create new...

And see several "arrows" towards the button (in enterprise the
additional ones are on same color background).

With this commit we do what is done in "mail.thread" by default which is
not fiddling with the `help` if has been fiddled before (if it contains
"oe_view_nocontent_create" class).

note: this is the 11.0 version of #26912

opw-1877663
closes #26911
2018-09-12 13:18:35 +02:00
Christophe Simonis babfca1cf4 [MERGE] forward port branch 11.0 up to 5a1f874602 2018-09-11 14:57:25 +02:00
Lucas Perais (lpe) 816f386161 [FIX] mail: action send mail no default_type
Have a send email automated action on invoices upon validation (write)

Go onto the credit notes, create one, and validate

Before this commit, at the creation of the attachment (the invoice pdf), there was a traceback
because default_type was in the context containing 'out_refund'
And that attachments also have a field 'type'
So the default_get of the latter got a value that wasn't correct for its field

After this commit, we clean the context of the default_type context key since it
is irrelevant beyond that point

OPW 1868638

closes #26621
2018-09-11 09:35:44 +02:00
Christophe Simonis 826cd9b3d3 [MERGE] forward port branch 11.0 up to c3ea0a7811 2018-09-10 19:21:57 +02:00
Lucas Perais (lpe) bb12890977 [FIX] mail: activity don't loose text of feedback popover
On an activity, click Mark as done, the popover pops over
Now write some text in it, but click somewhere else, like to copy/paste something
The popover looses focus, and your text disappears

After this commit, we store the value of the popover when hiding it,
then, when when showing back the popover, the value is reinjected

OPW 1873999
closes #26315
2018-09-10 11:24:42 +02:00
Odoo Translation Bot 5e4d4c305f [I18N] Update translation terms from Transifex 2018-09-09 07:07:47 +02:00
Odoo Translation Bot 01d853e295 [I18N] Update translation terms from Transifex 2018-09-09 04:11:03 +02:00
Christophe Simonis 49c3264ce0 [MERGE] forward port branch saas-11.3 up to 4850fb0838 2018-09-07 14:43:48 +02:00
XavierDo 62928bb81a [FIX] mail: make red envelope visible when necessary
We need to know if a notification is in failure by
displaying the red envelope in even if all partner are inactive.

This commit also fix the filter in order to display notification
of all active partners if there is an exception.
2018-09-06 10:34:14 +02:00
XavierDo 554414b90f [FIX] mail: fix use of resend wizard when user are in failure
The user right to edit partners was handled in order to set email fields as readonly
If a user is in the failed recipient, we need to check that the urrent user also has
right to write on users
2018-09-06 10:33:59 +02:00
XavierDo d0e957109f [FIX] mail: allow resend on bounce
Only o_thread_message_email_exception red envelope was clickable.
We should be able to resend bounce too.
2018-09-06 10:33:52 +02:00
Christophe Simonis f19e6ce561 [MERGE] forward port branch 11.0 up to 213759b03e 2018-09-05 18:52:27 +02:00
Toufik Benjaa 7700bd172f [FIX] mail: Avoid using default value for track fields logging
- When a tracked field is modified, a mail.message is created.
  When create is called its tries to fill missing values with "default
values".
  It first tries to find the default values in the context, which may
occurs.
  For example, modifying a tracked field on a subtask will add a key
"default_parent_id" in the context, which is the parent_id of the project.task.
  Create will try to use "default_parent_id" for the mail.message
parent_id field, which make the SQL Request invalid.
2018-09-05 18:36:54 +02:00
XavierDo 1120bffb66 [FIX] mail: only display errors linked to message of current user
The search on message_has_error (used when clicking on a failure notification)
was displaying the failure of all users making it difficult to find your
own mail failure. This fix solve the problem by adding a criteria on message
author_id.
2018-09-05 16:52:44 +02:00
Martin Trigaux 9aa750bffc [FIX] mail: add missing emoji 2018-09-05 11:57:06 +02:00
Olivier Dony 6d979a0646 [IMP] mail: simplify failure_type values
The default value for failure_type was the 'NONE', instead of being
simply False/NULL. This represents a significant waste of tablespace
with no added value.
Switching to true NULL value for representing the absence of error
also save some precious time during database upgrades on databases with
large numbers of emails.

While fixing the values for failure_type, also fixed a few typos and
untranslated strings.

See original feature at 133eeb1bbf
2018-09-04 18:50:18 +02:00
Thibault Delavallée 32832dc6df [FIX] mail: correctly add moderators to channel members 2018-09-04 16:39:07 +02:00
Goffin Simon 15c81d74a3 [FIX] mail: Timezone issue when creating a call
Steps to reproduce the bug:
- Let's consider the today date = D
- Set on your preference a timezone which has another today date = D+1
- Go to CRM > Configuration > Activiy types > Call
- Set 0 as # Days
- Go to CRM > Pipeline > Click on a lead
- Schedule an activity of type = Call

Bug:

The Due Date = D instead of D+1

opw:1877217
2018-09-04 09:20:24 +02:00
Toufik Benjaa b789092ead [FIX] mail: Access right issues while accessing mail.message
- The SQL request to retrieve mail.message information to compute access
  rights was incorrect. Which triggered false access right issues.
2018-09-03 13:16:11 +02:00
Toufik Benjaa 82195c587c [FIX] mail: fetch notifications for active partners only
- When trying to fetch notifications for failed mail delivery, the code
  doesn't check if the partner is active or not.

  If the partner is archived, then it tries to access its information on
  a dict that doesn't contains them and crashes.
2018-09-03 10:08:58 +02:00
Odoo Translation Bot a67c48b0b3 [I18N] Update translation terms from Transifex 2018-09-02 07:07:27 +02:00
Odoo Translation Bot d40145a42e [I18N] Update translation terms from Transifex 2018-09-02 04:09:57 +02:00
Lucas Perais (lpe) 4ba87e073d [FIX] mail: right user_ids when calling /mail/follow
On a SO, write a note to a user
The mail the user receives contains a follow button
Click on it

Before this commit, the link did not add the user as follower of the SO
this was because the wrong uid was passed to the function

After this commit, user is added as follower

OPW 1869849
closes #26634
2018-08-29 15:58:10 +02:00
Odoo Translation Bot f0ccdcb209 [I18N] Update translation terms from Transifex 2018-08-26 07:07:10 +02:00
Odoo Translation Bot 7526b64e8a [I18N] Update translation terms from Transifex 2018-08-26 04:10:40 +02:00
Christophe Simonis 9f99eb9cb0 [MERGE] forward port branch saas-11.3 up to 3be46428cc 2018-08-24 22:12:20 +02:00
Christophe Simonis 4a6c3da238 [MERGE] forward port branch 11.0 up to 33981790de 2018-08-24 18:22:27 +02:00
Christophe Simonis 33981790de [MERGE] forward port branch saas-15 up to 4703d649dc 2018-08-24 18:03:00 +02:00
Christophe Simonis 4703d649dc [MERGE] forward port branch saas-14 up to aeb3391a2d 2018-08-24 14:07:40 +02:00
Christophe Simonis aeb3391a2d [MERGE] forward port branch 10.0 up to b50958c40f 2018-08-24 11:42:33 +02:00
Nicolas Lempereur 01b1830219 [FIX] mail: access token in received cid images
Following 50ab18176 an access token is added in the URL, but there may
not be an existing access token. If so this commit generate one.

opw-1877347
closes #26526
2018-08-23 15:38:34 +02:00
Christophe Simonis b844e9af8b [MERGE] forward port branch 9.0 up to 81f975d3f4 2018-08-23 10:54:52 +02:00
Toufik Benjaa 81f975d3f4 [FIX] mail: channel_get return wrong channel when duplicate partners
- In some cases (merge of partners, etc ...) there might be mail.channel
  that have two mail.channel.partner with the same res.partner.
  When you try to open a discuss window with a partner for which you
  have no existing mail.channel.
  The channel opened is the one where your partner is duplicated.
  This is due to the fact that the SQL request to find the mail.channel
  doesn't take in account that a mail.channel may have twice the same
  partner.

  To fix this issue, we try to exactly match the partners we search.
2018-08-22 17:59:22 +02:00
Christophe Simonis ef6b574eda [MERGE] forward port branch saas-11.3 up to 6cc7d3f945 2018-08-21 18:48:13 +02:00
Toufik Benjaa a05ae78abd [FIX] mail & project: Display access button on mail notifications
This commit fixes two issues:

	- If a partner has multiple users and if any of these users is a
          share user, then the access button on mail notifications is not displayed.

	- If a project.task is either assigned or has its stage folded
	  the access button may not be displayed for certain users.
	  The users affected by this bug are the one who have their user's
	  partner is linked to multiple users with at least one flagged as a share user.
2018-08-21 11:58:50 +02:00
Odoo Translation Bot 132d9ad18b [I18N] Update translation terms from Transifex 2018-08-19 07:14:31 +02:00
Odoo Translation Bot a7dd10a838 [I18N] Update translation terms from Transifex 2018-08-19 04:12:48 +02:00
Odoo Translation Bot afffcc971f [I18N] Update translation terms from Transifex 2018-08-19 00:28:25 +02:00
Martin Trigaux 86a25a68e7 [I18N] resynchronise all translations with .pot
Regenerate all child translations based on the .pot
Remove the terms that are either equal to the parent, either equal to the
source term.
Remove empty translation files
2018-08-17 01:29:55 +12:00
Christophe Simonis dabe59df9c [MERGE] forward port branch saas-11.3 up to 27d8daf8a7 2018-08-14 19:43:32 +02:00