Commit Graph
11102 Commits
Author SHA1 Message Date
Alexandre Kühn fec00da16e [FIX] mail: only prevent odoobot new messages during onboarding
Before this commit, new messages from odoobot were never opening
a chat window automatically.

This is desirable only during the onboarding process of the user,
when first logging-in, as to not bully the new user. It is not
intended to prevent all new messages from odoobot.

This commit fixes the issue by only preventing auto-opening of
chat window of odoobot for the 1st step of the onboarding process.

closes odoo/odoo#132689

Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-08-23 18:55:17 +02:00
Sébastien Theys a7485e53d6 [REF] mail, *: clean click and contains API
* = test_mail, hr, im_livechat

- Allow only selectors
- Add `value` check to `contains`
- Remove return from `click`

closes odoo/odoo#132799

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-23 17:40:07 +02:00
Sébastien Theys be199cd923 [REF] mail: remove unused afterEvent
Remaining of last refactoring.

Part-of: odoo/odoo#132799
2023-08-23 17:40:06 +02:00
Thibault Delavallée a4fe51cb2e [MOV] base, mail: move mail config parameters usage to mail
RATIONALE

As multi-company tolerant alias domains will soon replace the usage of
configuration parameters, having them in base then replaced by more advanced
models in mail would be complicated to handle and not useful. Move those
ICP to 'mail' so that all mail configuration is done in that module.

SPECIFICATIONS

Move config parameter used for alias domains configuration in 'mail' module.
Base should be as simple as possible and let mail deal with mail server
complexity.

Move 'mail.{bounce/catchall}.alias' used with 'mail.alias.domain' to make
bounce and catchall emails. Move 'mail.default.from' as it will be integrated
into alias domains in some form.

Note that 'mail.default.from_filter' stays as an ICP in base as it is a
more global default parameter. It is used as default value in 'connect' when
no mail_server is used and no from_filter can be retrieved.

Some tests in 'base' are either fixed, either moved directly into 'mail'.
We now differentiate base behavior (without ICP) from configurable behavior
(with ICP in mail).

Task-3453347 (Mail: Move Mail ICP from Base to Mail)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#130750
2023-08-22 20:58:54 +02:00
Thibault Delavallée 17e5bbb38b [IMP] base, mail: improve and add tests about ir mail server
Prepares the move of ICP to mail before replacing them by dynamic alias
domains. Improve test coverage, notably for edge cases. Continue to make
tests more explicit after odoo/odoo#131492. Some tests are also merged to
lessen number of different tests when possible, notably when only a test
parameter differs (like giving an SMTP session or not).

Clean ICP and mail servers setup in test classes allowing to remove some
unnecessary extra initialization. Cleanup a mock in mail.

Task-3453347 (Mail: Move Mail ICP from Base to Mail)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#130750
2023-08-22 20:58:50 +02:00
Sébastien Theys ed7621d726 [REF] mail, *: remove unnecessary makeFakeNotificationService
* = hr, im_livechat

The real service works just as well, gives more guarantee on what is
actually tested, and requires less lines of code.

closes odoo/odoo#132744

Related: odoo/enterprise#46108
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-22 20:01:17 +02:00
Didier (did) 479ba79182 [IMP] mail: fix contains typing to avoid lint error
closes odoo/odoo#132632

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-22 20:00:24 +02:00
Didier (did) 1d14df47da [IMP] mail: add possible value of thread.type
closes odoo/odoo#132485

Signed-off-by: Didier Debondt (did) <did@odoo.com>
2023-08-22 18:59:32 +02:00
Didier (did) f30588273c [IMP] display typing status inside ImStatus
task-2282361

closes odoo/odoo#131518

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-22 18:59:14 +02:00
Xavier Bol (xbo) b88cdfe4d9 [FIX] mail: add missing function evaluateBooleanExpr in activity record
Before this commit, when the user tries to access to activity view,
a traceback is occurred because `ctx.__comp__.evaluateBooleanExpr`
is not a function used inside the template of `ActivityRecord`.
That function is in fact used in the view compiler but the
ActivityRecord component does not have that function defined.

This commit defines that function in `ActivityRecord` component to
correctly compile its template.

Steps to reproduce:
------------------
1. Install Project
2. Go to Project > Tasks > My Tasks
3. Select the activity view of `project.task`

Actual behavior:
---------------
A traceback is occurred saying `ctx.__comp__.evaluateBooleanExpr`
is not a function.

