Commit Graph
157 Commits
Author SHA1 Message Date
Martin Trigaux cd2f330bec [IMP] *: remove glocal ACL
Specify explicit route for each ,, line
This is part of task 3230280 where global ir.model.access will be
forbidden.
The goal is to make access to public/portal explicit. Too often,
global access was granted with only employees in mind.

Remove ,,0,0,0,0 lines

mail:
employee already had read access to mail.group
still needed to subtypes as in ir.rule domain

mail_group: employee already had read access
pos_mercury: only needed for employees

membership:
move public access for website_membership as needed in the controllers

website_customer: employee already had read access

website_event_booth: no need for category
website_event_exhibitor: retrieved in sudo
website_event_track: not needed for location

Part-of: odoo/odoo#125216
2023-07-11 22:33:47 +02:00
Martin Trigaux 604a47ead8 [IMP] *: remove global ACL
THese are rarely intended for all users but often intended only for
employees.

account:
account.incoterms: only used within internal business models
account.journal.group: same as account.journal, add sudo in computed field

account_edi: need access to accounting objects

base_address_extended:
res.city: only employees should access address data

board: only employees uses this (old) module

crm:
crm.stage: internal users business object

hr_recruitment: employees can read

im_livechat: apply same as for the steps

l10n_ar: used on partner, not only invoices
l10n_ec: accessed only through account.move
l10n_latam: accessed on res.partner

mail:
publisher.warrenty.contract: no data, only static models
mail.channel: group_user has already his own rule
mail.group: group_user has already his own rule
mail.message.subtype: group_user has already his own rule
mail.message.all: remove, already has a portal and employee rule

partner_autocomplete: no interaction with public

project:
project.tags: only needed for project sharing

sale_management:
sale.order.option: same as sale.order

utm: employee already has write access

web_editor: test models that have nothing to do here
web_tour: only employees uses tours

website_sale:
product.ribbon: add sudo for access

base:
ir.default: only employees uses set (could probably be converted to group_system)
ir.ui.view.custom: same as ir.ui.view, add sudo when needed
report.*: portal users don't configure reports
res.users.log: create in sudo, no access needed (adapt test to use another model)
res.lang: still needed for public

closes odoo/odoo#118701

Related: odoo/enterprise#41285
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-06-12 22:39:26 +02:00
Thibault Delavallée f11f9f221e [IMP] test_mail_full: add performance tests for portal_message_format
Purpose of this commit is to add performance tests for 'portal_message_format'
that is used when displaying chatter in frontend (e.g. customer portal). It
allows to keep an eye and to optimize part of that code allowing cross-apps
optimization.

Task-3322905

Part-of: odoo/odoo#121104
2023-05-16 15:55:18 +02:00
Thibault Delavallée c1a6ef5d0d [IMP] test_mail(_sms): update counters to latest runbot
Update counters to match current runbot state. Several changes (ORM, mail
code organization) lead to some counters being obsolete.

Task-3322905

Part-of: odoo/odoo#121104
2023-05-16 15:55:16 +02:00
Pierre-Yves Dufays c8b27bd3a0 [IMP] crm, hr_work_entry_holidays, test_mail{_full}: update query count
In order to display the unfollow link or not in emails or in the inbox, the
system need to query the followers of the document. This is what explains the
added queries.

See odoo/odoo#107978

Task-3061864
2023-05-10 13:21:07 +02:00
Sébastien Theys 90cb44e1e1 [REF] mail, *: rename mail.channel to discuss.channel
* = bus, calendar, crm_livechat, hr, hr_holidays, im_livechat, mail_bot,
    mass_mailing, privacy_lookup, test_discuss_full, test_mail,
    test_mail_full, website_crm_livechat, website_livechat, base

In preparation of splitting discuss and mail modules.

Part of task-3265211

closes odoo/odoo#118354

Related: odoo/upgrade#4553
Related: odoo/enterprise#39661
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-21 02:21:53 +02:00
Martin Trigaux 69f911d994 [IMP] *: enforce usage of Markup in mail
When using message_post, the body format must be explicitly specified.
If html is expected, a Markup object should be used.
If text is given, the content will be escaped.

Before this PR:
message_post was unaware if the content of a message was HTML or
text. This lead to multiple situation where the content was
incorrectly considered as HTML and led to display errors.
In
  self.message_post(body="Hello %s!" % self.name)
