Commit Graph
5148 Commits
Author SHA1 Message Date
Alexandre Kühn 603cd70ecc [REF] mail: move service.update() to discuss models
These `update()` functions are specific to a discuss record,
so it's best to be defined in the model rather than another
service.

Part-of: odoo/odoo#136308
2023-09-27 13:11:58 +00:00
Sébastien Theys aee3cb8929 [REF] mail, *: tests: remove last occurences of jQuery in contains()
* = im_livechat, project_todo, test_mail, web

closes odoo/odoo#136425

Related: odoo/enterprise#47825
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-27 07:28:08 +00:00
Nasreddin Boulif (bon) 1f7d650da5 [FIX] mail: set name with default name instead of email
Steps to reproduce:

  - Install `website_crm` module (for test purpose)
  - Go to `Contact Us` page on website
  - Edit the page
  - Change the submit button to create an opportunity instead, then save
  - Fill the form and save
  - Go back to CRM app and open the opportunity just created
  - In the chatter, try to send a message
  - Click on the checkbox of the suggested recipient (to enable it)

Issue:

  - Email is displayed twice in the suggested recipients before click
    (instead of name + email or just email if same as name)
  - Email is set as default name in the opened dialog

Cause:

  - Displaying email even if same as name
  - Not setting the fields with default values (received from
    `/mail/thread/data` rpc call)

Solution:

  - Don't display email if same as name
  - For the suggested recipient label (next checkbox) : set name with
    default name value if name parsed from mail is same value as email
  - For the default values in the opened dialog: set default values with
    defaults received from `/mail/thread/data` rpc call

opw-3470295

closes odoo/odoo#135951

X-original-commit: 02ef0425a1f4ae30d846f6c57489cdebc3b4bbad
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
2023-09-27 03:58:34 +00:00
Julien Carion (juca) 2a2f53f7ce [FIX] web: fix translations for duplicate records
This commit ensures that changes in translated fields on a freshly
duplicated record will apply to all translation even when the user
language is not en_US.

Steps to reproduce:

-go to accounting -> configuration -> taxes in other language than en_US
-open any record in form view
-duplicate the record
-change the name of the record and save
-ensure that the name is the same in all languages

task-3339736

closes odoo/odoo#134481

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-27 01:50:52 +00:00
Brieuc-brd f5d1669ea8 [FIX] web: adapt the form view to large screens
Prior to this commit, there was a spacing issue in large screens (eg. 4K
screen), the form view wasn't large enough and this created a big gap
between the form view and the chatter.

This commit adapts the form view to large screens.

task-3453381
Part of task-3326263

closes odoo/odoo#136454

X-original-commit: 1a995cad898283f6909506ba43d1692381b3d6ef
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-09-25 15:20:23 +00:00
Julien Carion (juca) bbc4de86d9 [IMP] web: list many2oneAvatar should not be a link
This commit changes the canOpen prop of the many2oneAvatar field to be
set to true only when in form view. The field will therefore stop being
a link in readonly when outside of form view.

closes odoo/odoo#136118

Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-09-25 11:30:11 +00:00
Sébastien Theys 7a90938a70 [REF] mail, *: tests: simplify text option of contains
* = bus, calendar, im_livechat, hr, project_todo, sms, snailmail,
    test_mail, web, website_livechat

The current implementation often led to tests relying on DOM structure
to properly target the correct element with the text.

It is now easier to simply check if a parent contains some text.

closes odoo/odoo#136295

Related: odoo/enterprise#47770
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-23 10:33:04 +00:00
Sébastien Theys cc9e2c147c [REF] web, mail, *: tests: remove legacy file utils
* = mrp

closes odoo/odoo#136141

Related: odoo/enterprise#47716
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-22 11:55:58 +00:00
Pierre-Yves Dufays 8e1bbf526e [FIX] mail: fix activity view pager
This solves the following problem:
- Add 150 records with 2 activities each (ex. A call and a to do)
- Go to the activity view (ex.: event through the systray) and clear filter
- Only 50 of the 150 records are displayed (instead of 100)
- Going to the next page, only 2 are displayed (instead of ~50) (will depends
on the data already present)

Technical notes:
Not all activities were displayed because the search limit was applied on the
activity search instead of searching all activity related to the records.

The method fetchActivityData was doing half of the job because it was not
assigning the activity data fetch on the server to the instance variable
activityData, which was causing strange behavior when clicking on next page. To
simplify and correct the code, that logic has been moved to that method instead
of relying on the caller to do that assignation.

