Commit Graph
10450 Commits
Author SHA1 Message Date
std-odoo 97ca45e4f3 [IMP] mail, mass_mailing: store the bounce email and allow the user to read it
Purpose
=======
The bounce emails aren't stored in Odoo, which can complicate the
debugging of the email sending.

Now, we store this bounce email, and we allow the user to read it from
the interface, so he can easily find the issue when an email sending
fail.

Specifications
==============
The bounce email is stored on the mail notification for standard emails
sending, and on the mailing traces when using mass mailing.

For some email providers (e.g. Yahoo), the "Final-Recipient" header is
not present. Normally, it allows us to retrieve the original recipient
of the email which bounced and then the partner. So if this header is
not there in a bounce email, we take the first recipient of the parent
<mail.message>.

Change the way that we parse the email body, for the bounce email.
For most email providers, the first mail body is the one that contains
the error and the next one contains the parent email body. So, the
current logic might ignore this body for Outlook and Yahoo.

Task-2116296

closes odoo/odoo#105923

Related: odoo/enterprise#34051
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-03-06 17:47:29 +01:00
FrancoisGe 17a24020ac [REF] *: do not use activeFields in Field components
This commit is to replace all uses of activeFields in Field components
by passing fieldInfos to extractProps. We will therefore retrieve the
node-dependent information in the extractProps function.

Why?
This ensures that the info used is that of the correct node. Because the
activeFields function contains the information from the last node that
referred to the same field.

Example:
<tree>
    <field name="a"/>
    <field name="a" context='{'b':"yop"}'/>
</tree>

For the first field:
    FieldInfo.context = {}
    activeField.context = {'b':"yop"}

For the second field:
    FieldInfo.context =  {'b':"yop"}
    activeField.context = {'b':"yop"}

Part of task: 3179751

closes odoo/odoo#113874

Related: odoo/enterprise#37621
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-06 15:18:48 +01:00
FrancoisGe 263066cbef [REF] *: rename fieldsToFetch to relatedFields
We take advantage of the change of api made in commit
145540921f to rename FieldsToFetch to
relatedFields.These two commits are in the same version of odoo (16.2).

FieldsToFetch is not a good name for defining the fields to be fetch for
relational fields. So we decided to rename it to relatedFields.

Part of Task: 3179751

closes odoo/odoo#113963

Related: odoo/enterprise#37651
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-06 13:13:05 +01:00
Raphael Collet 6ef3772847 [IMP] *: optimize code with search_fetch() and fetch()
closes odoo/odoo#112126

Related: odoo/enterprise#36782
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-03-05 15:12:57 +01:00
Raphael Collet 44d336128d [FIX] mail: overrides of _search()
This is about the overrides of _search() on models mail.activity and
mail.message, which both make extra queries to implement their specific
access rights.  We combine both queries made in _search() to retrieve
accessible records.  This simply uses the API of the Query object to
retrieve the data that is necessary to restrict access to messages.

Move security check outside of _message_format() for performance.  The
call to check_access_rule() inside _message_format() was redundant in
many cases and generated more SQL queries than necessary.

Also for performance, accessing fields from records should not actually
check permission.  That's a bit freaky, but this reproduces the former
behavior of mail.message.

And finally, make method check_access_rule() on mail.message check
ir.rules, in order to make it consistent with method _search().

Part-of: odoo/odoo#112126
2023-03-05 15:12:56 +01:00
Raphael Collet 46c23fd64d [IMP] *: _search() always returns a Query
Goal: make _search() always return a Query object, in order to make
search_read() in a single query when possible

Adapt the overrides of _search() towards the given goal.

Part-of: odoo/odoo#112126
2023-03-05 15:12:55 +01:00
Raphael Collet 136eb34f07 [IMP] core: _search() no longer uses a default order
This simplifies the use of subqueries by avoiding some costly default
order on the model or the idiotic order='id'.  Method _flush_search()
has been adapted accordingly.