if the name contained HTML, it would be evaluated.

In
  self.message_post(body="Contact Raoul <raoul@caramail.be>")
the email would not be displayed as considered as unknown HTML and
discarded by the sanitizer

Now each call must explict the type of content.
Use the escape() helper to properly combine Markup and translations.
It would also be acceptable to use Markup() to wrap a static
translation but escape is better as one can not guarantee the content
of a translation.

closes odoo/odoo#111850

Related: odoo/documentation#3612
Related: odoo/enterprise#36728
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-04-13 16:39:48 +02:00
Renaud Thiry dddb2f5355 [IMP] base: Clear precommits on test cleanup
Precommit hooks would stock data until a call to ``cr.flush`` was made.
Notably, this happens when the ``assertRaises`` method is called.
Functions were applied on records already cleared from the cache.

This change adds a cleanup call for `TransactionCase` as it keeps
the same cursor for all tests. Cursor precommits can now
be safely executed inside tests.

Task-2834304

Forward port of #117555

closes odoo/odoo#118290

X-original-commit: ff5d0c75fcea5842c5236b1b3f7480ef5a3dc415
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Thiry Renaud (reth) <reth@odoo.com>
2023-04-13 04:08:25 +02:00
Thibault Delavallée c9848bbf58 [REF] test_mail(_*): simplify Mail-based test class usage
'TestMailCommon' was useless and is replaced by the 'MailCommon' class defined
directly in Mail addon, easing inheritance and imports.

Task-3263512

Part-of: odoo/odoo#117606
2023-04-04 20:08:37 +02:00
7710c3331e [REF] mail, *: refactor Discuss
This commit refactors discuss code to use OWL components
and new tools and services in web/.
Functionally, Discuss app should work relatively the same as
before this commit.

closes https://github.com/odoo/odoo/pull/110188

Related:
https://github.com/odoo/enterprise/pull/38058
https://github.com/odoo/upgrade/pull/4423

closes odoo/odoo#110188

Related: odoo/upgrade#4423
Related: odoo/enterprise#38058
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Alexandre (aku) <aku@odoo.com>
Co-authored-by: Didier (did) <did@odoo.com>
Co-authored-by: Géry (ged) <ged@odoo.com>
Co-authored-by: Louis (wil) <wil@odoo.com>
Co-authored-by: Maël (mapa) <mapa@odoo.com>
Co-authored-by: Maryam (maki) <maki@odoo.com>
Co-authored-by: Sébastien (seb) <seb@odoo.com>
Co-authored-by: Thanh (tso) <tso@odoo.com>
Co-authored-by: Matthieu (tsm) <tsm@odoo.com>
Co-authored-by: Zelong (zel) <zel@odoo.com>
2023-03-17 11:47:09 +01:00
Thibault Delavallée c088d5423e [IMP] mail: cleanup _notify_get_recipients code bits
This commit contains mainly code cleaning, docstrings and a small split
for notification tool methods. In this commit we

  * make some notification groups variable explicit;
  * move the filler of groups into its own submethod to ease being called
    from other code (to be used soon);
  * fix some strange overrides or code manipulation;
  * propagate some additional parameters to ease future commits that will
    improve rendering of groups-based notification emails;
  * cleanup, fixup and improve docstrings;

This does not change anything from functional point of view, just preparing
further work.

Task-3046371 (Mail: Better Language Support in Composer)

Part-of: odoo/odoo#106177
2023-03-09 15:54:12 +01:00
Thibault Delavallée 3147d09b90 [IMP] (test_)mail: improve test tooling
Allow to return <mail.mail> records and found outgoing emails when using
asserts. It eases doing checks in some specific tests e.g. checking
notification layout usage in emails. Indeed this is quite low level and
does not really deserves its own assert tooling methods.

Update tool method generating attachment data to ease name tweak when required
in tests.

Also update query counters, and fix a test not running locally.

Task-3046371 (Mail: Better Language Support in Composer)

X-original-commit: odoo/odoo@b32d937b37
Part-of: odoo/odoo#114511
2023-03-07 18:03:01 +01:00
Pierre-Yves Dufays c3873cb1e1 [IMP] mail, rating, various: support base rating feature in mail.thread
Various: im_livechat, rating, test_mail_full, website_{sale|slides}