Expected behavior:
-----------------
The activity view should be loaded as before.

closes odoo/odoo#132610

Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-22 16:09:07 +02:00
Sébastien Theys d08a18b791 [IMP] mail, *: tests: use contains in click and insertText
* = account, calendar, im_livechat, mrp, project_todo, sms, snailmail,
    test_mail, web, website_livechat

`contains` is more efficient than `afterNextRender` as it does not wait
for several extra animation frames, and it is functionally more
meaningful.

closes odoo/odoo#130451

Related: odoo/enterprise#44999
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-21 21:00:03 +02:00
Sébastien Theys 9a1efcbde7 [REF] mail, im_livechat, mrp: rename waitUntil to contains
`await contains` is shorter and reads better than `await waitUntil`.

Part-of: odoo/odoo#130451
2023-08-21 21:00:02 +02:00
Sébastien Theys 3f8544d906 [IMP] mail, im_livechat: tests: add assert to waitUntil
`QUnit` tests require at least one `assert`. This change allows to write
tests that only contain `waitUntil` without extra `assert` in the test.

`waitUntil` is more efficient than `afterNextRender` as it does not wait
for several extra animation frames, and it is functionally more
meaningful.

Currently existing tests that contain `waitUntil` have been adapted
accordingly. More and more tests should make use of it in the future.

Part-of: odoo/odoo#130451
2023-08-21 21:00:00 +02:00
Alexandre Kühn 92d9b6d779 [FIX] mail: show chatter attachment loading after 1 second
Before this commit, when chatter data were fetched, it shows
spinner icon on attachments immediately until data are fetched.

This RPC is quite fast, so it's annoying to see spinner and then
no spinner whenever chatter is reloaded. This is even more
bothersome when most chatters have no attachments and some followers,
which gives the illusion loading affects followers rather than
attachments, as the spinner takes place of attachment counter that
is empty when no attachment.

This commit fixes the issue by having a 1 second delay for showing
the loading icon next to attachment. This prevents most flickers
when RPC is fast, while keeping it relevant when it's slow so it's
clear data are still loading.

Task-3356922

closes odoo/odoo#132463

X-original-commit: 96b00d25becdf2253975d1b427c30ee287cda98f
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-20 18:19:59 +02:00
Loan (LSE) e403eec89b [FIX] mail: "Invalid Date" errors on iOS Safari
Before this commit:
JS errors on iOS with Safari's browser due to the date syntax not being
supported:
```js
new Date("2023-08-18 14:02:53")
-> Invalid Date
```
This does prevent Odoo's backend to start up on the browser and the app
on iOS devices.

opw-3465337

closes odoo/odoo#132461

X-original-commit: a39391d0df644fce86f435ba3f39e7634d8e5172
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-20 16:35:51 +02:00
lrizzi1 698e14a003 [FIX] mail: closing hidden chat window should not crash
Before this commit, closing a hidden chat window may crash.

This happens because closing a chat window was always treated as the
closing of a visible chat window, which should make the 1st hidden
chat window visible, if any. This code should not be called when
closing a hidden chat window, otherwise unexpected behaviour are
to be expected, e.g. closing 2nd hidden chat window swaps last visible
with 1st hidden chat window, or even a crash.

This commit makes sure auto-swapping of 1st hidden chat window only
occurs when closing a visible chat window.

opw-3460466

closes odoo/odoo#132458

X-original-commit: b49364b687757385a2a7356d17dc428edafd2767
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-20 14:43:56 +02:00
Hugo Carlier (Huca) ab809baca1 [FIX] *mail, mass_mailing_sms: take domain into account for activity
This commit allows to take domain into account for custom activity
groups in the systray.

Steps
=====
In debug mode:
- Install module mass_mailing_sms
- Add an activity for a mailing.mailing record with mailing_type set to
'sms' (i.e. a record visible in the SMS Marketing app).
- Add an activity for a mailing.mailing record with mailing_type !=
'sms' (i.e. a record visible in the Email Marketing app).
- Open the activity menu

Not in debug mode:
- Do the same step as above
- Click on the category "SMS Marketing" in the activity menu

Issue
=====
- In debug mode: a traceback will pop up when the activity menu is
opened with an error message similar to `Got duplicate key in t-foreach:
1182`.
- Not in debug mode: when clicking on the SMS Marketing category in the
activity menu, all records of model mailing.mailing with activities set
will be displayed and not only the one with mailing_type set to 'sms'.

