Commit Graph
5177 Commits
Author SHA1 Message Date
Zelong Lin 69fe16d42d [IMP] mail: make mentions in chatter full composer
Before this commit, it was not possible to send messages in
full composer containing user mentions. Even whe the mentions were
added in the small composer and then continuing composing the message
in the full composer.

With this commit, we can now make user and channel mentions in the
full composer, by typing `@` and `#` like in the small composer of
Discuss.

When composing a message in small composer and then switching to full
composer, the mentions are preserved.

task-3470060

closes odoo/odoo#132701

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-10-05 16:49:04 +00:00
Didier (did) e3d68312fa [IMP] mail: improve escape key usage in discuss app
This PR introduce multiple usage of the escape key:

- Channel selector can now be closed using the escape key
- Using the escape key will focus the composer automatically

Task-3456518

closes odoo/odoo#135031

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-10-05 13:37:50 +00:00
Jorge Pinna Puissant ef424a9dc2 [REF] *: remove owl from linter's accepted global variables
Before this commit, owl was in the linter's accepted global variables.
This allowed  direct access to owl global object.

For instance, to use xml from owl, you could do :
`const { xml } = owl;`
or you could use it directly:
`owl.xml`

Now, owl is not accepted on linter's global variables anymore, so to
import xml, now you need to use a proper import:

`import { xml } from "@odoo/owl";`

task-id 3498859

closes odoo/odoo#137517

Related: odoo/enterprise#48364
Related: odoo/design-themes#709
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-05 10:21:53 +00:00
Alexandre Kühn 6ffea84866 [FIX] mail: make call invitation work from recent discuss model REF
Discuss model data that had commands have been simplified by [1].
Notably some `unlink` were replaced by `False` and or `DELETE`.

Some code in Discuss calls was still expecting receiving command data
in of `DELETE` while data received has become `false`. As a result,
the state of ringing threads and showing call invitation card was not
working.

This commit fixes the issue by relying on recent improvements that
commands can be passed immediately as data to relational fields [2].

Code in Discuss call still have some coupling between fields whenever
some records are either added to or removed from a field. Hooks
`onAdd` and `onDelete` on relational fields are added to support
these cases.

[1]: https://github.com/odoo/odoo/pull/136308
[2]: https://github.com/odoo/odoo/pull/137341

closes odoo/odoo#137540

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-10-04 20:52:41 +00:00
Alexandre Kühn b1edee9a84 [REF] mail: simplify discuss model insert code
1. simplify message reaction formatter (personas)

Data was formatted to have "partners" and "guests" entries, both
of which contribute to personas.

To avoid some post-processing of data in JS, it's best to format
data to immediately include type of persona.

2. include "guestAuthor" in "author" data of message

Discuss models in JS group partners and guests into a single model
Persona, to make feature works regardless on whether user is
authenticated or not.

This commit simplifies code by removing data guestAuthor in message
formatted data, and instead author contains author data in all cases,
whether the author is a partner or guest.

3. simplify insert (remove id, redundant with preinsert)

Also rename Follower.isActive to Follower.is_active, for
even simpler Follower.insert()

closes odoo/odoo#137276

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-10-04 19:40:19 +00:00
Michael (mcm) 2fbc08a197 [IMP] *: remove legacy service mappers
This commit removes the legacy service mappers which are useless now.

closes odoo/odoo#136807

Task: 3439226
Related: odoo/enterprise#48015
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-04 19:40:16 +00:00
Didier (did) f29a09d7d3 [IMP] mail: send channel update to the client
Before this PR, channel update were not sent via bus notifications.

Part of task-2821415

closes odoo/odoo#136623

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-10-04 19:40:14 +00:00
Aaron Bohy cc3a3a328d [REF] web,*: simplify arch manipulation and parsing logic
*board,mail,project

This commit aims to simplify the XMLParser logic and the way archs
are manipulated in views, motivated by [1] where we had to
modify the arch in View to insert access right information.

First, the xml utils have been reworked. The XMLParser class has
been removed. The xml utils module already exported a parseXML and
a serializeXML functions, this commit adds visitXML, s.t. the whole
XMLParser feature is fully replaced by the 3 functions.

Second, concrete views now receive the arch in props as an
XMLDocument, as the arch is parsed once for all in View. With this,
we were able to remove serializing/parsing back and forth at several
places, where we needed to extract information for sub-parts of an
arch individually (e.g. View, x2many subviews, list view groupby).