Task-3508744

closes odoo/odoo#135651

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-22 11:55:54 +00:00
Pierre-Yves Dufays b81e7b3288 [IMP] {test_}mail: improve activity view pager test
The activity view pager test is improved to use the actual get_activity_data
mock rather than checking that it is called with the right parameters. Thanks
to that, we also check that the activities are displayed. To ensure that the
pager influence only the records displayed and not the related activities, we
set up test records with 2 activities each and check that there are 2 times
more activities displayed than the number of records.

Task-3508744

Part-of: odoo/odoo#135651
2023-09-22 11:55:54 +00:00
Sébastien Theys 5a7e882766 [REF] mail, *: tests: convert remaining :contains from QUnit tests
* = web, sms

closes odoo/odoo#136131

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-09-21 23:54:27 +00:00
Alexandre Kühn 20710a6850 [IMP] mail: group List() and Set() into single many relation
`RecordSet` relations were rare and not worth having them. Turning
them into `RecordList` has no drawbacks.

To simplify many relations to a single relational field,
`Record.List()` was renamed to `Record.many()`, and `Record.Set()`
has been removed.

closes odoo/odoo#134884

Related: odoo/enterprise#47745
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-09-21 23:54:21 +00:00
Alexandre Kühn 18078c546e [IMP] mail: properly type discuss models
- Split d.ts files in `@types` folders that are close to
  where the definitions of model & patches.
- Update jsdocs of discuss models to be fully type, including
  model patches

When defining a new discuss model or a patch, should define a
`@types/models.d.ts` file. It must make use of module `models`
to define interface with model name:

```ts
declare module "models" {
    import { Thread as ThreadClass } from "./thread_model";

    export interface Thread extends ThreadClass {}

    // necessary to propagate types to relations
    export Models {
        "Thread": Thread,
    }
}
```

When defining a patch, should also define a `@types/models.d.ts`
to augment the interface of the model at hand:

```js
patch(Thread.prototype, {
    setup() {
        this.pinnedMessages = Record.Set("Messages");
    }
});
```
```ts
declare module "models" {
    import { Message } from "models";

    export interface Thread {
        pinnedMessages: Set<Messages>,
    }
}
```

Part-of: odoo/odoo#134884
2023-09-21 23:54:21 +00:00
Alexandre Kühn b71e1fd22d [IMP] mail: add relational fields on patch of discuss model
With the introduction of relational fields on discuss models,
which makes it easier to manage relations between discuss records,
we are incentivized to define all discuss relations in the models.

Some services managed relations with their own datastructure.
For example, pin_message service uses some Maps and Sets to model
messages pinned on channels. This is cumbersome to manage deletion
of records by hand... And also the name of attributes in the service
are too long, which shows they are not placed in the right context
(= in a dedicated service rather than in models).

This commit turn these relational data in pin_message service into
new relational fields on Thread and Message models.

```js
patch(Thread.prototype, {
    setup() {
        this.pinnedMessages = Thread.Set("Messages");
    },
});
```

For type inference of the discuss model patches, we rely on module
augmentation of TypeScript with interfaces: we define an interface
for the patch of a given model, and we combine the type of this
"patch" interface with the original Model type in the listing of
Models types:

```ts
declare module "models" {

	import { Persona } from "./persona";
	import { Thread } from "./thread";

    export interface Models {
    	"Message": Message,
        "Thread": Thread & Partial<Thread_Patch>,
    }

    export interface Thread_Patch {
        pinnedMessages: RecordSet<Models["Message"]>
    }
}
```

That way, whenever we use a record e.g. from a one relational field,
we have proper typing for the patches:

```js
class Message {
	originThread = Record.one("Thread");
}

message.originThread; // Thread & Partial<Thread_Patch>
message.originThread.pinnedMessages; // RecordList<Messages>
```

So whenever you adapt a discuss model patch or add a new one, make
sure to register new props in an interface of "models". Other devs
will be grateful towards you!

------

Note that the previous implementation of Relational fields on discuss
models was not robust enough with patching, notably with the
implementation details of `@web/patch()` function. Instead of using
`Object.defineProperty` on the model class prototype of each
relational field, we now use a proxy. This prevents the proxy hook
to be shadowed by the patches. This also allows to support a new way
to delete `Record.one()` relations with the `delete` keyword.