Cause
=====
- In the method systray_get_activities, the id of each model is used to
create groups of activities. In mass_mailing_sms, the same logic is used
but two groups are created for the model mailing.mailing, thus with the
same id. This create a traceback in debug mode when displaying the
activity menu are the id of the groups are used as key for a foreach in
the view template.

- The methods openActivityGroup and onClickAction called when the user
click on an activity group (or on the activity icon next to it) do not
take the domain of the group into account correctly.

Fix
===
- The id key of activity groups is renamed in sequence
- The value of sequence is only used to sort activity groups on the
client side
- group_index is used as t-key value in the template of the activity
menu
- The domain of each group (if any) is combined with the domains used in
openActivityGroup and onClickAction

closes odoo/odoo#132402

X-original-commit: 1f154b4ba21e34c9021f07c5e62d8de460eb824e
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-08-19 12:02:38 +02:00
Alexandre Kühn 941e28cee1 [FIX] mail: show seconds in message datetime
Before this commit, when mouse hovering on relative time of the
message, it showed the datetime without the seconds.

Not showing the seconds can make it hard to determine chronological
order of 2 messages in different conversations.

This commit fixes the issue by showing the seconds in datetime format
of message when mouse hovering on relative datetime part.

opw-3423016

closes odoo/odoo#132376

X-original-commit: b0019f5b92b9cebab9f1162631cbf00be5101b6f
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-19 12:02:15 +02:00
Antoine Guenet cd527b9394 [FIX] mail: replace local url of background image with single quotes
Relative image urls have to be replaced with absolute urls in order to
be able to display them in the email. This failed to be done for urls in
styles attributes if they were enclosed in (unicode decimal) single
quotes.

opw-3452655

closes odoo/odoo#132339

X-original-commit: d952e0117a68dd19e86c45ae75250807231e82ad
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-19 12:01:52 +02:00
tsm-odoo 01fa22e0c9 [FIX] mail, *: fix suggestions after search/fetch returned no result
*: im_livechat.

Before this commit, suggestions were not showing anymore after
search/fetch returned no results. This commit fixes the issue
by resetting the search state when nothing is found.

task-3459933/3455060

closes odoo/odoo#132264

X-original-commit: 13b3f36a0d71bb55e2ca56fd207c7dfaba23aa86
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-18 21:45:11 +02:00
Pierre Pulinckx (pipu) c07181b20b [REF] *: Replace env._t() by _t()
In this commit, all usages of env._t() are replaced by _t().
In templates files, env._t() didn't work because terms used
in attributes where not extracted into the translation files.
Only string are exported from .xml files to translation files.
So, to make it works, we set a variable that is then used
in attributes.
For example :

<t t-set="string_to_translate">String to translate</t>
<Dialog title="string_to_translate>...</Dialog>

task-3292454

closes odoo/odoo#131390

Related: odoo/enterprise#45631
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-18 19:17:16 +02:00
Raphael Collet 7a86ad8957 [IMP] tests: make Form use onchange2() instead of onchange()
Part-of: odoo/odoo#124614
2023-08-18 19:16:46 +02:00
Gorash 0d99f4b9d9 [REF] base,all: Update modifier syntax: adapt JavaScript
closes odoo/odoo#104741

Related: odoo/enterprise#35255
Related: odoo/documentation#3523
Related: odoo/upgrade#4884
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-08-18 09:49:16 +02:00
Gorash 774a3fad0e [REF] base,all: Update modifier syntax: view migration
Apply of the migration script to update all view modifiers.

Part-of: odoo/odoo#104741
2023-08-18 09:49:13 +02:00
Gorash 75a105f46a [REF] base/all: Update modifier syntax: remove 'states' from fields
These changes are made as a result of simplifying attrs and 'states' in
views. However, they should have remained in a separate commit. When
applying the script making the xml changes (used later for the migration
script), the script checked the definition of the python fields in order
to convert the information into a python expression. Therefore, this
commit is not applied when the script is applied to xml changes.

During this attribute deletion pre-existing errors were found. Part of
the code was using the boolean values of 'states' and another part of
the code was not. The behavior could therefore be different (in cases
where readonly on the field had the same value as the ballan in
'states').

Following the deletion of 'states' and without the application of the
view migration, the js tests (tower) were no longer functional. Tests
using the Form view suffered the same effect. There are few tests that
had to be adapted, including two tests in business accounting (updated
by the accounting team). A test for column_invisible did not work. Test
checking if the test system triggers an error if we try to write on an
invisible field. It turns out that Form was testing on the value of
invisible but not taking into account if the column was invisible. The
test system fix is applied separately because there were a lot of tests
that were incorrect.

