Commit Graph
4536 Commits
Author SHA1 Message Date
Aaron Bohy 145540921f [REF] web,mail: handle "color_field" option in M2MTagsField
Before this commit, there was a hack done in Field.js to handle
a special case of the Many2ManyTagsField which sometimes require
an additional "color" field to be fetched. This field is given in
option on the many2many field, in the arch.

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

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

Part of task 3179751

closes odoo/odoo#112518

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

What is a formattedRecord:

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

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

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

closes odoo/odoo#112618

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

Finally, this commit also removes the legacy view dialogs.

Task 3168640

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

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

closes odoo/odoo#112153

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

After this commit title matches dialog purpose.

closes odoo/odoo#112111

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

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

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

closes odoo/odoo#111799

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

task-3132890

closes odoo/odoo#109855

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-02-03 05:08:51 +01:00
Géry Debongnie b53f78e224 [REF] web_tour,*: use the registry in collecting the tours
This is a step closer to a goal of avoiding dependence on asynchronous
modules. Starting from this commit, new tour definition should be
registered to `registry.category("web_tour.tours")` registry.

So, instead of the following:

```js
import tour from "web_tour.tour";
tour.register(name, options, steps);
```

We now do:

```js
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add(name, optionsWithSteps);
```

Notice the `options` and `steps` params are merged when registering
the tour definition. It should look something like so:

```js
registry.category("web_tour.tours").add("account_tour", {
  test: true,
  steps: [ ... ],
});
```

And if the `TourManager` instance is needed, one can get it from the
registry like so `registry.get("tourManager")`. Note however that
this instance is only available when the `TourManager` has been
instantiated -- so it's not available at top level of the module.

closes odoo/odoo#111103

Related: odoo/enterprise#36335
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-01-27 23:17:35 +01:00
Thibault Delavallée 8a66cc7db0 [IMP] mail: display scheduled_datetime of delayed notify in chatter
Followup of odoo/odoo#95623 (introduce scheduled message notification) as well
as odoo/odoo#99482 (support scheduled datetime from template to composer in
both comment and mailing modes).

Task-3093257 (Mail: The Composer Update)

Part-of: odoo/odoo#107356
2023-01-27 19:56:09 +01:00
Alexandre Kühn 27fabf8da7 [FIX] mail: save record when using chatter on draft record
Before this commit, while creating a new record, the chatter
was disabled and no interaction on chatter was possible until
the record was fully created by saving it.

This was a problem because it's unclear that chatter requires
the record to be fully created. In earlier versions of Odoo,
we had to click on "Edit" and "Save" buttons of Form view, but
now that edit/read-only mode is no longer explictly managed by
the users, they'd expect to be able to interact with chatter,
even while in the process of creating a new record.

With this commit, when clicking on most actions in chatter, the
record is created. In case the record cannot be created, usual
validation errors are applied.

Task-3132931

closes odoo/odoo#110991

X-original-commit: af442bd8d42acad0cb6a49700fc9ec1934751bf1
Related: odoo/enterprise#36284
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-01-25 17:50:17 +01:00
Alexandre Kühn 64210e5870 [FIX] mail: no crash when uploading file on chatter with preview
This happended because when reloading the chatter, the chatter
changed position and its identity changes (i.e it's no longer
the same chatter). The old chatter was  removed, therefore it's
invalid to access relation on removed records, e.g. with
`chatter.webRecord`.

The underlying problem was that chatter should stay the same,
even with reposition. The chatter was not properly passed
between aside to bottom position.

This commit fixes the issue by properly passing chatter in
form controller.

closes odoo/odoo#110912

X-original-commit: f04bb66c0714bf732202873e2de82bcbc767a43f
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-01-25 12:24:55 +01:00
Alexandre Kühn b410607459 [FIX] mail: scroll to attachment box when toggling it on
Before this commit, when scrolling down in chatter and then
toggling on the attachment box, it opened the attachment box
outside of visible part of scroll view.

This commit fixes the issue by automatically scroll to
attachment box when opening it.

Task-2817838

closes odoo/odoo#110640

X-original-commit: 2d835da6b734f0d9fef05c191e93757d2d2f3b1a
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-01-23 11:20:23 +01:00
Romain Estievenart a10967214b [FIX] mail, test_mail: h-scroll broken on small screen
This commit add the missing `o_action_delegate_scroll` on the activity
view controller on small screen device to scroll the activity view
content only instead of the whole controller (i.e. control panel
included).