Part-of: odoo/odoo#134884
2023-09-21 23:54:21 +00:00
Alexandre Kühn 4023d523cc [IMP] mail: introduce many relations on discuss models
Introduce many relation by means of `Record.List()` and
`Record.Set()`. `Record.List` makes a data-structure similar
to JS Arrays, whereas `Record.Set` makes a data-structure similar
to JS Sets. Instead of storing objects, they store local ids
of records.

Note that some methods that return a collection return a native
collection, not a record collection. For example,
`RecordList.filter()` returns an array, not a `RecordList`.
This allow limiting using these special collections only when
handling relations, not collections in general.

Also note that the `Record.List` and `Record.Set` both accept either
native collection or record collection as setter argument.

```js
class Thread extends Record {
	messages = Record.List("Messages");
	followers = Record.Set("Follower");
}
// ...
thread.messages = messages;
thread.messages.push(message);
thread.messages.filter((msg) => !msg.isEmpty);
thread.followers.add(follower);
```

These relations allow to normalize discuss store further, improve
code readability with simpler field names, and also prepare for
future improvements on models such as simpler python formatters,
simpler Record.insert flows, relational fields that automatically
reflect on record deletion, etc.

Part-of: odoo/odoo#134884
2023-09-21 23:54:21 +00:00
Alexandre Kühn 355b586970 [REF] mail: introduce Record.one() relational field on model.
This allow storing only the local id internally, and there are
automatic `get`/`set` to get the related record. This prepares
support of record deletion that would automatically delete
all relational fields, in a follow-up PR.

```js
class Message {
    author = one("Persona");
}
```

Relational fields can be used to uniquely identify records:

```js
class ChatWindow {
    static id = "thread";
    thread = one("Thread");
}
```

Part-of: odoo/odoo#134884
2023-09-21 23:54:21 +00:00
sankalp chhunchha (schh) 029acb256a [IMP] mail: download all files of discuss message at once
This commit introduces a new message action to download
all files of the message, when the message contains more
than a single attachment.

This commit also do not show the delete icon on a file
when it's linked to a message without any text content, and
there's only 1 file attached to this message.
This is because deleting message and deleting the file means
basically the same, as deleting the attachment would mean the
message is empty, and empty messages are considered deleted.
We only show "Delete" of the message for clarity.

Task-3340653

closes odoo/odoo#132164

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-18 22:16:58 +00:00
Maryam Kia 23394cb345 [IMP] mail: Allow screen and video sharing at the same time
Before:
- sharing the screen stops sharing video and vice versa

after:
- If user starts to share screen at the same time with video sharing, a pip of video sharing appears on the call when user focuses on the sharing screen and vice versa. This pip is draggable and depends on the nearest corner to drag situation, will be located on the corner.

Task-3374606

closes odoo/odoo#130354

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-18 22:16:57 +00:00
Julien Carion (juca) 1a44537095 [IMP] mail: avatar card preview v2
This commit changes the behavior of the avatar card preview so that it
is now triggered on click instead of on hover and the previous behavior
of the click event (open chat) is therefore removed. It also adds the
functionality to the Message and Activity components of discuss so that
clicking on the avatar inside these components will also show the card.
It also makes sure that the id of the user is added to the persona even
if nothing indicates that it should.

task-3442819

closes odoo/odoo#131355

Related: odoo/enterprise#47084
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2023-09-15 16:45:50 +00:00
Sébastien Theys c6df607104 [FIX] mail: fix warning in user_modify_own_profile_tour
Follow up of https://github.com/odoo/odoo/pull/129239

Fixes runbot issue https://runbot.odoo.com/web#id=24581&view_type=form&model=runbot.build.error&menu_id=405&cids=1

closes odoo/odoo#135617

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-09-15 10:48:32 +00:00
Sébastien Geelen (sge) 639a2b2296 [FIX] web_editor: open DPH in mail template
The Dynamic placeholder was not opening properly in mail template since the wysiwyg OWL conversion.

Fix it and also fix the tour that should have detected this error.
The tour itself was not running properly.

task-3495254

closes odoo/odoo#135275

X-original-commit: df8532cffc74038db0faef36b5f43758e1bbdf43
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
2023-09-14 11:22:50 +00:00
Sébastien Theys 7ea370fce7 [REF] mail, *: tests: refactor contains to further remove jQuery
* = account, base_iban, bus, calendar, crm_livechat, hr, hr_holidays,
    im_livechat, mrp, project, sms, snailmail, test_mail,
    test_mail_full, web, website_livechat, website_slides