Allows to rate any record extending mail_thread. This change was needed because
rating template could be created for any models, even those not inheriting from
rating.mixin. If sent on a record of such model, it was crashing when the
controllers using rating mixin features were used. This is no longer the case.

This commit moves the code from the mixin rating.mixin to mail.thread and
adapts the test for testing rating submission with and without the mixin.

Base behavior accepts rating and provides an access to ratings through the
'rating_ids' field. Rating.mixin inherits now from mail.thread to ease
computation, and adds statistics and some advanced capabilities.

Inheritance of some model have been reordered now that rating is build on
top of mail.thread.

Task-2674649

Part-of: odoo/odoo#103966
2023-02-23 14:53:50 +01:00
std-odoo ffa589861b [FIX] mail: revert the unlink in batch of the <mail.mail>
Bug
===
The unlink of the <mail.mail> in the CRON is problematic because we
accumulate a lot of records, and the CRON timeout.

In particular, when we sent a mailing, we receive the "opened" event
(blank image in the email), and so we need to update the mailing trace.
But, if we unlink the mail at the same time, it locked the mailing trace
table and we couldn't write the new value.

The reason for that is that before, the unlink took more queries, but
it was done one record at a time, so we could commit the change and
release the lock between each unlink.

Task-3179157
See odoo/odoo/pull/73271

closes odoo/odoo#112331

Related: odoo/upgrade#4320
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-15 12:33:45 +01:00
std-odoo dab3d0a282 [FIX] mail: revert the unlink in batch of the <mail.mail>
Bug
===
The unlink of the <mail.mail> in the CRON is problematic because we
accumulate a lot of records, and the CRON timeout.

In particular, when we sent a mailing, we receive the "opened" event
(blank image in the email), and so we need to update the mailing trace.
But, if we unlink the mail at the same time, it locked the mailing trace
table and we couldn't write the new value.

The reason for that is that before, the unlink took more queries, but
it was done one record at a time, so we could commit the change and
release the lock between each unlink.

Task-3179157
See odoo/odoo/pull/73271

closes odoo/odoo#112703

X-original-commit: 57ae1b9b8b61f5f4719a8a81e9d0d21fab58cfda
Related: odoo/enterprise#37069
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2023-02-15 10:14:53 +01:00
Thibault Delavallée 03aa01aff7 [FIX] portal: fix recipients computation override
Portal defines the 'portal.mixin' that overrides a method from 'mail.thread'.
However no explicit inheritance is given between those two mixin. Some Odoo
models notably inherit from 'portal.mixin' and not from 'mail.thread'. It
makes no sense to override a method the model does not explicitly inherit.

In this commit we move the override on 'mail.thread' by checking the model
also inherits from 'portal.mixin' before doing portal-specific computation.
This fixes tests introduced previously.

Task-3175768 (Mail: check inheritances / overrides)

closes odoo/odoo#112573

Related: odoo/enterprise#37039
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-13 22:46:42 +01:00
Thibault Delavallée c70662b6c6 [IMP] test_mail_full: add tests for portal inheritance of thread features
Purpose is to add tests as there are some broken overrides in mail.thread
inheritance mechanism.

We see notably that bad override in portal make some override not being
called correctly.

Task-3175768 (Mail: check inheritances / overrides)

Part-of: odoo/odoo#112573
2023-02-13 22:46:41 +01:00
Thibault Delavallée 300ae603d1 [REF] mail: remove composer onchange, now unnecessary
PURPOSE

Purpose of this task is to remove the _onchange_template_id method on composer
model. Split it into editable computed stored fields. It gives a better control
of value generation and avoid having to call the onchange when composer is
invoked in code.

SPECIFICATIONS

Remove onchange as it is not used anymore. All fields have been converted.

Task-2088884 (Mail: Use editable computed stored fields in composer)

Part-of: odoo/odoo#107356
2023-01-27 19:56:08 +01:00
Thibault Delavallée 1a1acabd7b [REF] mail: cleanup mono/multi record composer behavior
RATIONALE

Improve usage of composer in comment or email mode: support batch-posting in
comment, support more configuration from templates, improve global model.

SPECIFICATIONS

Support a real res_ids field on mail.compose.message model. Instead of relying
on active_ids from context, store it once for all at composer level and use
it in code. Active_ids usage is still done at default_get level, using it to
populate the field.

Improve usage of domain, renamed to res_domain to match other document related
fields naming. Add support of a res_domain_user_id field allowing to set the
user from which the domain should be evaluated.