Third, even though this change has been driven by the one above and
wasn't initally wanted, the view compiler cache and API have been
simplified. The cache is now flat, there's an entry in the cache for
each template that has been compiled. Moreover, the useViewCompiler
hook no longer takes the cache key in params, as it can directly
compute it itself (the key being the outerHTML of the template).

[1] odoo/odoo#135145

closes odoo/odoo#136376

Related: odoo/enterprise#47808
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-10-04 08:39:12 +00:00
Alexandre Kühn e4b7217fc3 [FIX] mail: remove message reaction was not working
Follow-up PR of https://github.com/odoo/odoo/pull/136308

Commit above simplified code in discuss models so code applies
on records than properties on records. For example, instead of
juggling between persona local id and persona, some code can simply
keep logic on persona without leaking local id.

However the improvements are iterative, and more improvements are
needed to stop using local id. Some code still need local ids.
Commit above mistakenly converts a local id to persona on some code
that still work in terms of local id. As a result, message reactions
were not working properly, notably when adding a new reaction using
click on an existing message reaction of someone else.

There was also a bug in implementation in mock server which made the
test not working. This commit fixes this issue too.

Task-3523101

closes odoo/odoo#136940

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-10-03 22:11:52 +00:00
Alexandre Kühn 9a70545913 [REF] mail: support passing commands as data of relational field
This significantly eases processing command data on relational field
received from server.

closes odoo/odoo#137341

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-03 20:17:47 +00:00
Alexandre Kühn 3b251d6d66 [REF] mail: turn Composer.rawMentions into relational fields
This field contained 2 sets with partner and channel ids.
It's easier and safer to reason in terms of records rather
than properties on records.

Part-of: odoo/odoo#137341
2023-10-03 20:17:47 +00:00
Jorge Pinna Puissant 006ee1fc47 [REF] web, *: remove legacy cookie utils and cookie service
The cookie service was replaced by a utils file in core. This was done
to be able to use the cookies without the need of environment.

"Om Nom Nom Nom" - Cookie Monster

part-of task-id 3439226

closes odoo/odoo#136782

Related: odoo/enterprise#48005
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-03 20:17:40 +00:00
Didier (did) 8fa2a6fe11 [IMP] mail: search a discuss thread
See https://github.com/odoo/enterprise/pull/43980

task-2359037

closes odoo/odoo#118794

Related: odoo/enterprise#43980
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-03 19:19:50 +00:00
Alexandre Kühn b526078ae9 [REF] mail: set data immediately on discuss model relational field
With this commit, instead of `Record.insert()` before setting
relation with records, we can immediately pass record data.
For example:
```js
message.author = { id: 3, type: "partner", name: "Admin" };
thread.messages.add({ id: 10, body: "some-text-content" })
```

This is supported on all relational fields that define a target
model.

To make this work while drastically avoiding cyclic dependencies
in code, whenever data have to be inserted in relation, they are
pre-inserted with essential data, and then they are fully inserted
after being registered in the relation.

closes odoo/odoo#136539

Related: odoo/enterprise#47854
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-02 11:42:55 +00:00
Alexandre Kühn 485bcb82bf [REF] mail: make store service a model
This simplifies managing relations on the store, and gives
incentive to define them there instead of another prop that
is a record, e.g. `discuss`.

Part-of: odoo/odoo#136539
2023-10-02 11:42:55 +00:00
miad-odoo 39dd2fc2ab [IMP] mail: allow users to manage own templates
Before this commit, all mail templates were shared, which was cluttering the UI
for everyone.

Now, each user can have their own templates that they can edit and save. Access
is done through the mail composer wizard, where users can only access their own
templates and templates that don't belong to anyone.

Some groups are considered as admins and can access all templates in
Settings/Technical/Email/Email Templates:

- Sales Admin
- Project Admins
- Helpdesk Admins
- Accountants
- Event Admins
- Recruitment Admins

Task-2504439

Part-of: odoo/odoo#126049
2023-09-29 13:11:50 +00:00
Sébastien Theys 64c6f731cb [FIX] mail: ignore obsolete chat window state received from bus
This fixes flickers in situations where:
- close (manually): notify
- open (manually): notify
- close (from bus)
- open (from bus)
The final state is correct, but it does one extra close and open.

With this fix, it becomes
- close (manually): notify
- open (manually): notify
- (close from bus ignored)
- (open from bus ignored)

Note: the fix is aimed towards fixing issues within the tab making the
manual change, which is the most common use case. Other tabs are not
considered visible at the time of the change, making the flicker
irrelevant, which is convenient to ignore as fixing it would require
more advanced mechanism.

runbot-24379
runbot-24994

