Commit Graph
48 Commits
Author SHA1 Message Date
Pierre-Yves Dufays a0cb558048 [IMP] test_mail: add unfollow record test
Add tests that check the behavior of unfollowing a record from the inbox and
the unfollow link in email.

To support unfollowing a document in the inbox no matter the current company,
we have modified message_unsubscribe in mail_thread to allow internal user to
unsubscribe themself without checking any rights. Indeed, some document have
record rule that prevents reading it if the user is not in the right company
(ex. crm.lead) and then was preventing the user to unfollow the document using
that method. We also add a test checking that internal user can unsubscribe a
record without any read and write rights. And that a portal user can't in the
same circumstance.

Task-3061864

Part-of: odoo/odoo#107978
2023-05-10 13:21:07 +02:00
Thibault Delavallée 110d86f504 [IMP] mail: allow composer to translate from template
RATIONALE

Naming conventions
  * content = core message / subject (+ other fields);
  * email layout = layouting applied to messages when sent to recipients who
    receive notifications by email e.g. access button, ...;
  * comment mode / mailing mode: composer main composition mode: posting on
    record(s) / sending a mailing on records;

Content situation when using a template on the composer

  * comment, monorecord mode: choose a template, content is rendered directly
    from template side according to 'lang' field definition -> ok;
  * comment, multirecord mode / mailing mode: choose a template, content is
    the raw content. At post / send, content is rendered on composer side.
    As composer is not translated -> no translation -> ko;

PURPOSE

Take translations from template when composer content is the same as the
template one to benefits from their translations.

SPECIFICATIONS

When rendering some fields fetching translations can be complicated. Indeed
when using a template the translation is stored on template model while the
rendering is done on composer model. Translations are therefore not fetched
as fields of the composer record itself are not translated. It is a transient
record, not something people translate manually like templates.

As translations are not stored in a table anymore we can't really fetch
translations, except from using directly the template field. In this commit
we therefore do the rendering based on template value instead of composer
value when they are considered as equal and if a translation is asked either
through 'compute_lang' of 'force_lang'. This allows to fetch template
translations instead of composer translations.

If the composer content has been modified compared to the template we keep
the old behavior, which means probably no translations. Let us hope editor
does not mess too much with html content.

EXAMPLE