Steps to reproduce:

1. Open Project on small screen device like a smartphone
2. Open a Project like 'Office Design'
3. Switch to the Activity view and try to scroll horizontally
 => The whole activity controller currently scroll => bug

closes odoo/odoo#110531

X-original-commit: e4d6a8ad14abee72d61fd01d8b601acc6bfa2c49
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Signed-off-by: Romain Estievenart (res) <res@odoo.com>
2023-01-20 21:56:48 +01:00
tsm-odoo c40320eb15 [IMP] bus, *: remove bus service legacy session dependency
*: calendar, im_livechat, mail.

Before this commit, the legacy session was a dependency for the bus
service. This was problematic since one would need to import a bunch
of legacy files to fulfill this dependency in order to use it.

This commit removes this dependency. In order to pass parameters to
the `bus_service`, the `bus_parameters` service is now used.

closes odoo/odoo#110247

Related: odoo/enterprise#35974
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-01-19 12:30:44 +01:00
Aaron Bohy d0101c104a [FIX] mail,web: keep changes when changing followers/activities
Before this commit, all pending changes in a form view were lost
when the user added/removed/edited followers or created/edited
activities. In these cases, we want to reload the record, but we
also want to keep local changes. This commit restores the behavior
of previous versions.

Task 3132939

closes odoo/odoo#110246

X-original-commit: f3697e71c2d14e66509ab04bdccf3ef656cd9c8f
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-18 16:19:34 +01:00
Géry Debongnie 3a5060c691 [REM] mail: remove remaining form renderer override
The mail code had to override both new and old form views to add the
chatter feature.  Since we converted (almost) all uses of the legacy
form view to the new owl views, the old override is no longer necessary.

This commit removes it, and also removes the 'legacy_form' entry in the
registry so all screens should fall back to the new form view, which is
stable.

closes odoo/odoo#110168

Related: odoo/enterprise#35924
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-18 13:25:43 +01:00
Aaron Bohy 942fcbfb3a [FIX] *: views: add component instance to rendering context
Owl last update fixes the leaking `this` in rendering context of
templates called with `t-call-context` [1]. Since [2], we use the
`t-call-context` directive to control the rendering context of
templates compiled from an arch (e.g. in form and kanban views).
We can now better control what people use in archs, where we don't
want them to access js implementation details, as `this` is no
longer available.

However, the component instance still needs to be accessible in
the compiled template. We thus add the `__comp__` key in the
rendering context. Since we do not want people to access it in
archs, we add a check in the view validation that this string
isn't used in dynamic attributes.

[1] https://github.com/odoo/owl/commit/df59ec49aefce2e0913fdc1792d42b9680fb28b6
[2] https://github.com/odoo/odoo/commit/4c5b867ff6b0b674cb83d1a1262ae354ebaa6d57

X-original-commit: 264f313012aa99449d1576ae1110252c13755142
Part-of: odoo/odoo#110196
2023-01-18 10:16:12 +01:00
Thibault Delavallée 629ba0c392 [REF] mail: replace 'is_log' on composer by posting a note
RATIONALE

Improve usage of composer in comment or email mode: support batch-posting in
comment, support more configuration from templates, improve global model.

SPECIFICATIONS

Remove 'is_log' field on mail composer. Indeed its usage can be globally
replaced by using the 'note' subtype when posting. It is now better matching
the result of using the log a note mode of chatter.

Posting with a False subtype_id already automatically converts it into a
note subtype in 'message_post'. It is now done directly at composer level
to lessen magic and have more control on final output.

In case of outgoing emails subtype has no usage, as notification process is
not called. It is therefore forced to False when creating the mail records.

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

Part-of: odoo/odoo#99482
2023-01-17 20:58:40 +01:00
Thibault Delavallée 1a1acabd7b [REF] mail: cleanup mono/multi record composer behavior
RATIONALE

Improve usage of composer in comment or email mode: support batch-posting in
comment, support more configuration from templates, improve global model.

SPECIFICATIONS

Support a real res_ids field on mail.compose.message model. Instead of relying
on active_ids from context, store it once for all at composer level and use
it in code. Active_ids usage is still done at default_get level, using it to
populate the field.

Improve usage of domain, renamed to res_domain to match other document related
fields naming. Add support of a res_domain_user_id field allowing to set the
user from which the domain should be evaluated.

