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
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
closesodoo/odoo#118701
Related: odoo/enterprise#41285
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
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
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
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
* = 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
closesodoo/odoo#118354
Related: odoo/upgrade#4553
Related: odoo/enterprise#39661
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
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.
closesodoo/odoo#111850
Related: odoo/documentation#3612
Related: odoo/enterprise#36728
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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 #117555closesodoo/odoo#118290
X-original-commit: ff5d0c75fcea5842c5236b1b3f7480ef5a3dc415
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Thiry Renaud (reth) <reth@odoo.com>
'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
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
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
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
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
closesodoo/odoo#112331
Related: odoo/upgrade#4320
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
closesodoo/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>
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)
closesodoo/odoo#112573
Related: odoo/enterprise#37039
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
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
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
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
closesodoo/odoo#105405
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
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
Update to current runbot state, in order to better spot changes potentially
introduced with this PR.
Task-2710804 (Mail: Clean MailThread Posting API)
closesodoo/odoo#106182
Related: odoo/enterprise#34197
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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>
Some differences between community / enterprise seems to have vanished.
Task-2710804 (Mail: Clean MailThread API)
closesodoo/odoo#99566
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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>
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
closesodoo/odoo#96446
Related: odoo/enterprise#29726
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit will simplify the code of Thread by properly splitting all
behaviors exclusive to mail.box threads.
* = test_mail_full
closesodoo/odoo#97996
Related: odoo/enterprise#30402
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
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
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
closesodoo/odoo#94828
X-original-commit: 10d2a3e01a0fb62860e502cc67e5311b9420a684
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
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
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
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)
closesodoo/odoo#94660
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
*: 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.
closesodoo/odoo#94301
Related: odoo/enterprise#28747
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
*: 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.
closesodoo/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>
* 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
closesodoo/odoo#93917
Related: odoo/enterprise#28538
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
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
closesodoo/odoo#93846
X-original-commit: 2b3b840cdb2721759552c6b0003bcd2a69c9b34f
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Larcin Vincent (vila) <vila@odoo.com>
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#73271closesodoo/odoo#93470
X-original-commit: 6118ecba8d807ac5ebc69ae4877e1f202b0daeb1
Related: odoo/enterprise#28308
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
* = 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
closesodoo/odoo#89537
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
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
closesodoo/odoo#90203
Related: odoo/upgrade#3487
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
closesodoo/odoo#91876
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
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
closesodoo/odoo#91164
X-original-commit: 61026806d831b49a7cf5c44ffef3d762986781ce
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>