Add support in `contains` for most operations that we use in tests.
Remove return value from `contains`.
Move into `web` module.
Remove import/export chains, directly import from correct module.

closes odoo/odoo#134652

Related: odoo/enterprise#47064
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-09-14 11:22:47 +00:00
Didier (did) 023461cd06 [FIX] mail: fix composer render when switching chatter record
To reproduce this bug:

- Open a record with a chatter
- Open a composer (send message or log note)
- Change record using the pager
- Now, you cannot mention anyone

This is because the chatter component is reused and the `useComponent` hook isn't
refreshed with the new data.
This PR fix the issue by forcing a re-render of the composer when the `threadId`
changes. This refresh the `useComponent` hook used inside the `useSuggestion`
hook.

task-3502720

closes odoo/odoo#135331

X-original-commit: 28dd108294606499799e1fd2a7b24de23730d098
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-13 18:42:32 +00:00
Maryam Kia de8e25ce6c [FIX] mail: call hasAuthorClickable function since it's not a getter
closes odoo/odoo#135373

X-original-commit: f3d2fc33961a93d186a66f84f53cea8ce0c312b5
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-13 17:43:10 +00:00
Julien Carion (juca) ace86c47ed [IMP] web, mail: command palette improvements
This commit applies several modifications to the command palette:
- The list of menus for the current app is now hidden in the command
palette
- The assign user commands of the palette are now available in list
view when multi-edit is supported and a mechanism to avoid command
duplication has been implemented so that if several fields use the same
command, it will be displayed with an identifier in the palette and the
commands won't overlap
- The assign/unassign to me command is now split into assign to me and
unassign from me. The presence of the commands depends on whether they
would have an effect or not
- The "View switcher" command category is moved to second last position
of the command categories

task-3235223

closes odoo/odoo#129743

Related: odoo/enterprise#44620
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2023-09-13 15:34:31 +00:00
Alexandre Kühn d064d3728d [FIX] mail: do not autoscroll attachment box when initially open
Before this commit, when a form view choose to open attachment box
initially and chatter is at bottom, opening the form view was
scrolling down to the attachment box.

The auto-scroll to opened attachment box is desirable when the
user explicitly interact with the attachment button, to show
the attachments. However, it should not be triggered when opening
the form.

This commit fixes the issue by limiting auto-scroll to attachment
box only when explicitly chosen by the user.

closes odoo/odoo#135205

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-09-13 04:37:02 +00:00
Didier (did) 8e2d0e9f8d [IMP] mail: port test from 135122
This PR import the test created in https://github.com/odoo/odoo/pull/135122

closes odoo/odoo#135183

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-13 03:38:09 +00:00
tsm-odoo 4be75dd002 [IMP] im_livechat: allow visitors to receive calls
task-2900771

closes odoo/odoo#135109

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-09-13 03:37:56 +00:00
luvi 44d9b70b8e [IMP] mail: add a pager to Activity view
This commit adds a pager to add a limit to the number of activities
displayed by the view. This reduces the risk of performance issues
when many activities have to be fetched and displayed in the view.

There is no need to display an infinite amount of activities, so a limit
had to be set.

The 'get_activity_data' method from the model now takes the limit and
offset parameters, to only fetch activity data from maximum of 100
records.

Activity tests have been adapted to reflect this change, and that the
parameters are correctly used.

task-3487762

closes odoo/odoo#134510

Signed-off-by: Florent Dardenne (dafl) <dafl@odoo.com>
2023-09-12 10:51:08 +00:00
Aaron Bohy 0d7acf60b4 [REF] *: remove legacy Markup
Use owl.markup instead.

Part of task~3439226

closes odoo/odoo#134793

Related: odoo/enterprise#47124
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-11 19:13:59 +00:00
0903ef7bb2 [MOV] *: move all PWA to community
In this commit, we moved all features related to the PWA and the PWA
itself to the community.

This includes:
* PWA
* Web Push Notification
* VCARD

Note from original commits:
===========================

PWA (part 1)
------------
This commit adds a ServiceWorker to complement the WebManifest to
complete the setup of the backend as a Progressive Web App.

More precisely, it adds the route, registration and the most basic
ServiceWorker to allow the backend to be recognized as an installable
PWA.

References:
- https://web.dev/install-criteria/
- https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Installable_PWAs
- https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers

Task ID: 3063485

PWA (part 2)
------------
This commit adds a WebManifest as a first step toward setuping the
backend as a Progressive Web App.