Part-of: odoo/odoo#112126
2023-03-05 15:12:54 +01:00
Raphael Collet 7e6cff5479 [IMP] core: search() and _search() no longer have parameter count
The parameter in search() is redundant with method search_count(), and
was making the calls less readable.

The method _search() is aimed at always returning a Query object.  The
method can therefore never return an integer, hence the removal of the
parameter.  This does not actually remove any functionality from the
method; counting result is simply given by using it differently.

Part-of: odoo/odoo#112126
2023-03-05 15:12:54 +01:00
Thanh Dodeur b63f407c42 [FIX] mail: log peerConnection stats during recovery attempts
closes odoo/odoo#114185

X-original-commit: 7293541edf370e26786603e0c74b10343bb8f764
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-03-02 17:13:42 +01:00
Alexandre Kühn 76d339a266 [FIX] mail: upload file on draft record
When uploading a file on a draft record, it crashed.
This happens because the file upload was applied on record
while still in "draft".
This fixes the issue by awaiting chatter is saved, to proceed
with the file uploading.

opw-3204555

closes odoo/odoo#114106

X-original-commit: 45bcd91026b93997e7ba2509c5c4176db269c3c6
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-03-02 16:01:14 +01:00
Pierre-Yves Dufays ffd976cc69 [IMP] {test_}mail: make some improvements to the code, no functional changes
Some code cleanup done when moving the main attachment into its own mixin:
- improved docstring
- early returns
- code simplification
No functional changes should occur with this commit.

Task-2648976

Part-of: odoo/odoo#110734
2023-03-02 12:32:11 +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 f8c7f2e5bb [MOV] mail: move main attachment feature to mixin
Main attachment is quite costly and as it is implemented in mail.thread, is
present in most model. In order to improve performance, we remove it here from
mail.thread and add it, through a new mixin, only on models that actually use
that feature.

Technical note: with the current implementation, even if the font-end view
expect the model to implement the main attachment feature and the model
doesn't, it doesn't crash. Indeed, the main attachment on the front-end is only
used to know the first image to display in the image 'carousel' on the right
(widget rendered through the presence of the class o_attachment_preview). And
as 'register_as_main_attachment' of ir.attachment doesn't crash even if the
model doesn't support main attachment feature, the only consequence is that the
first image to display is not persisted (if you refresh after changing the main
attachment, it will get back to the previous one).

Task-2648976

Part-of: odoo/odoo#110734
2023-03-02 12:32:10 +01:00
Bruno BoiandMathieu Duckerts-Antoine 8a39822aa5 [IMP] mail: add Avatar component
We introduce a new component Avatar whose role is to allow an easy
display of an image and a display name for a user (or emplyee, ...).
A click on the image opens a chat window allowing to chat with that user.

Part-of: odoo/odoo#112756
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-02-28 20:38:50 +01:00
Thanh Dodeur 6ed01e9412 [FIX] mail: makes sound effects more resilient to race conditions
Before this commit, there were cases were play() could be called after
stop().

opw-3178875

closes odoo/odoo#113802

X-original-commit: 4aac721eedfa220057e1e5e9f4d10c129c1b64cb
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-02-27 21:30:49 +01:00
Abdelouahab (abla) 0d1a074854 [FIX] mail: uncheck recipient without partner
To reproduce
============
- on website add or edit **contact us** form to create a task on a project
- fill the form from Incognito
- on project -> the created task : try to send message on chatter
- you will find the email used when filling the form with possibilty
to check it as receiver
- check the box, a dialog will open to create a Partner for this email
- close the dialog without modifying anything

Problem
=======
the checkbox will remain checked, but when you send a message no email will be sent

Solution
========
as stated in this comment https://github.com/odoo/odoo/blob/de1f701e7bd7ebb6f7ebea5c097d980039c4f904/addons/mail/static/src/components/composer_suggested_recipient/composer_suggested_recipient.js#L128-L130
we will only send the message to partnenrs, so if no partner is
created we must uncheck the checkbox.

opw-3168779

closes odoo/odoo#113701

