Commit Graph
9366 Commits
Author SHA1 Message Date
Alexandre Kühn 3f75153ad7 [IMP] mail: introduce 'FollowerSubtypeView' model
Task-2793280

closes odoo/odoo#87011

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-29 20:21:01 +02:00
Alexandre Kühn c31a1da0ea [IMP] mail: turn "Rtc/connectedRtcSessions" into field
Task-2734101

closes odoo/odoo#85035

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-29 20:20:24 +02:00
xlu-odoo 2998cfca80 [REF] web,mail: command palette revamp
This commit simplifies the SCSS of the command palette component.

task-2748052

closes odoo/odoo#83938

Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-03-29 20:20:19 +02:00
tsm-odoo 97bd67acc5 [IMP] mail: make start method handle hasWebClient parameter properly
startServer method ease data seeding by providing an environment that
can be used to interact with the underlying mock server.The createWebClient
method was not supported well. Indeed, we could either pass serverData or not.
But we could not pass only the views and take the data from the startServer
method. This issue was addressed.

task-2792108

closes odoo/odoo#87432

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-29 17:23:28 +02:00
Brieuc-brd 68c974dfad [REF] mail: ComposerSuggestedRecipientList, review and simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2781992

closes odoo/odoo#87452

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-29 12:00:18 +02:00
tsm-odoo ccdd00303d [IMP] mail: remove activity menu fake model
task-2792108

closes odoo/odoo#87434

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-29 12:00:07 +02:00
tsm-odoo 0c847108ac [IMP] mail: register m2x avatar user fake model
In preparation of test adaptation after introducing a new way to
seed test data, the fake model present on the m2x avatar user test
have been registered to the model definitions instead of being
declared on it's test.

task-2792108

closes odoo/odoo#87433

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-29 12:00:04 +02:00
Zelong Lin 74696cab83 [IMP] mail, hr: constraints when channel_type is not 'channel'
The group_public_id and group_id and subscription_department_ids
should only be used when the channel_type is 'channel'.

task-2766712

closes odoo/odoo#84813

Related: odoo/upgrade#3266
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-29 11:59:45 +02:00
Gorash ca4fe12a37 [IMP] base: rename var option into compile_context
In order to make it easier to understand the code of qweb.

Part-of: odoo/odoo#85110
2022-03-29 10:56:16 +02:00
Gorash 880954ebfc [IMP] *: remove _render from ir.ui.view and simplify report
There were inconsistencies in the calls to `_render`.
* the view context could contain information that misled developers.
Indeed, the context and value of the view are not supposed to be found
in the rendering. Thus by calling `ir.qweb` with the name of the
template, we ensure that there is no unwanted information and in
addition the cache key is that of the name of the template which saves
a query.
* the context used for rendering was modified by a method on
`ir.ui.view`, except this is not information used by this model. There
is now a `_prepare_environment` method residing on `ir.qweb`. This
method allows to modify the value dictionary as well as the context in
which the rendering will be done. This preparation of the data as well
as my security check is done only once per rendering. This also saves
some queries
* Freeze options for rendering were inconsistent. It could be that
options on which rendering depends were not part of the cache key. Thus,
depending on the user who generated the generation of the rendering
function, there was or was not information in the template. For example
for automatic branding. This is no longer possible, because it is the
context that is used. The options serving as a cache key are only
recorded for information (for the profiling system for example). A
simplification of the `ir.qweb.field` models could be made.

The report rendering and call `ir.qweb` instead of `ir.ui.view`.

Part-of: odoo/odoo#85110
2022-03-29 10:56:15 +02:00
Zelong Lin 72cf79a1ff [IMP] mail: channel_type cannot be changed
get prevention when transforming the channel type.

task-2774330

closes odoo/odoo#85128

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-28 23:10:49 +02:00
tsm-odoo b168313f0e [IMP] mail: adapt component tests data seeding
This PR adapts mail components tests after the introduction
of a new way to seed test data.

task-2792108

closes odoo/odoo#86655

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-28 19:00:00 +02:00
Alexandre Kühn d7dea4c68d [IMP] mail: turn "Rtc/pingInterval" into field
Task-2734101

closes odoo/odoo#85029

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-28 18:59:47 +02:00
tsm-odoo a3607cae81 [IMP] mail: remove fake model for FieldMany2ManyTagsEmail tests
task-2792108