In a nutshell:
- the web app's name is configurable through a config parameter
  (available in the Settings, in debug); defaulting to "Odoo".
- the web app's icon has been revamped to accommodate the required sizes;
  also its design matches the one from the Android app.
- "theme-color" is used to color part of the browser/system UI to match
  Enterprise brand color; also supports the dark mode.

References:
- https://web.dev/learn/pwa/web-app-manifest/
- https://web.dev/install-criteria/
- https://developer.mozilla.org/en-US/docs/Web/Manifest

Task ID: 3063485

PWA shortcuts
-------------
The main goal of this commit is like we did inside the `Android Odoo
Mobile App`, allowing users to have some Odoo application shortcuts.
We added the following apps in the key `shortcuts` on `web.manifest` in
these orders: `Discuss`, `CRM`, `Project`, `To-Do` (old `Notes`).

Links:
- https://w3c.github.io/manifest/#shortcuts-member
- https://developer.mozilla.org/en-US/docs/Web/Manifest/shortcuts

Task ID: 3123607

Offline mode
------------
This commit introduces a way to notify the user that he's "offline"
(aka. cannot reach its Odoo server) and that Odoo doesn't work in a
graceful way in this circumstance.

To do so, the Service-Worker will return the response of the
´web/offline´ route, which is cached at its setup.

Note: this screen is only show when launched while "offline" and fails
to load the requested page. It does not "interrupt" the WebClient to
show this screen when the connection drops off (cf. not a replacement
for the existing notification).

Task ID: 3203639

WebPush
-------

WebPush allows sending data to the user browser/app(PWA) even when
tab/app is closed. Web push is a "constant" link between the
ServiceWorker of browser/app and a WebPush server.

Note that each browser has its own custom WebPush server.
e.g.:
Chrome: https://fcm.googleapis.com/
Firefox: https://updates.push.services.mozilla.com/
Safari: https://web.push.apple.com/
Edge: https://wns2-ln2p.notify.windows.com/
WebPush introduces some cryptographic notion to ensure some the
reliability of the data sent:

VAPID: "Voluntary Application Server Identification" is the standard
used to generate the public and the private to sign the message
between the browser and the WebPush server
JWT: "JSON Web Token" is the standard used to sign the payload to the
WebPush server
ECE: "Encrypted Content-Encoding" is the standard used by WebPush to
encrypt the data of the payload to avoid sending RAW data
outside trusted network.
Simplified steps how to WebPush works:

The Javascript code of a web page subscribes to the WebPush server
(using the VAPID key generated at mail_entreprise install).
The WebPush server replay with a subscription (and some other info
like the unique URL endpoint per subscription where to send a
notification)
The application (odoo-bin in our case) sends a post request to the
WebPush server using the specific URL endpoint of the user (using JWT
and ECE).
The WebPush server sends back to the browser the encrypted payload.
The browser decrypts the payload and sends it to the ServiceWorker
linked to the subscription.
Here is a Sequence diagram of all interactions to process a web push
notification.
In Odoo, we use WebPush to send Notification to the user.

This commit aims to have a parity with the Android/iOS Mobile App at
the notification level.

Notes:

There are some ways to encrypt (ECE) the message for WebPush:

AESGCM128: this is a draft
AESGCM: very well documented
AES128GCM: RFC8188 Standard encoding
We implement only the RFC one as it is the only one implemented in all
major updated browsers (Chrome, Firefox, Safari, Edge, ...)
You need to allow the desktop "Notification" and "Push" inside your
browser. For iOS Devices, it only works on iOS 16.4+ and it's requiring
Odoo to first be added to the Home Screen. It's delivered silently,
meaning no sound, vibration, haptics or screen wake.

Note:
Notifications are sent directly if there are less than five
notifications, otherwise we use a cron triggered immediately.
Also, we have changed the value of the "QueryCount" as mail_enterprise
executes a new query to search the devices associated with the partner.

We have added a "try/except" for any Exception before the
push_to_end_point method as we want to avoid blocking a normal flow
just for a not mandatory push notification if something happens during
the push to the endpoint.
See: odoo/enterprise@d0ae70103d

Links:
https://www.rfc-editor.org/rfc/rfc8030
https://www.rfc-editor.org/rfc/rfc8188
https://www.rfc-editor.org/rfc/rfc8291
https://www.rfc-editor.org/rfc/rfc8292
https://w3c.github.io/push-api/index.html
https://autopush.readthedocs.io/en/latest/http.html
https://web.dev/push-notifications-web-push-protocol/
https://github.com/web-push-libs/encrypted-content-encoding
https://github.com/web-push-libs/pywebpush
https://github.com/web-push-libs/vapid
https://caniuse.com/push-api
Task ID: 3123678