Composer now runs on a list of IDs. Mass mail mode and comment mode are now
distinct from running on a singleton or on more records. Rendered or raw
mode is not triggered by

  * mass mailing mode: always display raw mode, whatever the number of records;
  * comment mode: display rendered mode when having a single record (like the
    previous comment mode). Display raw mode when having either no records
    either at least two records.

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

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

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

SPECIFICATIONS

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

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

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

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

Task-2710804 (Mail: Clean MailThread Posting API)

Part-of: odoo/odoo#99482
2023-01-17 20:58:33 +01:00
Abdelouahab (abla) 798b4f76c4 [FIX] mail: reading property from undefined
To Reproduce
============
- add event on calendar
- edit the event and remove the user from participants list and add another one.
- save the record -> traceback

Problem
=======
we try to read `hasReadAccess` from `this.followedThread` that is `null` in this case.

Solution
========
check if `this.followedThread` is `null` or not

opw-3126545

closes odoo/odoo#109721

X-original-commit: f9a23af63bb5fe882f0d42f06ef1406910836115
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-01-12 12:27:15 +01:00
GorashandNicolas Lempereur 772cc29218 [FIX] mail: fix create link wrong escaping of html entities
Issue: `node.data` is an unescaped text content and used as an escaped
content just after (set `innerHTML`) which remove some of the escaping.

Without the fix, the 2 new first assertions would fail:

- first one with 'https://example.com/?¤cy_id' instead of
  'https://example.com/?&amp;currency_id' in the text node

- second one with `&amp;` replaced by & and `&gt;` replaced by >

other assertions ensure that use case before the fix (special char and
URL regex, smileys, ...) still work the same after the fix.

opw-2525028

Fixes #70485

closes odoo/odoo#109357

X-original-commit: 4938af5dd8bfb4ea0722e3de8340ff6437329b48
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Co-authored-by: Nicolas Lempereur <nle@odoo.com>
2023-01-10 17:51:50 +01:00
fdardenne e602a55503 [FIX] mail: activity view: luxon in rendering context
Since the refactoring of the activity view, luxon is not in the
rendering context. Resulting in crashing in some activity views
that used luxon in their template.

- Go to Appraisal
- Switch to the activity view
- Create a record in this view -> crash

Now, luxon is in the rendering context.

closes odoo/odoo#109153

Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-01-10 10:16:51 +01:00
fdardenne ca80a60199 [IMP] mail: activity view: allow to filter columns
Before, in activity view, it was not possible for users to hide
never used columns.

Now it is possible for users to hide and show columns in the
activity view.

task-3039919

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

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

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

Task-2833215

closes odoo/odoo#95817

Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2023-01-05 15:36:53 +01:00
Achraf 0c49994ea8 [FIX] mail: Escape translated emoji strings
Steps:
- Install knowledge on a fresh db
- Install and set fr_BE language
- Open knowldge
- Traceback

The traceback occurs because `emoji_registry.js` fails to load `emoji_data.js`
because of some translated string that contains non-escaped characters for JSON

opw-3110823

closes odoo/odoo#109086

X-original-commit: 455b335ae773ae4c8f5197c2a6f517947e6a7009
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-01-04 18:49:43 +01:00
Alexandre Kühn 2bc10b5328 [FIX] mail: load emoji data on focusing composer
Before this commit, typing an emoji source in composer like
emoticon `:)`, it may not substitute to the corresponding emoji.

This happens because the emoji substitution requires loading
emoji data. It was only loaded when opening the emoji picker.

This commit fixes the issue by lazy loading emoji data when
focusing the composer.

closes odoo/odoo#109035

X-original-commit: 066e8029c0d66974c59bfe9e430affb4bf0604b9
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-01-04 14:45:00 +01:00
Alexandre Kühn 524e214b3a [FIX] mail: support same emoji emoticons as in 15.0
X-original-commit: 53af21ec8f538da14b5df5ea6a512b9a51d3c9fa
Part-of: odoo/odoo#109035
2023-01-04 14:45:00 +01:00
Alexandre Kühn 732bb71628 [FIX] mail: improve add in model sorted field
Before this commit, processing of pinned channels during
init_messaging was slow due to sorting them in sidebar
of discuss.

This commit improves the sort so that we do a binary insertion
on add rather than push + quick-sort.

Before what took 2.2 seconds now takes around 0.6 seconds.

closes odoo/odoo#108839