Composer now runs on a list of IDs. Mass mail mode and comment mode are now
distinct from running on a singleton or on more records. Rendered or raw
mode is not triggered by

  * mass mailing mode: always display raw mode, whatever the number of records;
  * comment mode: display rendered mode when having a single record (like the
    previous comment mode). Display raw mode when having either no records
    either at least two records.

Task-3035101 (Mail: Support batch-posting from composer)

Part-of: odoo/odoo#99482
2023-01-17 20:58:39 +01:00
Pierre-Yves Dufays d4c865199e [IMP] mail, test_mail_full: add portal flow test
The tests consist in sending a mail related to a record to a customer and
checking that the record can be viewed through the embedded link:
- either in the backend if the user is connected and has the right to
- or in the portal otherwise

It also test that if the embedded link is tampered, the access is forbidden.

Task-2797311

closes odoo/odoo#105405

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-12-19 13:38:00 +01:00
Thibault Delavallée efe53fbe88 [IMP] mass_mailing: improve routes naming
Rename main routes, and keep a legacy for the main unsubscribe route to
keep retro compatibility for existing mailings.

Task-2710804 (Mail: Clean MailThread API)
Task-2669037 (Mass Mailing: Subscription page code cleaning)
Prepares Task-2150462 (Mass Mailing: Unsubscribe flow refactoring)

Part-of: odoo/odoo#106568
2022-11-25 18:55:21 +01:00
Thibault Delavallée 6185f14807 [REF] mass_mailing: rename hash methods
PURPOSE

Overall cleaning of subscription and exclusion management code from portal.

SPECIFICATIONS

In this commit we rename methods generating tokens (for recipients and report
management). Otherwise it is hard to distinguish them as naming is not really
convenient to use

  * _unsubscribe_token -> was actually generating token for a given recipient
    on a given mailing;
  * _get_unsubscribe_token -> was actually generating token for mailing
    users to deactivate D+1 KPI reporting;

Hash for mail tracking is also moved in its own method to avoid having the
same code twice. Better delegate it to a tool sub method.

Task-2710804 (Mail: Clean MailThread API)
Task-2669037 (Mass Mailing: Subscription page code cleaning)
Prepares Task-2150462 (Mass Mailing: Unsubscribe flow refactoring)

Part-of: odoo/odoo#106568
2022-11-25 18:55:21 +01:00
Thibault Delavallée bc231ec6e3 [FIX] test_(crm/event/mail/discuss)(_full): update query counters
Update to current runbot state, in order to better spot changes potentially
introduced with this PR.

Task-2710804 (Mail: Clean MailThread Posting API)

closes odoo/odoo#106182

Related: odoo/enterprise#34197
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-11-21 22:20:27 +01:00
Alexandre Kühn cc6546677d [IMP] mail, *: Rename component to match model (step 2)
[IMP] mail: rename ActivityBox to ActivityBoxView (component)
Task-3046113

[IMP] mail: rename ActivityMarkDonePopoverContent (component)
Task-3046122

[IMP] mail: rename AttachmentBox to AttachmentBoxView (component)
Task-3046129

[IMP] mail: rename AttachmentDeleteConfirm (component)
Task-3046160

[IMP] mail: rename CallActionList (component)
Task-3046187

[IMP] mail: rename CallParticipantVideo to CallParticipantVideoView (component)
Task-3046193

[IMP] mail: rename ChannelInvitationFormSelectablePartner (component)
Task-3046287

[IMP] mail: rename ChannelInvitationFormSelectedPartner (component)
Task-3046288

[IMP] mail: rename ChannelMember (component)
Task-3046298

[IMP] mail: rename ChannelMemberList (component)
Task-3046306

[IMP] mail: rename ChannelMemberListCategory (component)
Task-3046307

[IMP] mail: *: rename ChatWindowHeader (component)
*: hr, im_livechat, website_livechat
Task-3046330

[IMP] mail: rename ChatWindowHiddenMenu (component)
Task-3046358

[IMP] mail: rename ChatWindowHiddenMenuItem (component)
Task-3046515

[IMP] mail, *: rename Composer (component)
*: hr_recruitment, im_livechat
Task-3046555

[IMP] mail: rename ComposerSuggestedRecipient (component)
Task-3046598

[IMP] mail: rename ComposerSuggestedRecipientList (component)
Task-3046624