VCARD
-----
In the process of replacing the native methods exposed in the mobile
apps, this commit implements the download of a vCard containing a
partner's information.

By using this standard format, both regular web users and mobile ones
are now able to save the partner's details to use them with their usual
address book software.

On a mobile device, the actual import of those informations is delegated
to the operating system.

References:
- https://datatracker.ietf.org/doc/html/rfc6350
- https://en.wikipedia.org/wiki/VCard
- https://github.com/eventable/vobject#vcards

Task ID: 2583916

===========
End of note
===========

Task ID: 3478014

closes odoo/odoo#133560

Related: odoo/enterprise#46530
Related: odoo/upgrade#5086
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Co-authored-by: Romeo Fragomeli <rfr@odoo.com>
Co-authored-by: Romain Estievenart <res@odoo.com>
Co-authored-by: Pierre Paridans <app@odoo.com>
2023-09-11 16:32:30 +00:00
tsm-odoo 39a4d85de3 [FIX] mail: fix push to talk key detection
Before this commit, the push to talk key combination was wrongly
detected. Indeed, it was dependent on which key was pressed first.

Steps to reproduce:
- Register "ctrl + alt" as the push to talk key
- Press control then alt, push to talk does not work
- Press alt then control, push to talk works
- If you unpress the alt key, the push to talk will stop as expected
- If you unpress the control key, the push to talk will keep going

This commit fixes the issue.

closes odoo/odoo#134981

X-original-commit: 3e4ed2a43ad23116c095af67cb7e5736a9854820
Signed-off-by: Thanh Son Dodeur (tso) <tso@odoo.com>
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-09-11 15:22:12 +00:00
Thibault Delavallée 6ee4cc1317 [FIX] mail: correctly parse formatted email in JS
Formatted emails using our own formataddr contains quotes to correctly
separate name from emails, like'"Name" <email@domain.com'. However
JS parse function does not correctly handle quotes, assuming everything
being left of opening chevron is the name.

Task-2612945 (Mail: Defensive email formatting)

X-original-commit: odoo/odoo@c5b39cfb64
Part-of: odoo/odoo#134934
2023-09-11 15:22:09 +00:00
Alexandre Kühn f3614a4b5b [FIX] mail: smaller thumbnails in attachment list
Before this commit, when showing list of attachments in a message
or attachment box, the images were too big. This made it hard to
see other content due to the big size of the images.

This commit fixes the issue by reducing the size of image previews
when in context of many attachments. When a message has a single
image, it keeps showing a big preview of this image.

Also slightly reduce size of images in attachment box, as they were
also too big.

closes odoo/odoo#134941

X-original-commit: cf2069e0f7cd36c4d2b3bcc79fdde7e0425e2e52
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-11 11:53:53 +00:00
Géry Debongnie e0fdb6a0b4 [IMP] *: rewrite module loader
This commit rewrite the module loader to simplify it and to improve error handling.
before this commit, you could have silent errors or "lucky" imports (import a module based on the fact that his asset will surely be load and if not, the error would be silent anyway).
e.g.: The tours cannot import modules extern to tours' bundle anymore. Or load module before your libs in assets.

TASK ID: 3266021

closes odoo/odoo#128502

Related: odoo/enterprise#44100
Signed-off-by: Bastien Pierre (ipb) <ipb@odoo.com>
2023-09-08 16:47:56 +00:00
Alexandre Kühn 640a11a56e [FIX] mail: jump to pinned message from notification
Before this commit, when pinning an old message from thread,
then page reload then click on pinned message link in
notification message in thread at time of pinning message,
it fails to jump to the pinned message.

This happens because the message is not in the store, therefore
it attempts to jump to message `undefined`, which doesn't exist.

This commit fixes the issue by inserting the message before
attempting the highlighting that will jump to the message.

closes odoo/odoo#134818

X-original-commit: 70769963d240add98ed2ee231412201434a825ba
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-08 13:45:41 +00:00
tsm-odoo 278f9081f2 [IMP] im_livechat: add message features for livechat
This commit adds the discuss message features to the livechat
threads:
- Edition/deletion of messages
- Reactions
- Replies

It also improves the history view present in the channel form view
by showing replies.

task-2742676