X-original-commit: dd4c3c0a8e38147065980cf2c431b056a5253255
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-01-02 11:53:21 +01:00
fdardenne 89947487f3 [FIX] mail: activity view: add activity_ids in model domain
Since #107916, the ActivityModel did not include
`["activity_ids", "!=", false]` in its domain, causing incoherence in
some views and resulting in crashes.

To reproduce the issue:

- In the runbot, navigate to Website -> eCommerce -> Product.
- Switch to the activity view.
- Remove the Published filter.
- The view crashes due to an incoherence between the data records
  in the `web_search_read` and the `get_activity_data` calls.

This commit resolves the issue by correctly setting the domain.

closes odoo/odoo#108807

Signed-off-by: Luca Vitali <luvi@odoo.com>
2022-12-29 20:08:42 +01:00
luviandFlorent Dardenne 97cc94269d [REF] mail, *: convert Activity view to Owl
*: project, web

This commit converts the Activity view to the current framework shared by
other views. Instead of extending Kanban view/elements, the Activity view
has been implemented by its own.

The project customization of the view has also been converted, as legacy
files have been removed.

Some tests have been adapted since some classnames might differ from the old
implementation, resulting to failing tests. But the overall testing cases
have been conserved.

closes odoo/odoo#107916

Related: odoo/enterprise#35177
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Florent Dardenne <dafl@odoo.com>
2022-12-23 16:07:06 +01:00
Rahul Prajapati 5c83fc5e99 [IMP] mail: push to talk key display for space key
PURPOSE:

When the push to talk key is the "space" we show an "empty string",
which is very confusing and not very clear.

SPECIFICATION:

We display `Space` string instead of empty space.

Task-2794733

closes odoo/odoo#108573

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-12-23 12:11:11 +01:00
Aaron Bohy aa616d2880 [FIX] web,mail,project: ViewCompiler: warn if wrong usage
Kanban and form archs aren't owl templates. Kanban archs define
a (historically) qweb template ("kanban-box") which is html + some
directives (e.g. t-esc, t-foreach...) and extra tags (field, widget).
Form view archs are html + some extra tags (e.g. group, notebook,
field, widget...).

With the conversion of those views to owl, a door was left open:
one *could* use owl directives (for instance, t-on-click) in archs.
However, we don't want people to do that, as it would tie the archs
in database with js implementation details, which will then limit
the evolution of the js framework.

This commit adds warning when such forbidden directives are detected.
In master, we'll raise errors.

Part-of: odoo/odoo#108221
2022-12-19 16:49:02 +01:00
Pooja Kantesariya 1f7994efba [IMP] mail: add debug icon in discuss public page
Before this commit:

There is no debug icon in Discuss Public Page to show whether debug mode
is on or not.

After this commit:

Added a debug icon which will be visible when debug mode is on.

Task-2664824

closes odoo/odoo#97178

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-12-14 19:31:02 +01:00
Rahul Prajapati 57d33e78a8 [FIX] mail: emoji data for search and display in other languages
Before this commit:

Emoji data are all in English. Unable to use in other languages.

After this commit:

Emoji names and keywords are translatable for search and display purposes.
Emoji category names are translateable for display.

Task-3043336

closes odoo/odoo#107941

X-original-commit: ee5e0a201fb1980c1745692d366fd8539815773e
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-12-14 17:18:00 +01:00
Adrien Dieudonné 3d6599ac1f [FIX] mail, mass_mailing: chatter should take all width
In some case, we want that chatter takes the all space
available.

Steps to reproduce:
- Go to Email Marketing
- Click on any record
- Go to the Chat tab

closes odoo/odoo#107928

X-original-commit: cbbbc23800e2a00aab9af45087b5d3f7698823d8
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-12-14 15:36:45 +01:00
tsm-odoo 252f7f5f82 [IMP] bus: lazy start of the websocket
Before [1], the bus was started lazily: either as a consequence of
the addition of a channel to listen to or by manually calling the
`startPolling` method.

Before this commit, the websocket would have been started as soon as
the bus service starts which degrades performances.

This PR fixes the issue by re-introducing the same mechanism as before
that is by starting the websocket either by calling manually the `start`
method of the bus service or automatically when adding a channel.

[1]: odoo#75510

closes odoo/odoo#107878

X-original-commit: 5d7deacf54f37f0938b92a3c45c9f1d1325d1a9f
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2022-12-14 14:19:58 +01:00
Vincent Schippefilt 25c6c15a06 [IMP] base,*: remove __last_update from all models
The main goal of this commit is to reduce the size of the registry by
removing the (almost) useless __last_update field.