[IMP] mail, *: rename ComposerTextInput (component)
*: im_livechat
Task-3046648

[IMP] mail: rename DeleteMessageConfirm (component)
Task-3046661

[IMP] mail, *: rename Discuss (component)
*: im_livechat
Task-3046685

[IMP] mail: rename DiscussMobileMailboxSelection (component)
Task-3046703

[IMP] mail: rename DiscussMobileMailboxSelectionItem (component)
Task-3046709

[IMP] mail, *: rename DiscussSidebar (component)
Task-3046719

[IMP] mail: rename DiscussSidebarMailbox (component)
Task-3046732

[IMP] mail: rename DropZone (component)
Task-3046739

[IMP] mail: rename FollowButton (component)
Task-3047154

[IMP] mail: rename Follower (component)
Task-3047203

[IMP] mail: rename FollowerListMenu (component)
Task-3047236

[IMP] mail: rename FollowerSubtype (component)
Task-3047272

[IMP] mail: rename MailTemplate (component)
Task-3047314

[IMP] mail, *: rename Message (component)
*: im_livechat, sms, snailmail, website_sale
Task-3047352

[IMP] mail: rename MessageAuthorPrefix (component)
Task-3047683

[IMP] mail, *: rename MessageList (component)
*: hr_recruitment, website_livechat
Task-3047718

[IMP] mail, *: rename MessageNotificationPopoverContent (component)
*: sms
Task-3047742

[IMP] mail: rename MessageSeenIndicator (component)
Task-3047765

[IMP] mail, *: rename MessagingMenuTab (component)
*: im_livechat
Task-3047802

[IMP] mail: rename MobileMessagingNavbar (component)
Task-3047806

[IMP] mail, *: rename NotificationGroup (component)
*: sms, snailmail
Task-3047829

[IMP] mail, *: rename NotificationList (component)
*: im_livechat
Task-3047871

[IMP] mail: rename NotificationRequest (component)
Task-3047883

[IMP] mail, *: rename PersonaImStatusIcon (component)
*: hr_holidays
Task-3047969

[IMP] mail, *: rename ThreadIcon (component)
*: hr_holidays, im_livechat
Task-3047980

[IMP] mail, *: rename ThreadNeedactionPreview (component)
*: im_livechat, rating, test_mail_full
Task-3048021

[IMP] mail, *: rename ThreadTextualTypingStatus (component)
*: im_livechat
Task-3048042

[IMP] mail, *: rename ThreadTypingIcon (component)
*: im_livechat
Task-3048043

[IMP] snailmail: rename SnailmailError (component)
Task-3048051

[IMP] website_livechat: rename VisitorBanner (component)
Task-3048069

Task-3047725

closes odoo/odoo#104548

Related: odoo/enterprise#33411
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-10-28 20:39:58 +02:00
Thibault DelavalléeandKrzysztof Magusiak <kmagusiak> 28ed4eddea [FIX] portal: check model is valid when entering mail redirect controller
When mail_action_view() calls this function, the model may not be a valid
one or even be missing. So we check if the model exists before checking its
type.

We also correctly add kwargs parameters propagation.

Add tests.

Task-3025143

X-original-commit: b5d9f42ddc2dfde21714544add72023004069815
Part-of: odoo/odoo#103378
Co-authored-by: Krzysztof Magusiak <kmagusiak>
2022-10-18 13:17:31 +02:00
Thibault Delavallée 5f7da6920b [IMP] test_mail(_full): update counters to runbot state
Some differences between community / enterprise seems to have vanished.

Task-2710804 (Mail: Clean MailThread API)

closes odoo/odoo#99566

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-09-05 23:51:06 +02:00
Louis Wicket (wil) ff49527fb5 [IMP] mail, *: convert ThreadPreview to use Channel instead of Thread
* = im_livechat, rating, test_mail_full

Part of task-2948676.

closes odoo/odoo#99342

Related: odoo/enterprise#30921
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-09-05 16:53:52 +02:00
Louis Wicket (wil) 9beb2b13d3 [MOV] mail, *: rename ThreadPreviewView files to ChannelPreviewView
Part of task-2948676.
* = im_livechat, rating, test_mail_full

Part-of: odoo/odoo#99342
2022-09-05 16:53:52 +02:00
std-odooandThibault Delavallée 6ebb72332e [IMP] rating: improve rating notification with delaying until feedback
Purpose
=======