closes odoo/odoo#133456

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-08 13:45:33 +00:00
Zelong Lin adc5448adf [IMP] mail: single unified Picker (Gif & Emoji)
Before this commit, emoji and gif pickers were handled as 2 different
pickers. They had dedicated buttons. This made composer quite
bloated, especially in chat windows were size is narrow.
Also the pickers were always displayed as popover, which is not the
best way to show content in mobile.

This commit improves those pickers in discuss so that only a single
button is present (emoji button). Clicking on this button shows a
picker that groups the emoji and gif picker, both of which can be
selected in the header of the grouped picker.

In mobile, instead of showing a popover, it now shows the grouped
picker below the composer. This makes it show where the soft keyboard
is present in mobile, making it easier to input emojis or gifs on
those devices.

This commit also added slight style changes to both pickers. Notably,
the search bar has an improved style that makes it look good when
next to the composer text input, especially in mobile layout.

task-3015707

closes odoo/odoo#123671

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-08 12:24:45 +00:00
Alexandre Kühn 27919caad7 [FIX] mail: auto-close attachment box when no attachments
Before this commit, when opening a record with some attachments
and attachment box is open, switching to a record without any
attachment shows the attachment box open.

This is a problem because the attachment box is designed to only
be open when there are some attachments. The toggler for showing
attachment box is instead an "upload file" button when the record
has no attachment. This means that the open attachment box in those
records without any attachment cannot be toggled off.

This commit fixes the issue by automatically closing attachment box
when the record has no attachments.

Task-3493374

closes odoo/odoo#134771

X-original-commit: ab678ea7618ca1aee5a6ab31b2de59c87fcce32c
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-08 09:47:09 +00:00
Alexandre Kühn d139240161 [FIX] mail: search in emoji picker should scroll top
Before this commit, when opening emoji picker and scrolling down
then making search, the scroll position was not reset to top.

This gave the impression that the search was incorrect, because
the most likely desired emoji is at the very top but was not visible
when searching in this condition.

This commit fixes the issue by enforcing scrolling top in emoji
picker content when the search term is updated.

Task-3493611

closes odoo/odoo#134675

X-original-commit: 7999ae51c51e24eea15edb8f08b2e35db4a774ad
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-08 08:29:59 +00:00
Didier (did) 8a6eda2ccd [IMP] mail: add typing status above the composer in chat window
In DM chat, the im status turns into typing icon so it was not
a problem. In group chat and channel, however, there was no way
to see typing members in chat window.

This commit adds explicit small text above composer in chat window
to list typing members of conversation.

Task-3474778

closes odoo/odoo#133757

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-08 08:29:54 +00:00
Maximilien (malb) d6d468e5f1 [IMP] hr_expense: readability expense receipts
The goal of this PR is to improve the readability of expense receipts on
hr_expense and hr_expense_sheet.
This PR do the following:
- Add the expense name next to the filename
- Vertically center the receipt on both model (was previously done in hr_expense
 but not for the sheet)
- Make sure the title doesn't get hidden by the image (was previously done in
hr_expense but not for the sheet)

Also, to achieve the first point we had to modify the attachment so that we can
retrieve easily the information of which line the attachment is attached.

closes odoo/odoo#130181

Task: 3443067
Signed-off-by: William André (wan) <wan@odoo.com>
2023-09-07 16:16:04 +00:00
Didier (did) 8bd1d87880 [IMP] mail: allow scroll using keyboard key in chat window
Before this PR, it was not possible to scroll a chat window using page down/page
up, home or end keys.
This is because the thread component that is scrollable cannot became an activeElement.
This PR fix this by adding a tabindex="-1" on the scrollable element.

Task-3468978

closes odoo/odoo#134657

Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-09-07 14:45:28 +00:00
tsm-odoo a188d9c894 [IMP] im_livechat, *: use guests for livechat visitors
*: crm_livechat, mail, test_discuss_full, website_livechat.

part of task-3332628

closes odoo/odoo#129770

Related: odoo/enterprise#45767
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-09-07 13:10:07 +00:00
Alexandre Kühn c5ece6ccc1 [FIX] mail: discuss sidebar quick search case-insensitive
Before this commit, quick search in discuss sidebar (shown when
more than 20 conversations) was case-sensitive. For example,
when a channel was named "R&D" and user types "r", the channel
was not found.

This commit fixes the issue by making search case-insensitive.

Task-3485254
opw-3445747

closes odoo/odoo#134603