Part-of: odoo/odoo#104741
2023-08-18 09:49:11 +02:00
Gorash 5419d0ef7a [REF] base,all: Update modifier syntax: clean fields keys
Part-of: odoo/odoo#104741
2023-08-18 09:49:10 +02:00
Alexandre Kühn ace1c03600 [FIX] mail: chat notification body should not have author name
Before this commit, messaging menu items of type chat show the
author name in body part. This is redundant with name of
conversation that is usually the name of the correspondent.

This commit does not show the name of the author in notification
item body when it's the same as correspondent of conversation.

closes odoo/odoo#132210

X-original-commit: 4b146aa70c721162b3741486246936af74f77f36
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-17 18:43:33 +02:00
zel-odoo a1f949c8c3 [IMP] web,mail: Discuss app commands in command palette
This commit adds some discuss-related options in the command
palette.

- hotkeys to add channel (C) & chat (D), and start a meeting (M);
- namespaces `@` or `#` show mentionned and recent conversations
  in Discuss app when search is empty;

Items show optional badge with needaction counter.

Mentions/Recent categories are only visible when there are no
search term. Indeed, `@term` searches for users while `#channel`
searches for channels, so these categories are meant to quickly
jump to recent and important conversations. When typing some
search terms, the fuzzy search has precedence over mentions/recent
criteria.

task-3330218

closes odoo/odoo#128896

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-17 14:52:03 +02:00
Xavier ALT 99d4bc5e04 [FIX] mail: correctly parse body as html for pure-html email
Some external tools send email as pure html (no multipart) and when
parsing such email we ends up having the raw HTML as body (text)

This commit ensure we correctly parse and sanitize the body as HTML
for such emails.

closes odoo/odoo#132127

Task-id: 3451889
X-original-commit: a4763d214bfc7b09510226e552f749f9cd95870e
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Xavier Alt (xal) <xal@odoo.com>
2023-08-16 21:12:52 +02:00
FrancoisGe e3da5f1b7d [REF] *: convert legacy dialogs
The goal of this commit is to convert a bunch of legacy dialogs into owl dialogs.

closes odoo/odoo#131278

Task-id: 3453920
Related: odoo/enterprise#45484
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-16 16:05:12 +02:00
Michael (mcm) 3ea0b115ca [IMP] web: remove legacy service system
This commit removes the legacy service classes:
- AbstractService
- AjaxService
- AbstractStorageService
- LocalStorageService,
- SessionStorageService
Only AjaxService was still used as a service so it is moves in the
"common_env" file.

task 3439226

closes odoo/odoo#131683

Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-16 10:24:21 +02:00
FrancoisGe 41def9680a [FIX] mail: fix debounce onchangeOnKeydownMixin
UseDebounce to avoid executing debounced code when the component
is unmounted. This prevents crashes.

closes odoo/odoo#131782

X-original-commit: c81714a3eb5825758637cacaf830b63b2e5dfdd5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2023-08-12 20:05:48 +02:00
Jorge Pinna Puissant e338487028 [REF] *: remove owl="1" from the templates
As all the templates are now imported in the owl app, there is not need
anymore to specify the owl="1" attribute in the templates.

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:30 +02:00
Julien Carion (juca) d1c6bc5d95 [FIX] mail, base: move user settings access rules
In b1e2c3453f50cc05a1b03dc1c8571a01ad7b7dd2, the `res.users.settings`
model was moved from `mail/` to `base/`, but its record rules remained
in `mail/`. This means that if `mail/` is not installed, users will be
able to access other users' `res.users.settings` records. In practice,
this is not a problem, as the only field that can exist in
`res.users.settings` without `mail/` is `homemenu_config`, which
contains nothing senstive.

This commit moves the forgotten record rules to `base/`, preventing
potential problems if new fields with sensitive information were to be
added to `res.users.settings` in the future.

Task-3461652

closes odoo/odoo#131538

X-original-commit: 5a79550c8e35ce733375c2ef7df2ea12e6added6
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-08-10 18:14:36 +02:00
Louis Wicket (wil) f1722c7334 [IMP] *: unify sprintf and gettext
Improve gettext to directly handle value injection within translations,
removing the need for sprintf.

closes odoo/odoo#123932