When someone receives an email with a rating request, he can click on a
smiley. But if he does not write a feedback, nobody is notified. This means
some rating as somehow lost and people are not notified of it.

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

Now, when the user clicks on the smiley, a message is posted but notifications
are not yet sent. This uses the new ``mail.message.schedule`` mechanism added
in this PR. It gives the user some time to write their feedback and send it.

If they write and submit a feedback, the notification process is launched.
Emails and inbox notifications are created and sent.

If they don't write a feedback notification process is launch after 2 hours.

Testing
=======

Some cleaning is done in tests, notably to split some fields tests from
performance test. A bit performance test is also split into sub tests in
order to better understand queries.

Task-2207626 (Rating: Log ratings, post feedbacks)

Part-of: odoo/odoo#95623
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2022-08-25 19:57:17 +02:00
Thibault Delavallée edb4cb6f8c [REF][IMP] crm, event, test_mail(_full): make performance tests post-install
PURPOSE

Have more reliable tests.
Better spot side effects coming from sub addons.
Lessen non deterministic counters due to local db.

SPECIFICATIONS

Make crm, event and mail performance tests post install.

Update query counters with
  * local values (install module only with enterprise activated);
  * community / enterprise runbots (if value is different);
  * some notes on non deterministic issue if known;

Task-2925606

closes odoo/odoo#96446

Related: odoo/enterprise#29726
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-08-18 21:08:50 +02:00
Arnaud Joset 4525f14780 [FIX] rating: remove profiler in test
closes odoo/odoo#98319

X-original-commit: 2227cfb98d6ca3986e6344027690d8bb893e213c
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Arnaud Joset <arj@odoo.com>
2022-08-18 13:46:28 +02:00
Louis Wicket (wil) 090c558452 [IMP] mail, *: introduce Mailbox model for mail.box threads
This commit will simplify the code of Thread by properly splitting all
behaviors exclusive to mail.box threads.

* = test_mail_full

closes odoo/odoo#97996

Related: odoo/enterprise#30402
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-08-12 17:06:08 +02:00
tsm-odoo 75007b578e [MOV] bus, *: move startServer test helper to the bus module
*: calendar, hr, hr_holidays, im_livechat, note, rating, snailmail,
test_mail, test_mail_full, website_livechat, website_slides.

Part-of: odoo/odoo#97771
2022-08-10 14:43:41 +02:00
Thibault Delavallée 039c63cf6e [REF][MOV] test(_mass)_mail(_sms): move sms tests in their own addon
In this commit we introduce a new module ``test_mail_sms`` that holds the
tests for sms application, like ``test_mail`` does for mail. Currently all
sms tests are inside ``test_mail_full``. After this commit code is moved
from ``test_mail_full`` into that module. Full testing module should be used
mainly to test integrations with a lot of submodules and for performance
tests, not testing details of SMS implementation.