X-original-commit: 02e5af467b6058ea0933255c8f0c4e8dab17f31d
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-07 11:46:12 +00:00
Renaud Thiry b71e5eea64 [FIX] mail: voice do not trigger change on unmount
'unmounting' key was not passed in when cleaning up the voice recorder
for an unmount.

In whatsapp this made the composer difficult to use as the voice
recoder is unmounted each time a message is sent.
The missing key made it impossible to send multiple messages as the
composer would be in the 'recording message' state, disabling the send
button.

Task-2377154

Part-of: odoo/odoo#134377
2023-09-07 11:46:11 +00:00
+4 628f3a54e4 [IMP] mail: prepare inclusion of whatsapp channels
Prepare 'discuss.channel' model as well as discuss code to include 'whatsapp'
channels and WhatsApp flow inclusion. Those channels are specifically used
in whatsapp-based flows and have some specific behavior, hence using a
specific channel_type for them.

Also add a setting in 'mail' to install 'whatsapp' module.

Task-2377154 (Add WhatsApp Support)

Part-of: odoo/odoo#134377
Co-authored-by: Akshat Trivedi <aktr@odoo.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
Co-authored-by: Gitashri Mantha <gman@odoo.com>
Co-authored-by: Jigar Vaghela <jva@odoo.com>
Co-authored-by: Kashyap Patel <kasp@odoo.com>
Co-authored-by: Khushi Vakil <khva@odoo.com>
Co-authored-by: Nishant Jain <niai@odoo.com>
Co-authored-by: Prakash Prajapati <ppr@odoo.com>
Co-authored-by: Priyanshi patel <prpa@odoo.com>
Co-authored-by: Rahul Prajapati <rapr@odoo.com>
Co-authored-by: Renaud Thiry <reth@odoo.com>
Co-authored-by: Shreya Patel <shpa@odoo.com>
Co-authored-by: Stéphane Debauche <std@odoo.com>
Co-authored-by: Zeel Patel <zepa@odoo.com>
2023-09-07 11:46:11 +00:00
Pierre Pulinckx (pipu) 038169ee9f [REF] web: simplify assets loading
In this commit, the loadXML function has been removed. We use registry with
xml_templates to load XML templates for OWL Apps.
The goal of task is to remove loadXML and getBundle from assets to simplify
the understanding of assets api.

task-3266441

closes odoo/odoo#134520

Related: odoo/enterprise#47001
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-09-07 09:00:28 +00:00
Valentin Chevalier 054ca0a19a [IMP] web, *: Add more formatters in assets_frontend
Before this commit, formatters like `formatMonetary` and `formatFloat`
weren't loaded in the assets front-end.

This commit introduces `formatAmount` ( `formatMonetary` calls
`formatAmount` but makes some prior processing to deduce the currency
from the field) and makes `formatAmount` and `formatFloat` accessible
from any front-end application.

Note: The currencies were added in the front-end session info because
they are needed in `formatAmount`.

closes odoo/odoo#133824

Related: odoo/enterprise#46658
Signed-off-by: Valentin Chevalier <vcr@odoo.com>
2023-09-06 19:43:39 +00:00
Alexandre Kühn 90679836ff [FIX] mail: properly show name of discuss channel
Follow-up of https://github.com/odoo/odoo/pull/130821

`name_get` has been deprecated for `display_name`. In old `name_get`,
when the record had no display_name (`convert(rec._rec_name)` returns
`False`) then the fallback was empty string `""`. This has been
changed with default `_compute_display_name`, to instead show
`<rec._name>,<rec.id>`.

Discuss channel `display_name` was relying on this "" fallback
somehow: even though `rec._rec_name == ""`, `convert("") == False`,
thus fallback "" cancels out to "". The value "" for name is
intentional and necessary in discuss channels for the good working
of some other fallbacks UI, e.g. group chat concats member names.
With the recent changes of `_compute_display_name` default fallback,
it showed `discuss.channel,10` instead of "".

Steps to reproduce:
- Log in as Mitchell Admin
- Open Discuss app
- Click "Start a meeting"
=> expected: shows group chat name "Mitchell Admin"
=> result: shows group chat name "discuss.channel,10"

This commit fixes the issue by removing reliance on `display_name`
for discuss channels: it always uses `name`, thus showing taking into
account `""` as it needs for fallbacks like in group chat when it
has no name.

Task-3493629

closes odoo/odoo#134531

X-original-commit: 5592fc107790c910910c2719ede04a86910dc79f
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-06 14:42:21 +00:00