closes odoo/odoo#87303

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-28 17:55:24 +02:00
Alexandre Kühn 39c778c611 [IMP] mail: create 'RtcSession/isCurrentUserInitiatorOfConnectionOffer'
This is exactly the field 'RtcSession/isConnected', but it was badly named.

Task-2734101

closes odoo/odoo#87284

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-28 17:55:20 +02:00
Sébastien Theys 3e249661af [IMP] mail: move getScrollableElement to message list model
task-2801089

closes odoo/odoo#87267

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-28 17:55:16 +02:00
Alexandre Kühn b04ea8e173 [IMP] mail: turn "RtcSession/rtcDataChannel" into field
Task-2734101

closes odoo/odoo#85024

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-28 13:55:09 +02:00
Didier (did) 6a0cbf8562 [FIX] mail: fix guard on load video
task-2806331

closes odoo/odoo#87324

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-28 12:57:02 +02:00
tsm-odoo 2e690b4aa3 [IMP] mail, *: make mockserver autofill relational fields' inverses
*: web, website_slides.

Specifying both side of a relation when seeding test data is cumbersome.
Let startServer method handle it.

task-2792108

closes odoo/odoo#86939

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-25 18:38:54 +01:00
Raphael ColletandDidier Debondt 036ef5b96d [FIX] core: use EXISTS in domain conditions on many2many fields
This fixes two problems that occur with conditions on many2many fields:
the subtle bug caused by NULL values that are returned by subqueries,
and the performance of those subqueries.

The problem with NULL values returned by subqueries is the fact that
they make the SQL condition undetermined instead of false, and this
discards some of the results returned by a query.  Simply consider:

    id NOT IN (1, 2, 3)

The value id=3 makes the condition false, while i=4 makes it true.  Now
consider that the set also includes a NULL value, like:

    id NOT IN (1, 2, 3, NULL)

The value id=3 makes the condition false, but the value id=4 makes it
undetermined.  Therefore this condition is actually undetermined for all
possible values of id, and a query containing that condition simply
returns nothing!

Regarding performance, consider a domain like [('tag_ids', '=', False)].
It is currently translated in SQL as

    "model".id NOT IN (
        SELECT "model_id"
        FROM "model_tag_rel"
        WHERE "model_id" IS NOT NULL
    )

PostgreSQL does not handle well this "NOT IN" expression when the
relation table is large, and uses some very inefficient query plan in
that case.  The inefficient query plan is possibly related to the
special handling of NULL values, by the way.  This commit changes the
above expression to a "NOT EXISTS" expression (as below), which is
executed with a much more efficient query plan, even with large tables.

    NOT EXISTS (
        SELECT 1
        FROM "model_tag_rel"
        WHERE "model_tag_rel"."model_id" = "model".id
    )

This change was motivated by a use-case with 2.7M account moves, 11M
account move lines and a many2many relation table with 2.3M lines
(`account_move_line_account_tax_rel`).  The query was timing out (15
minutes), and it now takes 15 seconds.

We have replaced all the conditions on many2many fields to use the
relational operators EXISTS and NOT EXISTS.

A test has been added to reflect a case where the many2many table
contains NULL values, like the one for channel_partner in regards to
partner_id and guest_id.

task-2753782

X-original-commit: 334b2aa2aa437d2ed86130f2ed426025f8fe4b86
Part-of: odoo/odoo#87285
Co-authored-by: Didier Debondt <did@odoo.com>
2022-03-25 17:47:43 +01:00
Alexandre Kühn 939d05b429 [IMP] mail: introduce MailTemplateView
Task-2793280

closes odoo/odoo#87213

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-25 16:51:49 +01:00
Alexandre Kühn bc4f8e577e [IMP] mail: turn 'ComposerView/extraSuggestions' into field
Task-2793280

closes odoo/odoo#87095

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-25 15:54:34 +01:00
Alexandre Kühn 0597ba1fe8 [IMP] mail: turn 'MessageView/isActive' into field
Task-2793280

closes odoo/odoo#87001

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-25 15:54:31 +01:00
Alexandre Kühn 2ebb9fc025 [IMP] mail: turn 'MessageAuthorPrefixView/thread' into field
Task-2793280

closes odoo/odoo#86989

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-25 15:54:27 +01:00
Brieuc-brd 76369d33b7 [REF] mail: ChatterTopbar, review and simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2781992

closes odoo/odoo#86461

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-25 12:39:53 +01:00
Alexandre Kühn 7544078420 [IMP] mail: turn "RtcSession/isConnected" into field
Task-2734101