We also add ``mass_mailing_sms`` as dependency of ``test_mass_mailing`` so
that both mailing types are tested in the same module. It eases maintenance
and writing of tests. Mass mailing SMS tests  from `test_mail_full`` are
therefore moved in ``test_mass_mailing``.

This commit also allows some cleaning in classes used in tests, to have
classes in ``test_mail_sms`` and ``test_mail_full`` that contain everything
necessary to test mail features.

Task-2890111 (Test Mail/Mass Mailing: SMS tests reorganization and move)

Part-of: odoo/odoo#96223
2022-07-19 11:51:12 +02:00
Louis Wicket (wil) fdcaa53ca0 [IMP] mail, *: rename mail.channel.partner to mail.channel.member
* = calendar, crm_livechat, hr_holidays, im_livechat, privacy_lookup,
privacy_lookup, test_discuss_full, test_mail_full, website_livechat

closes odoo/odoo#95912

Related: odoo/upgrade#3681
Related: odoo/enterprise#29433
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-07-19 11:50:37 +02:00
Thibault Delavallée 40f4ea486b [UPD] various: update query counters
closes odoo/odoo#95556

Related: odoo/enterprise#29247
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-07-08 14:34:04 +02:00
Vincent Larcin 9863745d9f [FIX] portal: filter empty messages in the chatter
In some cases, empty messages can be displayed in the portal chatter.

For instance, if a customer sends a message with no body and just
an attachment, and the attachment then gets deleted, it will still
be displayed as an empty message in the portal chatter.

To solve this, this commit filters out empty messages from the portal chatter.

Task-2833919

closes odoo/odoo#94828

X-original-commit: 10d2a3e01a0fb62860e502cc67e5311b9420a684
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-06-30 18:52:07 +02:00
std-odoo 66f5bc4dbf [IMP] portal: allow portal users to deactivate their accounts
Purpose
=======
Allow portal users to deactivate their accounts from the portal view.

After the deactivation, they are redirected to the login page, so
they can verify that they can not longer login with their credentials.

We first archived the record and remove sensitive information (password,
login, so he can not log in again with the same credentials).

After the deactivation, we blacklist the email and the phone of the
user, so we are sure that we never send him again email / SMS.

Then, we create a <res.users.deletion> to delete the user and the
partner in a CRON because this operation can be heavy (write_uid,
create_uid field on all models).

Task-2629544

Part-of: odoo/odoo#78298
2022-06-30 12:10:56 +02:00
Vincent Larcin 7a2650760d [FIX] portal: use correct author for comments on shared records
Steps to reproduce
------------------

1. Create two partners A and B.
2. Create a shareable record, e.g. a sales order, and set A as the customer.
3. Share the record with B.
4. Use the share link sent to B and comment on the record.
5. Your comments will be sent with A as the author.

Expected behavior
-----------------

Share links sent to a customer should make you comment as that customer.

Task-2883044

X-original-commit: df162acc589b74b0e3c1e9687ce6a1980233f5f1
Part-of: odoo/odoo#94695
2022-06-28 10:23:43 +02:00
Thibault Delavallée 163a12e423 [IMP] link_tracker, mass_mailing(_sms): improve tests
Improve link tracker tests :

  * add missing test for trace tracking in mass mailing. We generate a trace
    and find a short link in it, in order to test the tracking in mass
    mailing;
  * add tests for side effects of mass mailing routes: update of trace status,
    clicks, ...
  * wrap base url locally instead of globally in MockTracker class to ease
    specific setup in classes;

Prepares Task-2150462 (Mass Mailing: Unsubscribe flow improvement)

closes odoo/odoo#94660

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-06-27 16:25:55 +02:00
tsm-odoo e97214ff4e [IMP] mail, *: remove createMessagingMenu during tests
*: im_livechat, test_mail, test_mail_full.

The createMessagingMenu helper was used during tests to mount
the messaging menu and test it. However, this approach is not
very realistic and blocks some waiting PRs. In order to get closer
from the reality, let's instanciate a webClient and a systrayService
for the messagingMenu to be present at all time.

closes odoo/odoo#94301

Related: odoo/enterprise#28747
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-06-22 16:32:42 +02:00
tsm-odoo b575fa53a7 [FIX] web, *: fix scroll tests
*: mail, point_of_sale, test_mail_full.

The alt of images can be displayed slightly after the programatic
scroll which means the scroll height we set and the one we assert
are slightly different (the client height have changed). In order
to solve this issue, all alt attributes are replaed by data-alt
during tests. The src attribute is removed as well to make sure
images won't trigger a GET request on the server.

closes odoo/odoo#94092

X-original-commit: 0446923db6b7376ee2c27e3f6e94b5f8e43a14fb
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2022-06-21 11:20:20 +02:00
Rahul Prajapati 71a68c5923 [IMP] *: remove support for empty create with pyenv
* hr, im_livechat, mail, sms, snailmail, test_mail_full, website_livechat,
  website_slides

PURPOSE:

Creating a record with no values has no sense but is sometimes useful during
tests.
The support should be dropped for `default` parameter in `create`.

SPECIFICATION:

All the occurrences of `create()` have been replaced by `create({})`.

Task-2869394

closes odoo/odoo#93917

Related: odoo/enterprise#28538
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-06-20 15:31:51 +02:00
Vincent Larcin d300a0a021 [FIX] rating: flush rating values before computing rating_last_value
When submitting a  rating without submitting a feedback, the value of the field "rating_last_value" is not updated, because the rating values are not yet updated in the database when the method _compute_rating_last_value is called.

Steps to reproduce
------------------

The following steps are for an helpdesk ticket, but it should behave the same way on all models implementing the rating mixin.

1. Create a ticket in a team with a stage with the default rating email template.
2. Move it to the stage with the template (it should create a rating email)
3. Use the email to submit a rating.
4. When you get to the feedback page, close it without doing anything.
5. Go to your ticket's form view => the rating you submitted correctly appears in the stat button.
6. Go back to the team, and filter tickets by "No Rating" => your ticket appears, despite having a rating.

Expected behavior
-----------------

The field "rating_last_value" should have the value of the last rating submitted.

Technical
---------

This commit adds a flush right before the SQL query in `_compute_rating_last_value` to make sure the rating values are up to date in the database before the query is executed.
It also updates the test for rating submissions to also check the rating_last_value, and creates a new test for the route currently used in the first step of a rating.

Task-2880707

closes odoo/odoo#93846

X-original-commit: 2b3b840cdb2721759552c6b0003bcd2a69c9b34f
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Larcin Vincent (vila) <vila@odoo.com>
2022-06-16 19:33:04 +02:00
Thibault Delavallée b71455c328 [UPD] various: update query counters
Update to latest runbot state, at least for tests known to be
deterministic.

Notably mail tests are lower than before, probably due to odoo/odoo#73271

closes odoo/odoo#93470

X-original-commit: 6118ecba8d807ac5ebc69ae4877e1f202b0daeb1
Related: odoo/enterprise#28308
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-06-13 19:10:58 +02:00
Zelong Lin 947770ce7e [IMP] mail, *: display rating in systray
* = im_livechat, test_mail_full

Display the rating changes that generate a notification under the systray.
Using the rating faces to represent the result.

task-2794182

closes odoo/odoo#89537

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-06-01 11:02:22 +02:00
Pierre-Yves Dufays aa32818c30 [IMP] [test_]mail[_full]: improves message recipients visibility
All the recipients of message were not always displayed in discuss and some
users were wondering if the message has been sent to everybody concerned.
This solves the problem by allowing to specify whether to display all
recipients based on the message sub type and defining for which sub type it
must.

Technical note:
- The added query count in some tests is due to the fact that the inbox
notification can now be displayed on the client. Before they were discarded
right away. Now additional check must be done. The added query is due to the
test self.res_partner_id.partner_share which is now also done on inbox
notifications (This has been determined by testing locally for all tests except
one: TestMailHeavyPerformancePost.test_complete_message_post, but it is likely
for the same reason).
- A speed optimization could be to add mail_notification.display as stored
computed field in order to avoid that extra read but it would add a little more
needed storage.

Task-2429708

closes odoo/odoo#90203

Related: odoo/upgrade#3487
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-06-01 09:57:47 +02:00
Raphael Collet 6cf8db906f [REF] *: adapt code to new flush API
closes odoo/odoo#87527

Related: odoo/upgrade#3497
Related: odoo/enterprise#26939
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-05-25 18:00:47 +02:00
Ipsita Borisagar c272573905 [FIX] mail, test_mail_full: remove an obsolete method
Before this commit:

There is an obsolete method 'channel_fetch_listeners' which is not needed now.

After this commit:

Removed this obsolete method.

Task-2827899

closes odoo/odoo#91876

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-05-20 13:15:49 +02:00
Florian Charlier b0f233ba86 [FIX] link_tracker,mass_mailing_sms: fix shorten links
Purpose
Fix bugs in link replacement (html and text version)

1/ The replacement of urls in text (not html) was buggy when
* a string includes multiple urls, and
* `base_url` is one of them and not the first
* Also in SMS marketing when adding the sms `id`

When it came to base_url's turn, the replace function for the content would
replace the `base_url` part of a previously shortened url instead of the
distinct `base_url` link.

2/ Ampersand character
A) The ampersand character prevented replacement of an url inside a `Markup`.
Previous tests passed as the tracker was created but the url was not replaced.

B) The ampersand character was not recognized as part of an url for simple
strings.

3/ Replacement of already short links
A faulty logic made it possible to replace "/r/" urls when no "blacklist" was
passed.

Commit
* Ensures that only the base_url link would be replaced instead in this case.
* Adds support for urls with "&"
* Does prevent shortening short urls
* Improves link conversion performance (regex + avoid duplication when there
  are several occurrences of the same url)
* Adds multiple unit tests

Task-2783844

closes odoo/odoo#91164

X-original-commit: 61026806d831b49a7cf5c44ffef3d762986781ce
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-05-12 13:43:17 +02:00