Statistics # of fields with all modules installed:
before 30184 fields, 1299x last_update (4.30%)

Before this commit, the computed field __last_update was added on every model.
The idea behind this field was to have a computed field that had either
the write_date or the create_date if the write_date was empty. However,
the write_date is always written, even on creation, making it useless
to have the computed field __last_update

After this update, we completely remove from BaseModel:
* __last_update
* CONCURRENCY_CHECK_FIELD that was always defined as "__last_update"
* _compute_concurrency_field that was the compute function for __last_update

closes odoo/odoo#105739

Task-id: 3062140 (part of 3062137 improve registry load time)
Related: odoo/upgrade#4038
Related: odoo/enterprise#33939
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-12-07 18:29:01 +01:00
Aaron Bohy 4c5b867ff6 [IMP] web,*: control form and kanban rendering context
Before this commit, the rendering context of kanban and form views
was the instance of the KanbanRecord and FormRenderer, respectively.
As a consequence, a lot of implementation details (e.g. "props",
"__owl__", any Class method...) were available. This wasn't what
we want.

The door being left open, people went through, and in 16.0, several
kanban and form archs contain(ed) such use of undesired "features".

With this commit, we restrict the rendering context of those two
views. In kanban views, it contains what has been historically
available (e.g. "record", "widget", "kanban_color"...). In form
views, nothing is available since the only dynamic part in those
archs is the attrs, which aren't evaluated by the rendering engine.

To do that, we use `t-call-context` owl directive. When using this
directive, the rendering context is the given one, + `this`. So the
component instance is still available, but through the `this`
keyword. We can thus use it in our compilers, to make them work as
before. Note that `this` can never be used in an arch directly.

Task 3085357

closes odoo/odoo#106045

Related: odoo/enterprise#34493
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-12-02 11:37:48 +01:00
Renaud Thiry 78a3738559 [IMP] mail, sms, livechat: update emoji picker
CONTEXT:

emoji_char_field and emoji_text_field
previously used the emoji_dropdown component
along with some utility functions to display
a very limited number of emojis.

As discuss now has a feature-full emoji picker
we aim to take advantage of it by bootstrapping
the picker from the existing components,
using a new javascript model for the
insert/update logic

AFTER THE CHANGE:

Users should be able to select the same emojis
they can use in the discuss chat in all fields
that previously featured an emoji picker.
Such as the livechat bot responses,
social posts, mailing subjects and
the sms message composer.

RELATED CHANGES:

Some tests are updated to use the pyEnv testing
'framework', as we now need to have access to
the messaging service to test these fields.

emoji_mixin is modified to match any emoji
character. The mixin is consolidated into
a single function is actually called anymore.

The text to emoji dict from emojis.js is removed
as it is no longer relevant where it was used.

The fields that used the emoji_mixin will no longer
trigger onChange on inserting an emoji.
However both the input and keydown event are fired
to allow fields using onchange_on_keydown
to trigger the onchange.

The emoji button was turned into an actual button
replacing the original span used in these fields.
This required a different approach to styling as
buttons inherently behave differently than spans.
The button is now moved using an empty div next
to the input and absolute positioning.

Most of the code used for char and text emoji
fields is consolidated into emojis_field_common.

task-3035021

closes odoo/odoo#104799

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-12-01 16:27:44 +01:00
Alexandre Kühn 8d445a6549 [FIX] mail: message text content should not be blank on window resize
Before this commit, when resizing window so that chatter swap
position, the text content of message disappeared.

This happens because OWL re-render the message view as completely
different DOM elements, while modeling in discuss code kept
identity of the MessageView. As a result, the message text content
was unchanged therefore it was not updated in the DOM, thus staying
blank.

This commit fixes the issue by enforcing setting the message text
content in DOM whenever the value is empty in DOM but the message
has logically some text content.

closes odoo/odoo#106978

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-12-01 14:34:18 +01:00
tsm-odoo 3cf5828af0 [FIX] mail: chatter attachments overflow
Before this PR, posting a message containing an attachment with a long
name in the chatter would result in the chatter overflowing the main
window. This is due to the fact that flex items cannot be smaller than
their content.

This PR fixes the issue by adding the `overflow-auto` class to the
chatter container in order to override the default `min-width: auto`
of flex items thus allowing them to be smaller.