closes odoo/odoo#85032

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-25 12:39:50 +01:00
Alexandre Kühn 714948cb97 [IMP] mail: introduce 'MessageView/isHovered' field
Task-2793280

closes odoo/odoo#86694

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 20:47:46 +01:00
Alexandre Kühn c44f35f61d [IMP] mail: turn 'MessageAuthorPrefixView/message' into field
Task-2793280

closes odoo/odoo#86980

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 18:58:26 +01:00
Alexandre Kühn 6b0a59c951 [IMP] mail: turn 'MessageView/isClicked' into field
Task-2793280

closes odoo/odoo#86966

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 18:10:47 +01:00
Sébastien Theys 4708c12ce5 [IMP] mail: remove _loadMore from message list component
Useless indirection.

Part of task-2801089

closes odoo/odoo#87117

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 17:12:22 +01:00
Brieuc-brd 9ead1efcfa [REF] mail: FollowerListMenu, review and simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2781992

closes odoo/odoo#86727

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 17:12:05 +01:00
Brieuc-brd fa278c83d8 [REF] mail: ChatterContainer, review and simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2781992

closes odoo/odoo#86331

Related: odoo/enterprise#25227
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 17:11:55 +01:00
Brieuc-brd 8b1e8899aa [IMP] mail: ChatWindowHiddenMenu, update the layout
Prior this commit, the `ChatWindowHiddenMenu` had a fixed width and the
`windowCounter` was truncated when the number was higher than 9.
Also, when the `unreadCounter` was displayed, it was partially hidden by
the chat windows.

After this commit, this element uses a fluid width and is in front of
the chat windows to correctly display the `unreadCounter` badge.

task-2781992

closes odoo/odoo#86244

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 17:11:51 +01:00
Brieuc-brd f1555eac93 [REF] mail: ChatWindowHiddenMenu, review and simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2781992

Part-of: odoo/odoo#86244
2022-03-24 17:11:51 +01:00
Alexandre Kühn 1b5fa72056 [IMP] mail: 'ComposerSuggestion' + 'ComposerView/mainSuggestions'
Task-2793280

closes odoo/odoo#87092

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-24 13:57:46 +01:00
Thibault Delavallée 94ab6963cf [IMP] test_mail: add and improve tests for composer
PURPOSE

Cleanup and improve composer-related tests. As composer will soon be improved
better ensure we don't break flows.

SPECIFCIATIONS

Cleanup existing tests: rename, make it use tools, reoder them.

Add some tests about composer in order to better spot changes and differences
as well as to help debugging mail composer code update. Notably add tests
with Form tool, add tests for reply-to computation, auto-delete, mail server.

Performance tests about composer are added, notably using the Form tool. This
helps determining differences between creating / manipulating a composer in
code and in UI. Indeed notably onchange and some side effects may lead to
different query counters, which is the case as highlighted here. Tests
involving attachments are also added to see their impact on posting process.

Task-2673913 (TestMail: Cleanup and improve test coverage)

Part-of: odoo/odoo#86393
2022-03-24 13:57:36 +01:00
Thibault Delavallée 6d166d6088 [IMP] base, mail_*: use MockSmtplibCase and improve tests tooling
mail_* = mail, test_mail, test_mail_full, test_mass_mailing

PURPOSE

Improve tooling of mail tests. Use SMTP mockup class available in base tests
in mail tests to have a better and simplified mock tool when dealing with
mail tests. Remove old fashioned code.

SPECIFICATIONS

Include ``MockSmtplibCase`` directly into ``MockEmail`` so that we re-use
existing components for mocking outgoing emails. Also make parameters for
gateway coherent between those two classes (use same test values).

Remove 'sim_error' weird parameter of Mail ``mock_mail_gateway`` and use
standard mock 'side_effect' instead in some specific tests, notably on
SMTP.connect() mock.

Add some assert / tools method and improve existing tools, used for creating
or improving test data. This will be used in future commits when adding new
tests.

Add outgoing mail servers data in mail tests, allowing to make tests closer
to real life use cases.

Remove unnecessary calls to ``_init_mail_gateway`` as it is automatically
done in ``MailCommon.setUpClass()``.

Try to consolidate starting test data, notably with countries, phone numbers
or email in mind to be sure test mail are deterministic.

Task-2673913 (TestMail: Cleanup and improve test coverage)