Related: odoo/enterprise#45370
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-10 18:14:04 +02:00
tsm-odoo 6b1581da03 [FIX] mail: padding on chatter message edit
Before this PR a huge padding was present when editing a message
on the chatter. This commit fixes the issue.

task-3458670

closes odoo/odoo#131432

X-original-commit: 332942109b0db7a96da3bd2e7f2cafe19ebb1df3
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-08-10 09:12:38 +02:00
Didier (did) 630178359d [IMP] mail: introduce mail services module
This PR cleanup service typing:

* Introduce `addons/mail/tooling/type/services.d.ts` to automatically type
services imported by `useService` hook.
* Correctly type service constructor, setup and start functions.
* Remove now useless `@type`.
* Removing `Object.assign` for services variables.
* Type OdooEnv.services to services.

closes odoo/odoo#131192

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-08-09 19:27:09 +02:00
Thibault Delavallée 638e0f658d [REF] mail, various: cleanup alias usage
Cleanup alias usage and definition. Prepare code to ease future changes and
improvements. Notably

  * add a 'alias_email' computed field on the mixin allowing to have the
    complete alias email when set, and False in case it is inactive or linked
    to an inactive alias domain;
  * remove unnecessary alias_id field definition when just the help differs
    from the standard definition coming from the 'mail.alias.mixin';
  * use fields coming from 'inherits' instead of using alias_id and its sub-
    fields; notably use 'alias_display_name' and 'alias_email' fields;
  * remove useless custom code and management;
  * improve alias parameters support code in configuration parameters;

Task-3453343 (Mail: Cleanup Alias Usage)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#130632
2023-08-09 17:04:26 +02:00
Thibault Delavallée 1af84e28ee [IMP] mail: introduce 'mail.alias.mixin.optional' with optional aliases
Some models would like to use the 'mail.alias.mixin' but it creates an alias
for each record in the parent model. This leads to a lot of unused aliases
if only a subset of those records really use aliases i.e. a lot of aliases
with 'alias_name' being 'False'.

In this commit we introduce a new mixin 'mail.alias.mixin.optional' that
behaves like the old 'mail.alias.mixin' but without having the 'alias_id'
field required i.e. without the "inherits". When creating a record without
giving an 'alias_name' no alias is created.

In future commit, we plan to use it notably to remove custom code in account
journal model and make it more standard. Using it in more models will be done
later, but it is a candidate to cleanup unused aliases related to discuss
channel model.