closes odoo/odoo#136698

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-28 01:51:38 +00:00
Sébastien Theys cbfb1b909c [FIX] mail: do not notify chat window state when received from bus
The server is supposedly already aware of changes that are coming from
itself, it doesn't need to be notified again.

This prevents each extra open tab from making useless RPC.

This also fixes race conditions in situations where:
- close (manually): notify
- open (manually): notify
- close (from bus): notify close again <--- this is the bug
- open (from bus): already no notify for open from bus (ok)
- close (from bus again): and notify close yet again
Final state is close, whereas the user manually set open last.

With the fix, it becomes:
- close (manually): notify
- open (manually): notify
- close (from bus)
- open (from bus)
Finally state is open as expected, no extra RPC.

Note that is this example, there is still a problem, where an obsolete
value from the server (the first close from the bus) will overwrite the
newer local state (open), causing a potential flicker. This will be
fixed in a future commit.

runbot-24379
runbot-24994

Part-of: odoo/odoo#136698
2023-09-28 01:51:38 +00:00
Sébastien Theys 89aaa2c9ef [FIX] mail: restore lost pending new message when thread is loading
Part-of: odoo/odoo#136698
2023-09-28 01:51:38 +00:00
Sébastien Theys 635762db77 [REF] web, mail, snailmail: tests: merge containsMulti into contains
closes odoo/odoo#136658

Related: odoo/enterprise#47913
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-28 01:51:27 +00:00
Julien Castiaux 2ba215729b [FIX] mass_mailing: add test for emoji widget
Go to the form view of mailing.mailing, write "hello " as the subject,
insert an emoji, you end up with "hello:)" instead of "hello :)". The
problem is that when the input loose the focus, it is automatically
trim.

Reconfigure the `char_emojis` widget so that is doesn't trim.

task-id-3493168

closes odoo/odoo#136530

X-original-commit: 2adda1eb2760ccf970761f424105e245afc3de3f
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-09-27 17:41:03 +00:00
Alexandre Kühn 98491e3b43 [REF] mail: store all discuss models in Record.records as object
In preparation to improve insert in relational field with data, so
that there's less risk for cyclic code execution (hint: there'll be
a preinsert).

closes odoo/odoo#136308

Related: odoo/enterprise#47777
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-09-27 13:11:58 +00:00
Alexandre Kühn bef4069195 [IMP] mail: introduce RecordList.add() in discuss model relations
This method pushes the provided record if it's not in the record
list, otherwise it does nothing. This works a bit like `add()` on
Sets.

Part-of: odoo/odoo#136308
2023-09-27 13:11:58 +00:00
Alexandre Kühn 22ed4ec268 [REF] mail: rename commands in discuss model data
Relational data in server formatter are:
- for one relation: None/false or object
- for many relations: list of objects or list of commands

The commands were:
- 'insert': to add a new item in a relational field
- 'unlink': to remove an item from a relational field
- 'insert-and-unlink': to remove an item from a relational field
- 'clear': to remove all items from relational field

There was a slight nuance between 'unlink' and 'insert-and-unlink'
at some point, but it becomes irrelevant with current code of model.
The name of the commands were hard to grasp what they actually mean
for the many relations.

This commit improves it by renaming 'insert' by 'ADD' and the 2
'unlink' commands by 'DELETE'. This makes it more apparent that
the data in 'ADD' refers to data of record to add in the relation,
while 'DELETE' refers to data of record to delete from the relation.
The 'clear' has been replaced by `False` value instead of a command.

Part-of: odoo/odoo#136308
2023-09-27 13:11:58 +00:00
Alexandre Kühn 8d78065886 [REF] mail: turn Thread.transientMessages into relational field
Part-of: odoo/odoo#136308
2023-09-27 13:11:58 +00:00
Alexandre Kühn 87f605aa90 [REF] mail: turn 'store.ringingThreads' into relational field
Part-of: odoo/odoo#136308
2023-09-27 13:11:58 +00:00
Alexandre Kühn 08c751a9e3 [REF] mail: turn Thread.rtcSessions into relational field
Part-of: odoo/odoo#136308
2023-09-27 13:11:58 +00:00
Alexandre Kühn 1af1b3e96a [REF] mail: remove unnecessary getters in thread
Also turn `invitedMembers` into relational field

Part-of: odoo/odoo#136308
2023-09-27 13:11:58 +00:00
Alexandre Kühn d97ffb0dde [REF] mail, *: turn store.discuss into a model
This allows to define categories as also models, which allow
to register list of threads as relational fields, which in turn
simplify code readability and maintainability of these relational
data.

Part-of: odoo/odoo#136308
2023-09-27 13:11:58 +00:00
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