Part-of: odoo/odoo#86393
2022-03-24 13:57:35 +01:00
Thibault Delavallée c2fd9a4965 [IMP] (test_)mail: allow attachment propagation in all activity feedback methods
Activity-level feedback method accepts attachment_ids but not its mixin-level
counterpart. This commit fixes that by adding the parameter. The activity-level
action_feedback_schedule_next method now also accepts attachments in addition
to the feedback, making the API coherent through all entry points.

At activity level ``action_done`` now goes through ``action_feedback``. This
means it now has two main methods
  * ``action_feedback``;
  * ``action_feedback_schedule_next``;

All methods finally end up calling ``_action_done`` and correctly propagate
feedback and attachments. We have a bit less entry points with possible API
changes.

Test mail models are updated to be able to use this small addition.

Task-2710804 (Mail: Clean MailThread API)

Part-of: odoo/odoo#86393
2022-03-24 13:57:34 +01:00
Sébastien Theys 648d47ede1 [IMP] mail: use message list view for guarding
Now that message list view exists, it should be used whenever possible, in
preparation of future commits.

Part of task-2801089

closes odoo/odoo#87113

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 12:57:25 +01:00
Alexandre Kühn d801553c53 [IMP] mail: introduce 'MessageAuthorPrefixView' model
Task-2793280

closes odoo/odoo#86973

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 12:57:20 +01:00
Alexandre Kühn aca77f18b8 [FIX] mail: do not show chat window hidden menu in mobile
Task-2795429

closes odoo/odoo#86551

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-24 12:57:12 +01:00
Alexandre Kühn af9b2f5657 [IMP] mail: turn 'MessageView/isSelected' into field
Task-2793280

closes odoo/odoo#86465

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 12:57:08 +01:00
dja-odoo 472fac659e [IMP] mail: limit followers edition/removal for users with read access
Before this commit, if the user has read only access to a record:

 - User could see 'Add Followers' button, which raised AccessError
 - User could see edit and remove icons but performing these actions
  for followers other than one related to logged in user, it also
  raised AccessError.

With this commit, we are restricting it based on the user rights, if
the user has read only access to a record:

 - 'Add Followers', subtype edition(pencil icon) and follwer removal
   buttons will be visible only for the follower related to logged in
   user, not for others. This way we can avoid the unexpected
   AccessErrors.

Note that if user is having write access for the record, nothing
changes.

task-id-2447776

closes odoo/odoo#70575

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-03-24 12:56:52 +01:00
Sébastien Theys df30f9fba3 [FIX] mail: reintroduce scroll to top on posting message in chatter
The feature was broken in https://github.com/odoo/odoo/commit/80d74e7ee0eab83dc5100e0776df09d04b882fec#diff-14904a101d1c0589d79515df7065aeeaaf0d4cdeaff9a4748ff0331c481efe8eL275
where `loadNewMessages` was mistakenly removed.

But this call is useful to make sure newly posted messages (from other users)
are fetched, as well as having the side-effect to scroll to the newly posted
message of the current user in particular.

closes odoo/odoo#87114

X-original-commit: 1550e08945597f3a49a7c8adec3cc0c2d9afdf82
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-23 22:14:07 +01:00
bit-odoo 0f98a416e5 [FIX] mail: attachment viewer download and print buttons for guest
Before this commit:

Attachment viewer download and print buttons not working for guests.

After this commit:

Attachment viewer download and print buttons will work for guests.

Task-2664842

closes odoo/odoo#87025

X-original-commit: 191a4b21a446d17a5090481b16f3de56a57f611e
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-23 21:11:06 +01:00
Alexandre Kühn 3de3573f1e [IMP] mail: remove useless guard 'Thread/hasComposerThreadTyping'
Thread/hasComposerThreadTyping is always set to boolean, so never `undefined`.

Task-2793280

closes odoo/odoo#86965

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-23 21:11:02 +01:00
Alexandre Kühn 9c2890ac86 [IMP] mail: turn 'ComposerView/hasHeader' into field
Task-2793280

Part-of: odoo/odoo#86965
2022-03-23 21:11:02 +01:00
Alexandre Kühn 8e833f0cd2 [IMP] mail: guard WelcomeViewComponent
Task-2797754

closes odoo/odoo#86953

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-23 20:18:45 +01:00
Alexandre Kühn d722bfe267 [IMP] mail: guard DiscussSidebarMailboxComponent
Task-2797754

closes odoo/odoo#86815

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-23 20:18:41 +01:00
Alexandre Kühn 8aa97941c6 [IMP] mail: guard RtcLayoutMenuComponent
Task-2797754

closes odoo/odoo#86940

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-23 18:05:21 +01:00