X-original-commit: 24e6a16e349e1521fadc8c18574c15389c550f0c
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: abla001 <abla@odoo.com>
2023-02-26 21:11:08 +01:00
Sébastien Geelen (sge) aa252adf4f [ADD] web,mail : new dynamicplaceholder tour
Add a tour that test the basics of the dynamic placeholder
dropdown functionality.

task-3081325

closes odoo/odoo#109326

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-02-24 16:09:45 +01:00
Sébastien Geelen (sge) eae20c47eb [REF] web,web_editor,mail : dynamicplaceholder hook
Refactor the Dynamic Placeholder hook to have better
separation of concern from the Field that need it.

task-3081325

Part-of: odoo/odoo#109326
2023-02-24 16:09:45 +01:00
Aaron Bohy 9374a6f2b7 [REF] *: js fields: extractProps receives fieldInfo
This commit is part of the preliminary work to rewrite the form,
list and kanban model. We want this new Model to only be aware of
field related information it needs (whereas in its current
implementation, the model stores all the information extracted
from the field node in the arch). This would allow to properly
manage multiple occurrences of the same field in views, that is,
each occurrence would be represented by a field component (if
visible of course), and that field component would use the field
information of the arch node it represents. To this end, we want
fields from not using anymore information stored in activeFields
in the record datapoint. Instead, we now call extractProps with
the whole fieldInfo (the information extracted from the arch), s.t.
each field can generate the props it needs from those information
(e.g. sub views for x2manys).

This commit doesn't remove the use of record.activeFields in
concrete fields (this will come later), but reworks the fieldInfo
object generated by parseFieldNode, and provide it to the calls of
extractProps. In fieldInfo, the `options` key is no longer inside
`attrs`, as it is now top-level, alongside several other generic
keys that have been processed (like on_change, modifiers...). For
that reason, a lot of extractProps definitions had to be adapted.

Part of task 3179751

closes odoo/odoo#113092

Related: odoo/enterprise#37266
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-02-24 11:11:32 +01:00
Thibault Delavallée 3121454e9d [IMP] mail: move composer 'email_add_signature' field to computed
RATIONALE

Remove _onchange_template_id / defaults usage for composer fields. It
lacks control and make value computation hard to understand and predict.

PURPOSE

Split _onchange_template_id + default_get + get_record_data usage into editable
computed stored fields. Each field should have its own method with its triggers
(template, composition mode, ...).

SPECIFICATIONS

Improve composer to correctly compute field ``email_add_signature`` in
compute method.

When having a template, consider it defines completely body and do not add
signature. Without template, add signature by default in comment due to post
processing for notification emails. Mailing mode does not handle signature.

Followup of odoo/odoo#107356

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

closes odoo/odoo#113522

Related: odoo/enterprise#37478
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-23 18:28:59 +01:00
Thibault Delavallée 1a2a8d82fe [FIX] mail: do not subscribe inactive users creating records
Inactive users should not be added in followers of records, especially using
automated subscription. Indeed they mainly generate noise in notification
process and are generally skipped.

Few use case exists of inactive users creating records. One use case is the
mailgateway running as root but a context key 'mail_create_nosubscribe' is
used to avoid it. Other use cases include automated action for example who
are also generally protected.

Anyway better be sure and consider this is a standard use case. To extend
this rationale, inactive people are currently not added when posting. It
therefore makes sense to keep this behavior coherent through the mail stack.

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