Task-3453343 (Mail: Cleanup Alias Usage)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#130632
2023-08-09 17:04:26 +02:00
Thibault Delavallée 6a21786f4d [IMP] mail: make alias name sanitize coherent with constraint
Currently there is a constraint on alias name as we allow only a subset of
valid latin characters in it aka `[a-zA-Z0-9!#$%&'*+\-/=?^_`{|}~]`. There
is also an automatic sanitize of alias name at create / write that replaces
any non-word characters by an hyphen. This sanitize is stricter than the
constraint and it is not really coherent.

In this commit we make the sanitize inlined with the constraint, allowing
more characters to go through the 'mail.alias.mixin' cleaning pass notably.

Linking some bug fixes about that subject (notably due to 'account.journal'
model that uses aliases without going through the 'mail.alias.mixin', hence
allowing to see differences between sanitize and constraint):

  * odoo/odoo@33bd1a951a : non ascii aliases when installing COA and generating
    journals automatic email aliases;
  * odoo/odoo@e08ee893d1 : left-part should not begin or end with dots as well
    as containing dots sequence;
  * odoo/odoo@f1215389e8 : prevent international char in aliases;

Task-3453343 (Mail: Cleanup Alias Usage)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#130632
2023-08-09 17:04:26 +02:00
Thibault Delavallée e187ba1cb3 [FIX] mail: correctly override ICP set_param method for alias parameters
Currently ICP parameter clean and check is done at create / write override.
However it should be done at ``set_param`` level to avoid messing with the
specific behavior of ir.config_parameter with falsy values.

Task-3453343 (Mail: Cleanup Alias Usage)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#130632
2023-08-09 17:04:25 +02:00
Thibault Delavallée d61be63ed1 [FIX] mail: check unicity inside alias names given for unicity check
In addition to checking conflicts with existing aliases, we have to check
that given name list also contains only unique names. Otherwise creating
in batch with duplicates raises the SQL unicity constraint instead of the
expected UserError.

Task-3453343 (Mail: Cleanup Alias Usage)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#130632
2023-08-09 17:04:25 +02:00
Thibault Delavallée 8c5722d5f8 [FIX] mail: force False when giving void alias name
Aliases should be unique except when they are empty. Indeed each valid email
address should be unique, as it targets a specific behavior e.g. creating
a task in a project or a ticket in an helpdesk team.

For that purpose an SQL constraint exists that enforces the unicity. Null
values in DB are not considered as being the same, meaning we may have
multiples aliases with Null values in DB.

When voiding the alias we may end up with a void string, which is not the
same as giving False to the ORM in term of DB storage. Multiple void strings
break the unicity constraint where multiple False strings do not.

In this commit we therefore enforce that void alias names are forced to
False to avoid any constraint issue. Sanitize method is now independent
from the check method, to avoid calling multiple times the sanitization
as it is often used for other checks.

Task-3453343 (Mail: Cleanup Alias Usage)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#130632
2023-08-09 17:04:25 +02:00
Thibault Delavallée 22a6170a01 [IMP] mail: lint and reorder alias code, add tests
CODE LINT / CLEANUP

Reorder fields definition per main usage: definition, owner, parent, gateway
configuration. Order computed fields accordingly.

Rename some methods (notably constrains), move an inner sanitize method as a
model method to allow its future usage.

Perfom a quick linting of code, simplify some lines.

TESTS

Add some tests related to alias management, notably copy, and multi-company
models using aliases. Those will help when moving to multi-company support
for aliases.

Add tests for current sanitation / cleaning of alias names and alias domain
parameters, to be more precise about accepted / unallowed characters, support
of unicode, ...

Task-3453343 (Mail: Cleanup Alias Usage)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#130632
2023-08-09 17:04:24 +02:00
tsm-odoo 7131f7c626 [IMP] mail, *: add support for guests/dynamic users in tests
*: bus, calendar, im_livechat, web, website_livechat.

This PR adds the possibility to set the current user during tests as
well as the mail guest. This will be used to test mail guest page and
livechat once the visitors will be treated as guests.

part of task-3332628

closes odoo/odoo#130811

Related: odoo/enterprise#45331
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-08-09 14:36:12 +02:00
tsm-odoo cdc35aed74 [IMP] mail: add decorator to extract guest
This PR adds the `add_guest_to_context` decorator in order to provide a generic
way to extract the guest from a request. It will be used to unified guest
extraction from cookie/param based on its provenance (external livechat/public
page).

This is better than the `pre_dispatch` method since it can be applied to
specific routes instead of adding this logic to every request.

part of task-3332628

closes odoo/odoo#130052

Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-08-09 13:20:53 +02:00
Maryam Kia 8d039cafe3 [IMP] mail: Send voice messages in discuss chats and channels
With this commit, users can send voice messages in channels and chat.
There's a new button in composer to record audio from the microphone,
up to 1 minute clip duration. This adds a voice attachment with its
dedicated voice player that shows waveforms and allows playback.

To ensure compatibility in all supported browsers, we choose to
encode voice recording with `audio/mp3` thanks to lib `lamejs`.

Task-3240168

closes odoo/odoo#117036

Related: odoo/enterprise#45482
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-08-09 13:20:46 +02:00
Rahul Prajapati 241a45dbc8 [FIX] mail: remove obsolete starred counter method
`_get_starred_counter` method is obsolete now.
So, there is no meaning in keeping it anymore.

It's usecase has been removed by this PR
https://github.com/odoo/odoo/pull/83777

closes odoo/odoo#131299

X-original-commit: cbf590bfa0999e99064e1a2bb337c8e63f00dd8c
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Rahul Prajapati (rapr) <rapr@odoo.com>
2023-08-09 04:22:57 +02:00
tsm-odoo 76bd362e34 [FIX] mail: no follower spinner on draft record
Before this commit, the follower loading spinner was shown
for draft records until it was saved. This is incorrect,
follower count should instead be 0. This commit fixes this
issue.

closes odoo/odoo#131224

Signed-off-by: Didier Debondt (did) <did@odoo.com>
2023-08-09 03:08:18 +02:00
Pierre Pulinckx (pipu) b1ebe3b6f4 [REF] *: Replace core._t imports
In this commit, _t import from import { _t } from
"@web/legacy/js/services/core" and from
 web/static/src/legacy/js/core/translation.js are replaced by
@web/core/l10n/translation.js.

task-3292454

closes odoo/odoo#130865

Related: odoo/enterprise#45270
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-09 00:13:08 +02:00