A user in english uses a template on a lead whose customer is in spanish
with a follower being in german. Template lang is customer's lang:

  * content is translated into spanish (customer's lang);

Concerning layout (to be fixed in next commits):

  * layout is partly translated into spanish (customer's lang) if coming from
    form view, otherwise is in english (current user's lang);

LINKS

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

Part-of: odoo/odoo#106177
2023-03-09 15:54:14 +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 248e0e495b [IMP] test_mail: add composer tests for email layout support and translation
Purpose is to add some tests about email layout support in both comment and
email mode, as well as language support in those two modes. They are added
in a test targeting a complete template usage, testing globally the results
(outgoing notifications or emails, buttons, language, recipients, ...).
Posting in multi-languages environment with notification layout is also
tested. Finally a test about reply-to is moved into its own subtest to
avoid polluting core template tests. Other low level details should already
sufficiently tested. Normally.

Main observations

  * translations are quite broken in mass mode (either batch comment either
    mass mailing). Indeed translations are fetched based on <mail.compose.
    message> body and subject fields, which are probably not translated
    as they are linked to a transient model. Real translations are stored
    at <mail.template> level when users translate their templates;
  * layout translation is partly supported in comment mode, due to a small
    context-based hack. However access buttons are not translated and some
    use case (like using a 'res_domain') are not supported;
  * mass_mail mode does not support layouting at all;
  * when posting manually ('message_post') current users' language determines
    the language of notification email layout e.g. a user using Odoo in French
    will send a french layout to all followers, whatever their language and
    whatever the language of the post (which is not known as user input);

Most of those use cases will be fixed soon.

Also update some query counters while passing by.

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

Part-of: odoo/odoo#114511
2023-03-07 18:03:01 +01:00
Pierre-Yves Dufays 4991dbc9a8 [REF] mail: adapt test using new main attachment mixin
Task-2648976

Part-of: odoo/odoo#110734
2023-03-02 12:32:11 +01:00
Pierre-Yves Dufays 1018c72571 [IMP] mail, test_mail: allow model to provide partner default values
Allow model to provide default values for auto creation of related res_partner
such as name, title, company_id, ...

It is used when claling 'Partner._find_or_create_from_emails()' that now
accepts custom data when creating partners based on a given email_normalized.
This allows notably to flatten a loop due to multi-company when creating
partners from emails in template management. It is now done using this email
based dict allowing to create all partners at once.

Task-3024050

Part-of: odoo/odoo#105111
2023-02-23 14:53:56 +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 041e9924c7 [REF] mail: improve default record-based data in composer
Purpose is to ease understanding of those default values and prepare move
towards editable stored computed fields by rewriting a bit the code to better
understand its purpose.

While being at it, some tests introduced recently are moved at their right
place now that everything is ready to rewrite the posting API and the
composer. Some tests are added to ensure notification-specific methods are
called along with the newly-introduced '_message_compute_subject', aka methods
to add custom header and custom mail values.

Task-2710804 (Mail: Clean MailThread Posting API)
Prepares Task-2088884 (Mail: Use editable computed stored fields in compo

Part-of: odoo/odoo#99482
2023-01-17 20:58:38 +01:00
Thibault Delavallée 418761e344 [LINT] mail, various: use explicit subtype in message_post_{with_...}
RATIONALE

Purpose of this commit is to be explicit in subtype chosen when invoking the
message composer / calling message_post. As default value may not always be
clear, better be explicit in case the composer default value changes.

SPECIFICATIONS

Add explicit references to subtype when it is not obvious what will be the
final subtype, notably when using helpers (post_with_view or template which
uses the composer that is not crystal clear in its subtype management).

In this commit we also add support of XMLID-based subtype when invoking the
composer. A ``default_subtype_xmlid`` context key is transformed into a
``default_subtype_id``, to be used notably in JS where we cannot easily
use a ``ref``-like statement. Post API now also supports 'subytpe_xmlid'
argument allowing to give the xml id and ease calling the methods.

Use ``_xmlid_to_res_id`` to get directly the ID of subtypes in order to
avoid useless queries from ``ref`` that does an exists.

Also remove useless values given to post API, notably author_id that is by
default the current users' partner.

Task-2710804 (Mail: Clean MailThread Posting API)

Part-of: odoo/odoo#99482
2023-01-17 20:58:33 +01:00
Thibault Delavallée 1394903873 [IMP] test_mail: add tests for exclusion list and duplicates in composer
Purpose of this commit is to add tests for exclusion list and duplicates
management in composer.

When being in email mode (mass_mail) state of emails is pre-processed in
order to already flag emails that should not be sent or will bounce back.
Notably emails in exclusion list or duplicates emails are set as cancel
with the right failure type.

Some tests already exist at higher level in mass mailing but having tests
at composer level is better when trying to improve code and add tests for
corner cases.

Task-3132710 (Mail: Configurable composer)

Part-of: odoo/odoo#99482
2023-01-17 20:58:32 +01:00
Renaud Thiry f039f57eb8 [IMP] Add more detailed default email subjects from chatter
All emails sent from the chatter start with "Re:" followed
by the name of the record. The name of the record alone is sometimes not enough for
the followers to understand what the mail is about.
Additionally, "Re:" does not make sense when starting a conversation.

This commit gives better default subject
for event registrations and allows thread models
to override the default subject of messages.

This also removes "Re:" from default mail subjects.

Task-2833215

closes odoo/odoo#95817

Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2023-01-05 15:36:53 +01:00
Thibault Delavallée 902cda0a1b [IMP] test_mail: add some tests on content translation
Purpose of this commit is to add tests on translations when using templates
and composer, on both email content (body, subject) and email layouting
content (view content, groups-based buttons, ...). This better highlights
some missing part of translation support, notably

  * when being in mass mode: as content is taken from the composer and rendered
    dynamically, it does not take the original translation from the template
    even if it matches template content exactly;
  * access button title is not translated as it is added during a separate
    part of the process;

We also improve tests for ``mail.composer.mixin``. The wizard used in test
(mail.test.composer.mixin) is improve to behave more like a real invite
wizard: it runs on records (mail.test.composer.source) which are records
on which dynamic content is rendered. This highlights one issue with
translations: translations are fetched on current model (aka: composer
body and subject fields). However when using templates, translations are
stored on template model (aka: mail.template). This will be improved soon
by trying to fetch template translations when composer content matches
content from template.

Task-3046371 (Mail: Improve language propagation in mail and layouting)

Part-of: odoo/odoo#106072
2022-11-21 19:55:13 +01:00
Thibault Delavallée 94208cb8b4 [IMP] test_mail: improve coverage of post helpers
Purpose of this commit is to add some test about MailThread helpers built on
top of ``message_post`` / ``composer`` (log, post with view, ...). Some tests
about batch are also added.

Some performance tests are also added for those helpers.

Counters are updated. Note that they did not change, it is just an update
based on current master counters.

Task-2710804 (MailThread Api Cleaning)

closes odoo/odoo#100184

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-09-14 23:38:05 +02:00
Thibault Delavallée 4193b1ee64 [FW][IMP] test_mail: test gateway with multiple references
Purpose is to test behavior when having multiple references in mail headers.
We have to check that parent_id is correctly taken (as it impacts internal
flag), and that flattening is performance when posting the message (always
attaching to the thread first message being the default behavior).

Note that tests highlighted that flattening is currently a bit broken as it
does not go up until the first ancestor, which is the expected behavior for
business documents having ``_mail_flat_thread``. Next commit will fix that.

Task-2822652 (Mail: fix parent message fetch / flattening)
Task-2643114 (Mail: Message-Id in references to ease thread formation)

X-original-commit: f7d4f1d29213c71e76564c485db2bbecf0bbf37c
Part-of: odoo/odoo#89328
2022-04-22 12:04:33 +02:00
Thibault Delavallée bf508a808e [IMP] test_mail: add multicompany test models
PURPOSE

Purpose of this commit is to add a company field on test mail models used to
replicate ticket / project behavior (``mail.test.ticket`` and ``mail.test.
container``).

SPECIFICATIONS

To avoid messing with existing tests and ease comparison through all Odoo
versions (notably performance) this is done by adding new models inheriting
from current mail models. A company_id field is added as well as MC rules.

Those models will be used to add tests for mail thread behavior in a multi
company environment (aliases management, performance, emails and notification
layouts, ...).

In this commit we also update ACLs for ticket-like models to add rules for
portal users, based on followers. This mimics classic rules from Odoo used
notably in a light project-like environment. This allows to test a bit more
in details recipients, access tokens, links in emails, ...

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
Thibault Delavallée bc9943f188 [FIX] test_mail: re-add groups for notification, allowing bw tests
To ease comparisons for query counters let us try to keep the same test flow
through v15+. We therefore now also compute recipient groups for portal users
for some test models, like before odoo/odoo@faeb5e7fee .

Part-of: odoo/odoo#83832
2022-02-02 18:14:54 +00:00
Thibault Delavallée 75979fccdf [REF] mail, *: improve 'pay now' notification template
* = sale, purchase

PURPOSE

Purpose of this commit is to improve the 'Pay Now' notification template
used notably when using the "Send by email" button on

  * invoices
  * sale orders
  * RFQ and purchase orders

SPECIFICATIONS

Global specifications

  * remove gray background that is around the white content (aka have an
    email with an uniform white background);
  * move button on top of email like other notification templates (top-left
    and company logo is top-right);
  * fix various small wording issues;
  * fix signature usage;

Technical specifications

Remove custom definition of access links and labels in 'Pay Now' notification
template (``mail_notification_paynow``). It is now done at model level through
the ``_notify_get_groups`` that is generic to notification emails. This allows
to remove QWeb override in purchase and sale notably. Displaying access links
is now controller by the ``has_button_access`` value. Model computes links,
access and labels while view only displays what is requested. That way any
template can use those values instead of being defined in a template subject
to user changes.

Sale / Purchase

Overrides of those modules is not necessary anymore since button labelling
and URLs are managed at model level.

Purchase "specific" buttons for Accept / Update dates are now email layout
actions, like used in other modules like HR or Project.

Continuation of odoo/odoo#76418 .

Task-2712450 (Mail/Sale: Improve 'Pay Now' notification template)

Part-of: odoo/odoo#82167
2022-01-31 17:47:33 +00:00
roen-odoo fef39f82ac [FIX] mail : Remove double signature on invoice email
Current behavior :
When sending an invoice by email there was 2 signature in the mail

Steps to reproduce :
Create an invoice
Send it by email
Check the mail, there are 2 signatures

opw-2703272

closes odoo/odoo#82347

X-original-commit: 00965df4be591b952b339038c324d7e92596e3d5
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-01-06 19:30:53 +00:00
Nicolas Bayet 4813f42997 [IMP] mail,*: replace jinja with qweb
Jinja as a templating engine was problematic in differents respect:
- introduce external dependency to Odoo (less controll)
- add another templating mechanism in the stack
- specific feature in qweb cannot be reused
- difficulty in rendering easily editable templates
- more knowledge required with no betterment

By replacing jinja with qweb we can now build tools to edit a qweb
that will work with the previously jinja encoded document
(essentially `mail.template` records).

There is a catch however. Some email fields (eg. email_to) used jinja
syntax for rendering dynamic variables (ie. ${object.something} and
${object.something_that_should_not_be_escaped | safe}).

We still want user to use dynamic variables for some char fields (eg.
subject, from, to, ...). We made a new rendering engine called
"inline_template" that will render an expression enclosed by `{{` and
`}}`.

To be able to edit the templates from the backend interface, a
plugin to the Odoo editor has been made for seamlessly edit the
document.

This qweb plugin includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
  (for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif, and t-else)
  in order to see only one at once
- a floating select input to switch visibility of a particular logical
  branching

Task-27033

X-original-commit: odoo/odoo@68182baff4
Part-of: odoo/odoo#77377
2021-09-28 23:42:54 +00:00
Ivan YelizarievandNicolas Seinlet a88a912bd4 [FIX] mail: speed up read_progress_bar
This commit fixes the performance issue in getting statistics for
``activity_state`` (colored clock icon for overdue/today/planned) in
CRM.  The query has been tested for several years on a large database
(Odoo's own production database).

Performance test on 29 K crm.lead records (activity_state):

With a filter for 10 records:

```
| measurement        | before | after |
|--------------------+--------+-------|
| number of queries  |     25 |     5 |
| query time, ms     |     12 |    95 | (*)
| remaining time, ms |     32 |     7 |
```

All records:

```
| measurement        | before | after |
|--------------------+--------+-------|
| number of queries  |   1326 |     5 |
| query time, ms     |   1739 |   129 |
| remaining time, ms |  47934 |    17 |
```

As we can see in the last results, the time went from almost 50 seconds
(not responsive at all) to 150 milliseconds (responsive).  The time
increase in (*) may be caused by imperfect measurements, which are raw
and not averaged measures.

---

opw-2346901
task-1915411

X-original-commit: 1088e73c9a897902f9d2d70df980fe2a5ed23492
Co-authored-by: Nicolas Seinlet <nse@odoo.com>
2021-07-16 11:16:34 +00:00
Thibault Delavallée 69dfaf4ca5 [IMP] mail: experimentally support QWeb rendering
Purpose of this commit is to prepare ground for future improvements by already
supporting QWeb rendering in ``mail.render.mixin``.

We temporarily support new field parameters allowing to tune the rendering
directly from field. Notaby choosing engine (jinja or qweb) can be done
from field directly. This is considered as experimental, used mainly to
prepare QWeb support.

Task ID-2534550 (Template usage improvement)
Task ID-2477164 (Composer mixin)
Prepares Task ID-27033 (QWeb in templates)
COM PR odoo/odoo#70889
ENT PR odoo/enterprise#18352
2021-06-01 09:24:26 +00:00
Stéphane DebaucheandThibault Delavallée b19fe6dea5 [IMP] mail: introduce a composer mixin for invite / send email wizards
This commits introduces a new mixin ``mail.composer.mixin`` used when sending
emails or notifications based on a mail template.

Main current purpose is to hide details related to subject and body computation
and rendering based on a mail.template. It also give the base tools to control
who is allowed to edit body, notably when dealing with templating language
like jinja or qweb.

It is meant to evolve in a near future with upcoming support of qweb and fine
grain control of rendering access.

Task ID-2534550 (Template usage improvement)
Task ID-2477164 (Composer mixin)
COM PR odoo/odoo#70889
ENT PR odoo/enterprise#18352

Co-Authored-By: Stéphane Debauche <std@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
2021-06-01 09:06:07 +00:00
Thibault Delavallée 7c3a0daaa1 [REF] test_mail: sun is shining, no more umbrellas
PURPOSE

Have a cleaner test_mail addons

SPECIFICATIONS

Umbrella -> Container, easier to understand that we target a ticket / project
like model using mail.test.ticket and mail.test.container .

LINKS

Prepares Task ID 2238597 (clean notification models)
Prepares Task ID 2083854 (improve mass mailing technical flows)
PR #49891
2020-04-22 08:40:03 +00:00
Thibault Delavallée ba068ee728 [REF] test_mail: rename test models to ease understanding
PURPOSE

Have a cleaner test_mail addons

SPECIFICATIONS

Keep only mail-related tests, move odoobot in test mail full, send "update
notification" tests in mail (specific to mail). Merge some test files to
lessen number of files, perform light file renaming.

Split test mail models file to prepare some cleaning in those models and tests.

LINKS

Prepares Task ID 2238597 (clean notification models)
Prepares Task ID 2083854 (improve mass mailing technical flows)
PR #49891
2020-04-22 08:39:46 +00:00
Thibault Delavallée 6e347b196d [MOV] (test_)mail(_full): redispatch some tests and split test mail models file
PURPOSE

Have a cleaner test_mail addons

SPECIFICATIONS

Keep only mail-related tests, move odoobot in test mail full, send "update
notification" tests in mail (specific to mail). Merge some test files to
lessen number of files, perform light file renaming.

Split test mail models file to prepare some cleaning in those models and tests.

LINKS

Prepares Task ID 2238597 (clean notification models)
Prepares Task ID 2083854 (improve mass mailing technical flows)
PR #49891
2020-04-22 08:00:29 +00:00
Thibault DelavalléeandRémy Voet 7cfd364db5 [REF] mail, various: clean usage of mail alias
Clean the usage of mail aliases and more specifically its associated mixin
`mail.alias.mixin` .

Stop using context for model of aliases, and correctly give model_id and
parent_model_id to the call chain through a cleaned code easier to override.

We also merge methods get_alias_model_name and get_alias_values in single one
called before record creation (alias first values) and right after (to have
values depending on actual record).

LINKS

Task ID 1919277
Community PR odoo/odoo#41160
Enterprise PR odoo/enterprise#6983
Upgrade PR odoo/upgrade#872

Co-Authored-By: Rémy Voet <ryv@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
2020-04-17 06:51:46 +00:00
Raphael Collet 020e2a5e85 [IMP] mail: add tracking on computed stored fields
Also delay the tracking until pre-commit, so that several updates on a
record generate a single tracking message.
2020-02-05 15:14:58 +00:00
Kevin Baptiste 2c6cd81f30 [IMP] mail: track fields based on ir_model_fields
The tracked field is now a relation to the corresponding ir.model.field.
This prevents potential privacy issues should the field be deleted or renamed.

closes odoo/odoo#39232

Taskid: 2088634
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-19 07:50:34 +00:00
Martin Trigaux 35a9150d79 [FIX] *: add missing model description
Some models did not specified a _description
2019-09-24 07:33:09 +00:00
Yannick Tivisse 1cdbeeca55 [IMP] test_mail: Add multi company test from _redirect_to_record 2019-05-29 08:33:18 +00:00
Thibault Delavallée dbd4aab6c3 [REF] mail: make blacklist a mixin built upon mail.thread and add message_bounce
* mail.blacklist.mixin now clearly make inheritance on mail.thread. Indeed
    we consider models using the blacklist mechanism as being used in mailing
    features, meaning they will anyway inherit form mail.thread. In standard
    Odoo it is the case for the 3 models using it (Lead/Opportunity, Contact
    and Mailing Contact);
  * define message_bounce directly in mail.blacklist.mixin. Bounce counter
    is indeed linked to the blacklist and mailing mechanism;
  * rename mail.blacklist.mixin to mail.thread.blacklist to ensure coherency
    with mail.thread and mail.thread.cc (another mixin build on mailL.thread);

Inherit declarations in various addons are updated accordingly.

Related to task ID 1911679
Linked to PR #29483
2019-05-13 15:18:40 +00:00
Thibault Delavallée e87189222d [IMP] test_mail: add tests for mail gateway and perform light cleaning
This commit add some tests related to the mail gateway: more bounce management
tests and some additional thread formation tests. Some test asserts about
bounce / blacklist management are commented as they are not completely working
currently. This will be improved in master soon.

Some cleaning in also done in all mail gateway tests. Notably some call to
tool methods are cleaned / simplified, duplicate tests are removed. Some
low-level checks are removed.

A new test model is added for mail gateway: mail.test.gateway. It is a
chatter model with blacklist enabled on it. It allows to tests the
various blacklist-related overrides and features as well as all basic
mail gateway features.

Sub-part of task 1853147 (pre-cleaning before implementing mail gateway
improvements)
Linked to PR #32974
2019-04-26 10:28:09 +00:00
XavierDo 92e9e84b63 [IMP] mail, *: don't track fields at create
*: project, crm, maintenance, helpdesk,

It is useless to track fields during create since they
have no initial value and future tracking message will
show changes on tracked field.

We can log a default creation message instead
(as it is now if there is no mail_create_nolog context key)

This change will implies
- less queries when creating record
- cleaner creation messages
- less occurence of mail_create_nolog ctx key

Removing tracking at create could break the creation subtypes
mechanism (example: following task creation subtype on project)
Instead of using _track_subtype to give a subtype at create,
a new _creation_subtype method can be override. If a creation
subtype is set on a specific modlel, creation messages will be
create by message_post instead of _message_log.

We also need to adapt the message_track_post_template in order to
keep this feature whithout tracking.

Task: #1916916

closes odoo/odoo#31945

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-03-29 15:28:43 +00:00
XavierDo fbafbf2230 [IMP] mail, test_mail, *: add new email.cc.mixin on main models
*: crm, project, maintenance, hr_recruitment

When a record is created from an email, cc can be lost. This commit
proposes a new mixin to keep cc on the record and allows to create
partner for each of them when sending a message from the chatter.

The mixin is added on the mail recors that can be created from mail.alias:

document
helpdesk.ticket
mrp.eco
quality.alert
hr.applicant
crm.lead
project.task
mail.channel
maintenance.equipment

Task: 1925001
2019-03-28 09:34:11 +00:00
Christophe Simonis 8c29df10e0 [MERGE] forward port branch saas-12.1 up to 93d736e905 2019-02-11 17:00:35 +01:00
Christophe Simonis 87924cb5ad [MERGE] forward port branch 12.0 up to a46138cb01 2019-02-07 13:14:02 +01:00
Lucas Perais (lpe) a46138cb01 [FIX] mail: create partner from template in right company
Before this commit, when creating a partner automatically when creating
a message with a template, the company on the partner was wrongly set

After this commit, we try to retrieve the company from the model on the template

OPW 1934392

closes odoo/odoo#30893
2019-02-06 16:48:23 +00:00
Thibault Delavallée b8197ff178 [REF] various: update tracking parameters
Purpose is to clean the use of tracking parameters on fields. Parameters are
merged and is now tracking=<int> or tracking=True.

This commit is linked to task ID 1903814 and PR #28430.
2019-01-04 11:46:14 +00:00
TWA e61286ecd4 [IMP] mail: Return a browse record in _track_subtype instead of xmlid
Purpose
=======

It's possible to gain some requests with returning a browse record instead of
an xmlid. It's also cleaner.
2018-10-18 13:07:30 +00:00
Nimesh Jethva 427ba08e0d [IMP]various: Improvement in model description
Purpose of this commit is to give description more "business oriented"
because those descriptions appears in Odoo Studio which is supposed to be used by end users, not only by developers.

Related Task ID : 37311
2018-09-21 11:45:15 +02:00
XavierDo 2831fa7926 [IMP] core, test_mail: improve query count assertions
-remove margin
With the spirit of making tests determinists,
we can remove margins to have a real test of query count.

-mock random on assert query count
bus gc is triggered using random. Therefore, when send_many is called,
we have 1% chance to have more query. Mocking random.random to 1
will disable gc during query count tests (not during warmup).
Could be interresting to put gc collection in a cron latter

-add more info on querycount
Adding file and line number on query count failure/info will help to update
the query counts.

-update query count based on enterprise
Update all query count with enterprise values (exactly)

-normalize query counts with enterprise
voip module add a read on activity type (during create) in enterprise,
leading to one more query but also more information in cache.
Therefore, the next assertion will need one more query to access this data
in community.
Adding an access to activity type in the first assertion will allow
to have the same cache state in community and enterprise.

Task: #1878588
PR: #26476
2018-08-21 16:56:54 +02:00
Thibault Delavallée 964f2dc046 [IMP] test_mail: add an active field on activity test model
It will allow to test behavior of activities with archived records in mind.
2018-08-01 10:19:57 +02:00
lejeune quentin ec35eca7c6 [IMP] mail : Add possiblities to sequence tracking fields in the chatter
Fields in the chatter can be organized with a business logic.
Here fields for CRM and Website E-commerce have a tracking sequence.
For other fields/module just add "track_sequence=x" on model
2018-07-25 15:41:30 +02:00
Thibault Delavallée 60b81e00b2 [IMP] mail: add tool methods to manage activities directly from the mixin
This commit adds tools methods related to activities in the mail.activity
mixin. It gives to models inheriting from the activity mixin an easy-to-use
API to schedule, unlink or mark activities as done. Purpose of those methods
is to avoid having people manually managing activities in the code to hide
the technical details of the activities model, notably access rights
or activity types.

A field is added on activity model to indicate they have been generated
automatically. This way when rescheduling or unlinking based on some
specific activity types we do not change user-created activities.

Those methods include scheduling activities, changing their dates, marking
them as done or unlinking them. Future commits will use those methods
in various addons to automatically generate activities based on workflow
we want to implement.

This commit also adds tests for the newly added code. Future commits should
probably have a look at activity security and add some tests cases to check
it is correctly taken into account. It is considered a bit out of scope for
this task.

Thanks to @jem-odoo for its in-depth review of this commit. Well thanks for
other commits also.
2018-03-27 15:00:46 +02:00
Thibault Delavallée cde06d5f5c [IMP] test_mail: move some data into demo and update tests accordingly
Creating data directly in tests was done when tests were located in mail
module to avoid creating real data or demo. Now that mail tests have their
own module we can create demo data and use them in tests. It is simpler to
have demo data for things like subtype and email templates to ease
understanding and reuse.
2017-12-12 15:46:37 +01:00
Thibault Delavallée d040bfde89 [MOV] (test_)mail: move tests into their dedicated module
Purpose: avoid having useless tables for test models in a
production environment.
2017-11-29 10:11:15 +01:00
Thibault Delavallée 1cc1ef5058 [SPLIT] test_performance: split between base and mail performance tests
Test performance will now hold the base class for performance tests as
well as tests related to the ORM, depending only on base. A new module
test_mail is introduced at this commit that contains performance tests
related to mail module. This commit contains only code move and should
not impact anything.

Future commits will move mail tests into test_mail so that all mail
related tests are located in the same optional module. This allows
notably to avoid creating a lot of unnecessary tables when installing
mail module on production databases.
2017-11-29 10:05:01 +01:00