Part-of: odoo/odoo#113522
2023-02-23 18:28:59 +01:00
Thibault Delavallée b915617569 [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.

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

Part-of: odoo/odoo#113522
2023-02-23 18:28:59 +01:00
FrancoisGe 94c49cfdee [REF] *: fieldDependencies to Array
As with fieldsToFetch in commit 25bf5a3fabfa9da5367e82d1c5713425c77bc373,
we will convert fieldDependencies into an array of fields.
We did it because it's easier to use and more natural to has an array.

Part of task 3179751

closes odoo/odoo#113482

Related: odoo/enterprise#37449
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-23 16:08:42 +01:00
FrancoisGe 63aaf17392 [REF] *: remove field from args pass to extractProps
This commit aims to simplify the extractProps api by removing "field".

The Field will need to go into
this.props.record.fields[this.props.fieldname] to access the information
previously stored in the "field" parameter.

Part of Task: 3179751

closes odoo/odoo#113214

Related: odoo/enterprise#37469
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-23 14:54:11 +01:00
Pierre-Yves Dufays 3f413ca3da [FIX] mail: fix incorrect view form for partner auto creation
This fixes the problem of the full res_partner form being displayed instead of
the simplified one in some cases (and vice-versa).

The problem can be reproduced by the following steps:
- launch odoo without xml dev_mode enabled (otherwise the cache is disabled)
- in helpdesk, go to an existing ticket and click on an existing customer (this
will load the full form for the customer into cache)
- create a new ticket by first completing name and customer name, save it
- complete the email address, save it
- go to "Send message" and click on the email checkbox
- the full form is loaded instead of the simplified one
(base.view_partner_simple_form)

It is also possible to get the simple form instead of the full form by
reversing the order of the visited forms.

Technical note: The problem has been fixed by adding the context key
"force_email" as cache key using _get_view_cache_key override. Indeed,
_get_view_cache uses _get_view which result depends on that context variable in
its redefinition in res_partner.

Task-3024050

Part-of: odoo/odoo#105111
2023-02-23 14:53:57 +01:00
Pierre-Yves Dufays 69011e329c [IMP] mail: avoid displaying twice the email in the composer recipients
When the contact name was not yet set, the email was displayed twice in the
composer: first as the contact name and then as the email in parentheses. Now
when the contact is the same as the email, nothing is displayed in parentheses.

Technical note: the regexp in the mail util parseEmail method has been slightly
modified because it was returning in some cases the name surrounded by quotes
(ex.: "newlead3@ex.com" <newlead3@ex.com> --> name: "newlead3@ex.com"). This is
no longer the case with this change. That change was needed for comparing the
name and the email to avoid to display the same thing twice (when the email and
the name are the same). Note that the method is only used once, where we have
done the change.

Task-3024050

Part-of: odoo/odoo#105111
2023-02-23 14:53:57 +01:00
Pierre-Yves Dufays 31811ba89f [IMP] base, crm, mail: prefill partner creation form with current record data
Selecting a recipient for which there exists no partner trigger a partner form
dialog creation. For some model (ex.: crm.lead), some default values can be
prefilled from the current record. This is what we do here by calling a generic
mechanism that allows each model to define default value for related partner.

Note that we don't provide a more detailed form to the user because some will
otherwise feel obligated to fill it out entirely.

Technical note: As there is no need for a custom form per model from which the
data are extracted to populate the related partner, the simplified partner form
(view_partner_simple_form) is just augmented with additional invisible field by
modules that add fields to partner and need to populate them automatically from
values of another model.

Technical note: In TestCRMLead.test_message_recipient_partner_auto_creation, we
test that the _message_get_suggested_recipients returns the correct default
values to copy some fields from the lead to the partner to avoid the user to
reenter them. But we don't test specifically that it also work when using mail
composer and template (which generate the partner) because it has already been
tested when introducing the mechanism. Although, we verify that it should
behave the same because we verify that the default values returned by
_get_customer_information, that is used in mail template when using the
composer, are the same as the ones returned by _message_get_suggested_recipients
which is tested here.

Task-3024050

Part-of: odoo/odoo#105111
2023-02-23 14:53:56 +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
Aaron Bohy f87dd9ed0d [FIX] web,mail: tooltip service: correctly apply default delay
The delay of tooltips opened with the tooltip service can be given
in xml, with attribute data-tooltip-delay. If not specified, there
is a fallback in the service to 400ms. Before this commit, the
fallback wasn't correctly applied, because we parsed the xml delay
into an integer, which was NaN when the delay wasn't specified,
and as NaN isn't undefined, the fallback wasn't applied. As a
consequence, we opened the tooltip in a setTimeout with NaN as
delay, and it thus opened directly.

closes odoo/odoo#113425

X-original-commit: 553b2775a4b31c75d1d246816b749e4521e25726
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-02-22 21:37:33 +01:00
tsm-odoo 36aa579ed8 [FIX] mail: fix is_typing timeout after closing the channel
This PR fixes an error that occured when a typing timeout callback was called
after closing the channel.

Steps to reproduce the issue:
- Open a channel in the Discuss app.
- Type some text in the composer.
- Close the channel.
- Wait 5 seconds.
- The following traceback appears.

```
UncaughtPromiseError > TypeError
Uncaught Promise > undefined is not iterable (cannot read property Symbol(Symbol.iterator))
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at ModelField._convertX2ManyValue (http://localhost:8069/web/assets/debug/web.assets_backend.js:130149:28) (/mail/static/src/model/model_field.js:499)
    at ModelField._setRelationUnlinkX2Many (http://localhost:8069/web/assets/debug/web.assets_backend.js:130445:38) (/mail/static/src/model/model_field.js:795)
    at ModelField._setRelationUnlink (http://localhost:8069/web/assets/debug/web.assets_backend.js:130425:29) (/mail/static/src/model/model_field.js:775)
    at ModelField.parseAndExecuteCommands (http://localhost:8069/web/assets/debug/web.assets_backend.js:130086:34) (/mail/static/src/model/model_field.js:436)
    at ModelManager._update (http://localhost:8069/web/assets/debug/web.assets_backend.js:132561:24) (/mail/static/src/model/model_manager.js:1304)
    at ModelManager.update (http://localhost:8069/web/assets/debug/web.assets_backend.js:131589:26) (/mail/static/src/model/model_manager.js:332)
    at model.update (http://localhost:8069/web/assets/debug/web.assets_backend.js:133012:31) (/mail/static/src/core_models/record.js:139)
    at model.unregisterCurrentPartnerIsTyping (http://localhost:8069/web/assets/debug/web.assets_backend.js:157479:18) (/mail/static/src/models/thread.js:941)
    at model.onCurrentPartnerInactiveTypingTimeout (http://localhost:8069/web/assets/debug/web.assets_backend.js:157593:18) (/mail/static/src/models/thread.js:1055)
    at model.onTimeout (http://localhost:8069/web/assets/debug/web.assets_backend.js:160569:69) (/mail/static/src/models/timer.js:34)
```

closes odoo/odoo#113424

X-original-commit: 3a586c2a20de2a8208f7b3d55086bf86dda92577
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-02-22 21:37:30 +01:00
tsm-odoo 8fad8e6a26 [FIX] mail: new messages not showing for unknown channel types
Before this PR, messages received on channels with unknown channel
types weren't displayed on discuss. This was due to the fact that
the sidebar computed its items based on the channel type.

Steps to reproduce this issue:
- Open one browser as mitchell admin (on the Discuss app).
- Open one browser as marc demo (on the Discuss app).
- Send a message from admin to demo.
- Unpin the channel on the admin browser.
- Refresh admin browser.
- Send a message from demo to admin.
- The message is not received on the admin browser.

This PR fixes the issue by fetching channel data if the channel type
is missing when receiving a new message.

closes odoo/odoo#113377

X-original-commit: 3398aa8b10a1d9ad75552871e532f57ffcdd4a7f
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2023-02-22 15:39:04 +01:00
Jorge Pinna Puissant aed1ba484d [REF] web, * : simplify concrete fields API - remove type prop
This commit, is part of a series of commits that aim to simplifie
the concrete fields API.

In this commit we will remove type prop from concrete fields. Now each
field could directly use this.props.record.fields[this.props.name].type
if they need to know the type of field.

task-id 3179751

closes odoo/odoo#112792

Related: odoo/enterprise#37118
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-22 13:46:29 +01:00
Jorge Pinna Puissant 8cde3e84bb [REF] web, * : simplify concrete fields API - remove update prop
This commit, is part of a series of commits that aim to simplifie
the concrete fields API.

In this commit we will remove update prop from concrete fields. Now each
field will directly use this.props.record.update to make changes, and
handle the save in fields that need to (e.g. priority). As a consequence
of this, the record props need to be mandatory.

task-id 3179751

Part-of: odoo/odoo#112792
2023-02-22 13:46:19 +01:00
Didier (did) ba2d6b9daa [FIX] mail: fix traceback when deleting a link preview
This PR fix a traceback that occur when pressing spacebar while the confirm
dialog for deleting a link preview is open.

task-3196494

closes odoo/odoo#113274

X-original-commit: d46a5171378497992bd65634f1aded53db27e9ef
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-02-21 21:07:51 +01:00
Thibault Francois b4a60cfcc5 [FIX] mail,phone_validation: blacklist email prior deactivation
Before this commit, the email added to the blacklist was the value
of the email after the deactivation of the user.

It may lead to blacklist the wrong email when the deactivation change the
email

after this commit, like phone number, we keep the value of the email
prior the deactivation which the real email to blacklist

closes odoo/odoo#113187

X-original-commit: db85db81df57da87c57171fa2d5009eb097f2903
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-21 11:25:45 +01:00
Mathieu Duckerts-Antoine 94c2db94e0 [FIX] *: adapt code related to orm service create
The previous commit has as a side effect to change the value returned by
the create method of the orm service. Here we adapt the code that uses it
and make the test pass.

Part-of: odoo/odoo#111965
2023-02-20 19:25:00 +01:00
Thibault Delavallée 2075dd0848 [FIX] mail: fix language fetch when sending notification
When using the composer in batch and comment mode, the first record of the
batch was used to find the language for notifications instead of the one
linked to the message.

Previously to odoo/odoo#99482 batch comment mode was not supported and there
were always only a singleton as record ids. Now that it is supported we have
to be more careful when dealing with IDs.

To solve this issue we check the message res_id which effectively contains
the correct record ID.

Oversight of odoo/odoo#99482

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

closes odoo/odoo#113015

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-17 22:02:35 +01:00
Xavier BOL (xbo) 1c3448ba70 [FIX] mail: use the right component for kanban many2many_avatar_user
Before this commit, since the commit [1] changing the field registry,
the component used for the `kanban.many2many_avatar_user` widget is not
right one.

This commit fixes the issue by setting the right component for the
widget.

[1] 9f4622492c

closes odoo/odoo#112925

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-16 19:00:04 +01:00
Michael (mcm) 9f4622492c [REF] *: register field descriptors instead of components
Before this commit, the field's description was stored on the
component and this component was then registered.

Now, an object describing the field is used on registration the same way
as it is done for views since https://github.com/odoo/odoo/commit/b828cfc72c587d0b73fcc5459695705640437671.
This split the component's description (props, template, ...) of
the field's description (displayName, supportedTypes, ...) and makes
it clearer.

closes odoo/odoo#112498

Task: 3171520
Related: odoo/enterprise#37105
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-16 14:13:32 +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
Aaron Bohy 145540921f [REF] web,mail: handle "color_field" option in M2MTagsField
Before this commit, there was a hack done in Field.js to handle
a special case of the Many2ManyTagsField which sometimes require
an additional "color" field to be fetched. This field is given in
option on the many2many field, in the arch.

It wasn't possible for the Many2ManyTags field to add that field
on its "FieldToFetch", because this object was static (it didn't
depend on the arch). This commit allows it to do so as FieldsToFetch
can now be a function that receives the fieldInfo (extracted from
the arch) in arguments.

So with this commit, fieldsToFetch can be either an array of fields
(instead of an object as before), or a function returning an array
of fields.

Part of task 3179751

closes odoo/odoo#112518

Related: odoo/enterprise#37020
Signed-off-by: Georis François (fge) <fge@odoo.com>
2023-02-14 17:09:29 +01:00
FrancoisGe 45ef57bedc [REF] web: convert Record.formattedRecord to utils
To evaluate the KanbanRecord and the ActivityRecord, a formattedRecord is passed.

What is a formattedRecord:

Before this commit:
The base record + all its fields with the keys value and raw_value.
formattedRecord = {
    ...Record(),
    field1: {
        value: ...,
        raw_value: ...,
    }
}

After this commit:
All its fields with the value and raw_value keys.
formattedRecord = {
    field1: {
        value: ...,
        raw_value: ...,
    }
}

This modification avoids giving access to the functionality of the Record
class directly in the arch. The arch should never have access to the
internals of the Record.

closes odoo/odoo#112618

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-14 14:37:51 +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
std-odoo e75ea7db53 [FIX] mail: for the complexity of the mail message unlink method
Bug
===
When we remove some mail messages, we invalidate the cache of the
related documents. But in the same loop we call _invalidate_documents
which invalidate the cache, and so at the next iteration we will need
to make a new SQL query to know if the message is a "thread message".

So because of the prefetch ids, and because we invalidate in the loop,
if we unlink 1000 message, we will make 1000 SQL queries to fetch the
fields values of the 1000 messages.

Note that the unlink method will invalidate the entire cache anyway,
so unlike the write / create methods, we shouldn't need to invalidate
manually the related documents.

Task-3171093

closes odoo/odoo#112494

X-original-commit: f8958e9bbd4c7c37f614b20f7ed4d4825d438362
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2023-02-13 14:05:18 +01:00
Aaron Bohy 49297bc7bb [REM] *: remove legacy basic views + some fields/widgets
This commit removes the legacy implementation of the form, kanban
and list views. It also removes the legacy view widget registry,
and all legacy widgets it contained. The legacy field registry
couldn't be removed yet as some fields are still used (e.g. in
client actions: FieldMany2One, FieldMany2ManyTags...), and
sometimes accessed from that registry (e.g. uom service). More
clean up will come later. Note that all tests using legacy views
have thus been removed, even though the tested feature might still
remain (e.g. FieldMany2One tests have been removed, but that field
is still there). However, those features are deprecated and
unlikely to evolve. They should be removed in the next saas, or the
one after.