closes odoo/odoo#106927

X-original-commit: 73fb78e75b6126586385ea7621b6d71fae715305
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-11-30 20:03:37 +01:00
Ivan Yelizariev 9f5050ce0d [FIX] mail: show activity groups with future items
When activity group (e.g. activities for Sale Orders) has future acitivities,
but not today or overdue activities, the group is deleted. This is not what we
want. In v15 it worked opposite way, but in v16 it was changed after js
refactoring. Variable name for `total_count` is confusing. It actually means
today activities + overdue activities [1]

[1] https://github.com/odoo/odoo/blob/1666ee5515996fab8a843b36b4fd93b776172f75/addons/mail/models/res_users.py#L237-L238

opw-3042616
opw-3063110

closes odoo/odoo#106482

X-original-commit: b5aaf7b4ab78af29feab85066f4888d3cded018a
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
2022-11-25 15:56:44 +01:00
Alexandre Kühn 3e0f44af37 [FIX] mail:tests: same current partner/user in pyEnv and user service
Before this commit, pyEnv.currentPartnerId and pyEnv.currentUserId
were not properly sync with userService.

This is not a big deal with current tests in discuss, as they do not
rely on userService. However, any test that do will likely fail.

This commit fixes the issue by imposing the `partnerId` and `userId`
in userService to the same as used in `pyEnv`.

We don't do the other way, because we must know the partner and user
before making the `env`, so at the time of creation of `pyEnv` from
`startServer`.

closes odoo/odoo#106446

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-11-24 19:25:19 +01:00
Aurélien Warnon bb58fdacba [FIX] base: allow user to modify its own preferences
The res.users model functions a bit uniquely since it should allow a user to
modify their own parameters but turns off model edition priviledges by default.
See "SELF_WRITEABLE_FIELDS".

This implies that ir_ui_view#_postprocess_access_rights method will by default
turn off record edition, by automatically adding a 'edit="false"' attribute on
the form node when the frontend calls 'get_views'.

This will in turn prevent the user from modifying its preferences as it will
set the form view in readonly mode.
(It was apparently ignored pre-OWL, hence why we only have this issue now).

To fix the issue, we force the edition by manually setting 'edit="1"' on our
"view_users_form_simple_modif" form.
Allowing the end-user to modify their own settings again.

A tour was added to ensure this behavior.
Note that tour steps need to be adapted in the 'hr' module, as this module
changes the flow of modifying user preferences.

Task-3067001

closes odoo/odoo#106440

X-original-commit: 490d480458590c205962c3f9b95a63790a59f4d3
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-11-24 19:25:16 +01:00
Alexandre Kühn e9bf6d732a [FIX] mail:tests: channel fetch preview filter no last_message
MockServer behaviour on fetching channel preview was different from
server. Thankfully no test rely on this slight behabiour, but it's
important to ensure same behaviour for future tests.

closes odoo/odoo#106357

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-11-23 18:15:50 +01:00
Renaud Thiry 629b904f32 [FIX] mail: focus on search bar after load
The logic to set the focus on the emoji search bar was only triggered
the first time any emoji picker was opened.

This makes sure the focus is processed every time a picker is opened.

task - 3035021

closes odoo/odoo#106315

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-11-23 13:24:56 +01:00
Louis Wicket (wil) 1cd529c43f [FIX] mail: fallback extension to mp3 when ogg fails to be played
closes odoo/odoo#106106

X-original-commit: 2a6e113eca016489e8ededcb8ba6a47d093c4b27
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2022-11-23 12:24:43 +01:00
Aurélien Warnon 965132df6f [FIX] mail,sms: restore "onchange_on_keydown" feature
Previously, we had an option on char/text fields called "onchange_on_keydown",
which allowed to trigger the onchange while the user was typing (instead of
when the field is blurred).

It was notably used when typing a phone number in the sms composer, to warn
the user that the phone number is invalid.

This feature was lost during the port to OWL, this commit restores it.

Task-3033107

closes odoo/odoo#106193

X-original-commit: 54def8969d49d6e5284cd97ab8df75e08043cd4e
Related: odoo/enterprise#34211
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-11-22 10:24:40 +01:00
Sébastien Theys c0f78e9d27 [IMP] base, web, mail: clean and move notification_alert
The code does not actually depend on mail features and it is intended to be used
in the base form view of user.

closes odoo/odoo#105415

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-11-14 18:17:49 +01:00