Finally, this commit also removes the legacy view dialogs.

Task 3168640

Part-of: odoo/odoo#111809
2023-02-08 13:27:58 +01:00
Adrien Minne (adrm) 329fc12c89 [FIX] mail: fix y overflow in chatter
For some font families, there was an y overflow and a scrollbar in the
chatter when inserting an @mention. This was because the font height +
the padding of `a.o_mail_redirect` was greater than the line height.

Added an `overflow-y: hidden;` in the css to fix the issue.

closes odoo/odoo#112153

X-original-commit: 3a40fa55919b5a4befc93beaf212521b61f15085
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-02-07 19:53:01 +01:00
Sergey Shebanin fadcc369ad [IMP] mail: define title for full composer
Before this commit title for full composer dialog window is "Odoo".
It increases probability of mistake for user because it doesn't clear
that user do: sending email or logging note.

After this commit title matches dialog purpose.

closes odoo/odoo#112111

X-original-commit: c29dc28534f03ccec2e390c44b16525ee45a6b3b
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-02-07 16:38:39 +01:00
Alexandre Kühn 21d090bf04 [FIX] mail, im_livechat: open profile on click livechat correspondent
Before this commit, clicking on message author opens chat with
author, including in a livechat conversation.

This feature is not useful in livechat, as there's already a
way to communicate with the visitor. In earlier versions,
click on author opens profile, which is quite useful.

This commit puts back this feature of opening profile from
author click in livechat.

closes odoo/odoo#111799

X-original-commit: 2b43fb452c28554d5b3659e8531ad4de11686153
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-02-03 11:45:46 +01:00
Kartik Chavda c59ec25c87 [IMP] mail,project: hide label of many2many user avatar for activity
This commit hides name of user from many2many avatar user of
activity view similar as kanban view so it'll display many2many
tags properly in activity view.

task-3132890

closes odoo/odoo#109855

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-02-03 05:08:51 +01:00