Commit Graph
17473 Commits
Author SHA1 Message Date
Chrysanthe (chgo) 83903d0a90 [FIX] web: add missing gap between PDF buttons
=== ISSUE ===

In some modules, there is a recurring layout issue with buttons being
compressed. This is caused by a missing `gap` or `margin` and
results in two main issues :

1/ It reduces the clickable zone of each button (you are more likely
to click on its neighbor rather than the one you wanted)

2/ It does not look good and causes inconsistency with other buttons.

=== AFTER ===

We simply add a `d-flex` and a `gap-1` class to the container to be sure
that no matter how many buttons are inside that <div> they will
always be spaced correctly.

task-3433602
part of task-3326263

closes odoo/odoo#129906

X-original-commit: 6fc57407478e79232e46c21e21981eeff419d884
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-07-27 16:14:26 +02:00
Aaron Bohy ffcd0bd156 [REF] web: remove expand parameters from web_read_group
The expand, expand_limit and expand_groupby allowed to ask
read_group to populate groups with search_read results directly.
It was only used in the list view, when `expand="1"` was set on
its root node in the arch. Since [1], the list view no longer uses
these arguments, as we uniformized the logic between list and
kanban (where groups are always opened by default).

[1] https://github.com/odoo/odoo/pull/114024

Part of task~3179751

closes odoo/odoo#129881

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-07-27 16:14:21 +02:00
Aaron Bohy 662e866340 [REF] web: remove unused underscore.js customization
Since [1], underscore.js is no longer used in Odoo and the lib has
been removed. However, we had a customization of the lib, that is
no longer used in any assets (it would crash it it was), but that
hasn't been removed. This commit removes it.

[1] https://github.com/odoo/odoo/pull/125889

Part of task~3439226

closes odoo/odoo#129875

Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2023-07-27 14:47:44 +02:00
tsm-odoo 48634b52b0 [FIX] mail, web: fix duplicate rpc when switching record
Since [1], switching from one record to another in a form view
would send two `/mail/messages` rpc. This is due to the
`onWillLoadRoot` hook that triggers a `MAIL:RELOAD-THREAD` event
while the thread is going to change. As a consequence, messages
are fetched for the currently active record and the one that will
be activated.

This PR fixes the issue by ensuring the thread won't change before
triggering this event.

[1]: https://github.com/odoo/odoo/pull/114024

closes odoo/odoo#129869

Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-07-27 14:47:42 +02:00
FrancoisGe 2d61351705 [IMP] web: update accepts commands for x2m
Before this commit, the record.update function did not allow x2m fields
to be updated. Thanks to this commit, you can update an x2m by passing
a list of commands that will be applied to the x2m's static list.

This makes it possible to update several fields, including x2m fields,
while triggering only one onchange to the server.

closes odoo/odoo#129507

Related: odoo/enterprise#44532
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-07-27 14:47:00 +02:00
Romeo Fragomeli e8f7b13414 [FIX] web: domain selector background color
This commit, remove the not mandatory CSS rule on the input for the
`Domain Selector` modal, and so the input uses the transparent color.

Steps to reproduce:
* Open Odoo (Enterprise)
* Activate the dark mode
* Open a App (e.g.: Contact)
* Add a filter in the search bar
* Click on the filter icon in the facet
  => The background inputs are white with white text color => BUG

closes odoo/odoo#129842

X-original-commit: d36505edec607161c6884892e8de34d42a10f207
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2023-07-27 13:25:04 +02:00
Bastien PIERRE 65242e31e9 [IMP] *: Remove alias in JS files
Rename all imports with alias old system to the new js module system
Task ID: 3266759

closes odoo/odoo#127414

Related: odoo/design-themes#671
Related: odoo/enterprise#43716
Signed-off-by: Bastien Pierre (ipb) <ipb@odoo.com>
2023-07-27 11:58:34 +02:00
Samuel Degueldre 9d6f23c20b [FIX] web: avoid monokai ace editors leaking memory in qunit suite
When attempting to instantiate an ace editor with a given theme, ace
will first create the editor with the default theme (textmate) which is
always loaded, and register a callback to be called after the
non-default theme has been loaded. This callback holds a reference to
the editor's renderer which can itself retain large objects such as an
entire owl application. These callbacks are not cleared even if the
corresponding editor is destroyed.

Because in tests, the theme "monokai" was not included and ace cannot
load it on its own, all tests that attempt to create an ace editor with
that theme will leak memory. This commit fixes the issue by adding
theme-monokai to the qunit suite assets.

closes odoo/odoo#129813

X-original-commit: e8c77c5737c2170bb6b53d3e667aec7318dde5b8
Related: odoo/enterprise#44653
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-07-27 10:32:56 +02:00
Julien Carion (juca) 3af4bffeee [IMP] web, mail, hr: Avatar card preview
This commit adds the possibility to see additional information about a
user with a card that appears when hovering avatar user fields for a
set amount of time. This card contains the following information:
- Avatar
- Chat status
- Name
- Email
- Button to send message
and with HR installed:
- View profile Button
- Job position
- Department
- Phone number
- Advanced chat status (when hr_holidays is installed)

Task-3167110

closes odoo/odoo#121943

Related: odoo/enterprise#44563
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-07-26 19:18:49 +02:00
Aaron Bohy cf4e844aca [REF] web,*: remove legacy DataManager
The DataManager is no longer used as all views and models have
been converted to wowl.

Part of task~3439226

closes odoo/odoo#129725

Related: odoo/enterprise#44611
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-07-26 13:22:13 +02:00
Aaron Bohy e9d3e27792 [REF] web,*: remove legacy web_client/pseudo_web_client
*mrp_subcontracting,project

This commit removes two legacy js modules that are no longer
necessary.

Part of task~3439226

Part-of: odoo/odoo#129725
2023-07-26 13:22:13 +02:00
Aaron Bohy f40d4dc98b [REF] web,*: remove some legacy test helpers
Part of task~3439226

Part-of: odoo/odoo#129725
2023-07-26 13:22:12 +02:00
Hubert Van de Walle (huvw) f478310d17 [FIX] web: prevent rollback in ace_field
Steps to reproduce
==================

- Enable debug mode
- Go to Settings / Technical / Automation / Automated Actions
- Set "Action To Do" to "Execute Python Code"
- In the code editor, type really quickly

The code is briefly focused and when the next input is processed,
everything is erased.

Cause of the issue
==================

The AceField makes a debounced commit with the current editor value.
This triggers an onChange event, and upon receiving the results,
we update the editor value with the resolved value.
Although the editor value may have changed in the meantime,
we still revert it to the previous value.

Solution
========

There is no need to update the record every 10ms. We can simply to that
on blur. This is also what was done in 16.2.

opw-3379740

closes odoo/odoo#129694

X-original-commit: 4047ed03117fbcd5634843e29dc82e7ffb71b910
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2023-07-26 13:22:09 +02:00
Géry Debongnie db5b2ade8d [IMP] web: update owl from 2.1.4 to 2.2.3
Release notes:
https://github.com/odoo/owl/releases

Commits:
[FIX] app: sync destroy everythig when app is destroyed
[FIX] tools: include proper version number in released build
[IMP] runtime: add support for Map and other iterables in t-foreach
[IMP] runtime: only destroy component in raf callback
[REF] runtime: simplify implementation of batched
[FIX] compiler: allow t-model.number to work with select
[FIX] devtools: Fix crash when no root node
[FIX] devtools: fix/imp env display
[FIX] devtools: fix symbols handling and display

closes odoo/odoo#129438

X-original-commit: b1a13ad11f7f59632dbfb7de6dae0e57b7d44b02
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-07-26 12:00:25 +02:00
Alexandre Kühn f42927c965 [FIX] web: autoresize input correctly in Safari 16
Before this commit, autoresize input in Safari 16 had their
size underestimated, thus truncating the content.
For example, in the Discuss app, the header is a (disabled)
autoresize input, which becomes enabled when the thread can be
renamed. This is also used for threads that cannot be renamed
for consistency of style. So some screens like "Inbox" had its
name truncated to "In...".

This problem is only present in Safari, not in Chrome or Firefox.
Apparently the sizing of input and textarea is incorrect, and it is
fixed in Safari 17. Indeed, Safari 17 can be tested with Safari
Technology Preview where the bug is not present.

This commit fixes the issue by adding an offset to computing the
scroll width of autoresize input, so that it matches the Safari 17
behaviour that is correct.

closes odoo/odoo#129698

X-original-commit: cd9d900c93d22fec1c24dc3b1e77230f80191f04
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-07-26 09:22:41 +02:00
Damien Bouvy f6dea9b6fe [FIX] web: list-specific binary field design
Instead of sho-horning full buttons inside a list view cell, use inline
buttons instead.

closes odoo/odoo#129679

X-original-commit: 76a4995b5037957bb5d7b1b2e04c44267273f7fc
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2023-07-26 09:22:24 +02:00
Damien Bouvy b7a742cc7e [FIX] web: highlight search facet icon on hover
X-original-commit: 643ce1255c90e944f11ff5b4fd5e47f7bf5aff6d
Part-of: odoo/odoo#129679
2023-07-26 09:22:24 +02:00
Damien Bouvy c3742f76c7 [FIX] web: padding on collapsed breadcrumb
X-original-commit: 121a9f4ec6bcb572915be1b2e26abc9944a07f9d
Part-of: odoo/odoo#129679
2023-07-26 09:22:24 +02:00
Elisabeth Dickinson f6cab04cef [FIX] web: replace calendar navigation icons
In commit c0b354e14a18667463451aa6fe768bffcbb9da9a the intention was for
the calendar navigation to look like the gantt one. The arrows have been
replaced by the same `oi` icons as the gantt view's navigation.

task-3410165
part of task-3326263

closes odoo/odoo#129568

X-original-commit: c9384d12b903850f9535ca7b82ea2ef0e04fd39b
Related: odoo/enterprise#44556
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-07-26 09:22:07 +02:00
Elisabeth Dickinson 41c9bccf6e [FIX] web, *: fix buttons squashing and spacing
*: calendar, google_calendar, microsoft_calendar;

task-3410165
part of task-3326263

X-original-commit: b680a6ac5769bf8e02921a9548792c7696992955
Part-of: odoo/odoo#129568
2023-07-26 09:22:07 +02:00
Antoine (anso) 51458c3704 [FIX] web: fix folded kanban header's drag and drop state
Prior this commit, there was a problem with borders that were not
displayed on the kanban header when the stage was folded and the user
was trying to drag and drop in that stage.

This commit removes the background set on `.o_kanban_header` when the
stage is folded, so it doesn't overlap and hide the border set on
`.o_kanban_group`. We can do that safely because a folded stage
can't be scrolled

task-3423682
part of task-3326263

closes odoo/odoo#129560

X-original-commit: b6cb9fed6aa46591e692e67267a7419fe15f8c68
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-07-26 09:22:04 +02:00
Elisabeth Dickinson 18016c4504 [IMP] web: improve calendar view
Prior to this commit, the `font-size` of the days and week numbers in
the Month view were very large.
There were also a couple of issues with the background circles
highlighting days on hover or "today". In both Month and Year view
they were oval instead of circular, and in the `ui-datepicker` they
would hide the number if they happened to be in the previous or next
month.

To fix the font issue the `font-size` styling on
`fc-day-number` and `fc-week-number` has been removed.
For the roundness of the circle, a `:before` element was needed, .
And for the `ui-datepicker`'s circle a simple `position-relative` on
both the `td` and the `a` or `span` fixed the issue.

task-3326564
part of task-3326263

closes odoo/odoo#129559

X-original-commit: 8fac3dd7dd6ffc69f989c9ec5cea225f3e919535
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-07-26 09:22:01 +02:00
FrancoisGe c011eaea59 [FIX] web: create kanban column groupBy x2many
Before this commit, in a kanban view grouped on a x2m, when we created
a new column, we had a crash.

Why did this happen?
When a column is created, a resequence is triggered on the columns in
order to have the correct position. Currently, we always use the
DynamicGroupList handle field, which is not correct because if we are
grouped on an x2m we use another resModel, so we want to use the default
handle field (sequence).

closes odoo/odoo#129510

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-07-26 09:21:59 +02:00
FrancoisGe a70442ae2c [FIX] web: o2m save dialog form and discard main form
Before this commit, discard management was incorrect when you had a
non-editable x2m. This could result in changes not being completely undone.

How to reproduce:
- Go to a form view with an uneditable x2m
- Click on a record in the x2m
- Edit the record in the form view dialog
- Click on save
- Reopen the same record
- Click on discard
- Click on the discard in the main form view
- Reopen the same record

Before this commit:
    The change applied is still present

After this commit:
    The applied change is no longer there. The original state has been restored.

closes odoo/odoo#129509

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-07-26 09:21:56 +02:00
Aaron Bohy bc95c6a348 [REF] web,*: remove legacy client action support
This commit removes a lot of legacy code that we kept for the few
legacy client actions that were still to be converted to owl. Now
that the last one has been converted, we can finally get rid of a
lot of legacy code (ActionAdapter, ActionMixin, ControlPanel,
ActionMenus, DropdownMenu(Item), Pager, DomainSelector...).

Part of task~3439226

closes odoo/odoo#129314

Related: odoo/enterprise#44465
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-07-25 17:35:47 +02:00
mehjabinfarsana 676f723c96 [IMP] web: open my odoo.com account in new tab
before this commit, the usermenu My Odoo.com account
was opening in the same tab

after this commit My Odoo.com account usermenu is
opening in a new tab

closes odoo/odoo#123627

Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2023-07-25 17:35:27 +02:00
Aaron Bohy f16e23c23f [IMP] web: orm service: add "webRead" function
This commit adds a shortcut in the orm service to call the new
"web_read" python method and adapts the few calls to use it.

closes odoo/odoo#129502

Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-07-25 13:26:37 +02:00
Géry Debongnie 286cc97dd4 [IMP] web: allow lang to be overriden by url query params
With this commit, it is possible to load the web client in a language
different than the user by using the `lang=` query string in the url:
For example, `/web?lang=en_US`

This is useful when we need to quickly check something, without changing
the current user settings. Note that it will only work if the url lang
has been installed on the database (if lang does not exist, it will fall
back to en_us).

closes odoo/odoo#128121

Taskid: #3420252
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-07-25 10:35:41 +02:00
vishal padhiyar f4f0a82b84 [FIX] web_{editor}: add missing args in position callback
Before this commit:

When attempting to open a dynamic placeholder in email marketing, a traceback
occurs.

After this commit:

Now the dynamic placeholder works properly.

Task-3373356

closes odoo/odoo#129415

X-original-commit: bb9fb402a135baf7e7b9da9bbb40888f5323ded9
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-07-25 08:19:01 +02:00
Damien Bouvy e461e4e957 [IMP] web: better placeholders in the base report layouts
Include placeholders meant for the new studio editor engine.

X-original-commit: 87f66c19d5c1d27e2afa0aae697b768334275c88
Part-of: odoo/odoo#129492
2023-07-25 00:54:52 +02:00
Louis Wicket (wil) 42bf1dc576 [FIX] web: make remaining days field fully translatable
Prior to this commit,
```xml
<t t-elif="days gt 1">In <t t-esc="days" /> days</t>
```
resulted in two separate translations: “In” and “days”.
This commit fixes the problem by explicitly putting the full text in a
gettext.

closes odoo/odoo#129388

X-original-commit: d278fc234540120e86733c2131515a5223d92c87
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-07-24 23:03:54 +02:00
Louis Wicket (wil) 911195fbbc [FIX] web: make “Developer Tools” translatable
The title of the “Developer Tools” section of the settings is not
translatable. This is because the extractor ignores nodes that are OWL
components. This commit solves the problem by moving the text to be
translated elsewhere.

closes odoo/odoo#129386

X-original-commit: e91370aed41847f9c89bb6ab590f929e6935ac12
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-07-24 21:27:42 +02:00
Andrea Grazioso (agr-odoo) 17a0ec17b5 [FIX] web: table border still present in pdf
Set Document Layout to "Light" (the default)
Print an Invoice
Open in chrome (tested in Chromium Version 114.0.5735.198)

Issue: border right after table header is still visible
Note: It is reader dependent, as it may not occur with other browser or pdf
reader

opw-3324785

closes odoo/odoo#129275

X-original-commit: 28eedfeec2531c0ebfbdeb4024abad967d450a0d
Signed-off-by: Andrea Grazioso (agr) <agr@odoo.com>
2023-07-24 20:18:16 +02:00
Aaron Bohy 84d199b6ed [REF] web: RelationalModel: move _askChanges from record to model
_askChanges doesn't apply on a single record, it asks all fields
of all records of the current model to send their changes, so it
makes more sense to have this function on the model instead.

Part of task~3179751

Part-of: odoo/odoo#114024
2023-07-24 20:17:57 +02:00
Jorge Pinna Puissant 3967dab0ce [REF] web: RelationalModel: do not change resId in Record
With this commit, we ensure that the resId of a Record datapoint
never changes. The only exception is for new records: their resId
can go from `false` to their actual id when they are created. When
we want to load another record, we must use the `load` function of
the model, which now accepts `resId` (and `resIds`) as param, when
the root is a "mono record".

As a consequence, the instance of record datapoint now changes when
using the pager. This required some changes in the AceField, to
make it properly react in that case. We took the opportunity to
simplify its implementation (several keys in the state were useless).

Part of task~3179751

Part-of: odoo/odoo#114024
2023-07-24 20:17:57 +02:00
Aaron Bohy 65c8f41cf3 [FIX] web: Record: complete relational values
Now that the RelationalModel is based on unity, datapoints expect
to receive their data as returned by unity read (i.e. x2many values
are list of records, not ids, and many2one values are objects with
keys id and display_name, not tuple, or simple ids). As a
consequence, the Record component needed to be slightly adapted for
current usecases to continue working (e.g. using a Record component
for a Many2ManyTags field, and providing the value of the many2many
as a list of ids, like in the studio action editor sidebar).

This commit completes the relational values received by the Record
component with the related records, like if they were read by
unity.

The Record component's API will be reworked soon, now that the
new RelationalModel has been merged, to be more compliant with the
new unity concept.

Part of~3179751

Part-of: odoo/odoo#114024
2023-07-24 20:17:57 +02:00
Aaron Bohy 0994e0ff6d [FIX] web: Many2ManyCheckboxes: batch changes
Have a many2many field with widget many2many_checkboxes. Before
this commit, the widget notified the model (i.e. called replaceWith
on the static list) for each change of one of its checkboxes. This
means that if the was an onchange on the field, the onchange rpc
was done once for each click. With this commit, we debounce the
call to replaceWith, which allows to tick/untick multiple
checkboxes, and a single onchange is done with the resulting value.

This allows to mitigate another issue, which is that consecutive
calls to replaceWith are error prone, because they might send a
list of ids which isn't up to date with the one of the last call
to replaceWith (if the list is computed from the value in the
datapoint), as replaceWith uses the model mutex and thus updates
the datapoint in an async way. This specific issue will be tackled
later.

Part of~3179751

Part-of: odoo/odoo#114024
2023-07-24 20:17:56 +02:00
Pierre Rousseau e02da4224a [REF] web: RelationalModel: commit changes in _updateConfig
This commit adds an option to _updateConfig which allows to specify
a callback to apply the new values obtained from the updated config
e.g.
 1) a dynamic list updates its offset (calls _updateConfig)
 2) a web_search_read is done and returns some records
 3) the new config (with the new offset) is applied on this.config
 4) record datapoints are created for the returned records and set
   on this.records of the list

Before this commit, step 3) was done in _updateConfig, and step 4)
was done by the called of _updateConfig. As _updateConfig is async,
step 4) was actually done in the next microTick after 3). As a
consequence, those two mutations could trigger owl renderings.

To avoid this situation, _updateConfig now takes a "commit"
function, which allows it to execute 3) and 4) in the same tick.

Part of~3179751

Part-of: odoo/odoo#114024
2023-07-24 20:17:56 +02:00
Jorge Pinna Puissant a41e5ff690 [FIX] web: allow x2many fields without relation_field
Have a field x2many without relation_field.

Before this commit, a server error was raised because, we send changes
for the non-existing field (relation_field).

Now, we only send to the server the changes for relation_field only if
they exist.

Note that, this commit will also add an exception on the server mock
onchange if we sent changes for non-existings fields.

Part of task~3179751

Part-of: odoo/odoo#114024
2023-07-24 20:17:56 +02:00
Jorge Pinna Puissant 2129d774a2 [FIX] web: do not read if field spec is empty
Have a view with many2many_checkboxes field (e.g. product.template
form view with inventory installed, and some routes). Tick a
checkbox. Before this commit, a read was done, but the field spec
was empty (there was no field to read). So basically the read only
returned the id. This is obviously useless. This commit prevents
from doing read rpcs when the spec is empty.

Part of task~3179751

Part-of: odoo/odoo#114024
2023-07-24 20:17:56 +02:00
Aaron Bohy 0df1f4d439 [FIX] web: forget command for nested x2many in form, not in list
Have a form view with an x2many field A displayed as a non editable
list view. In A's form view, there's an x2many field B, which isn't
in the list. B is itself displayed in the dialog form view as a
list, which contains an x2many fields C displayed as many2many_tags.

A contains a record. For this record, B contains also a record,
which contains two tags for C.

Have an onchange on the main record which triggers an update command
for the record in A, such that the command also updates the record
in B, which deletes (or forgets), i.e. commands 2 or 3, a tag C.

Before this commit, if the user opened the x2many record of A after
the onchange, it didn't displayed the remaining tag in C. The
reason is that we received commands to remove the tag before we
actually fetched them (as we don't need them for the list of A).
The tags were then fetched when we opened the record in a dialog,
but we didn't correctly merge the values read from the server with
the commands we received earlier.

With this commit, we properly store the commands and apply them
after reading the values.

Part of task~3179751

Part-of: odoo/odoo#114024
2023-07-24 20:17:55 +02:00
Aaron Bohy 0e2d8eeabe [FIX] web: o2m multi page command forget second page
Have an x2many list or kanban with several page, and an onchange
on the main record that returns forget or delete commands for
x2many records that aren't on the first page. Before this commit,
it crashed, because the code expected the records to be in
this.records (the record of the current page).

Part of task~3179751

Part-of: odoo/odoo#114024
2023-07-24 20:17:55 +02:00
Pierre Rousseau 30d2e224d8 [IMP] web: image field: add option to bypass image reloading
With the image field widget, the image is reloaded each time the record
is updated (when `write_date` is updated). This is not always desirable
as some images are not supposed to change.

This commit adds an option to bypass the image reloading. This option
is called `no_reload` and is set to `false` by default.

Part-of: odoo/odoo#114024
2023-07-24 20:17:55 +02:00
Jorge Pinna Puissant 88b4938b7c [FIX] web: one2many, await onchange when resequence
- On an one2many;
- drag and drop two records;
- a resequence is called, with an onchange;
- click save;

Before this commit, if the network was a little too slow, the return of
the onchange wasn't taken it into account for the save.

Now, we await the onchange of the resequence before executing another
action.

Task 3179751

Part-of: odoo/odoo#114024
2023-07-24 20:17:55 +02:00
FrancoisGe 5e684776d3 [FIX] web: view with a record without properties crash
Before this commit, going into a view with a record that had no properties displayed a crash.

Why ?
If no properties exist, the value is false and was not handled.

Part-of: odoo/odoo#114024
2023-07-24 20:17:54 +02:00
Aaron Bohy c80f76da56 [REF] web: specialize useModel for sample data
Before this commit, there was a hook, named useModel, which eases
the use of a model in views. The main (and almost only) role of the
hook was to deal with sample data (determine whether or not they
can be enabled, fallback on the sample orm when necessary, leave
sample mode at reload...). This hook is used by all views except
form and activity as they do not implement sample data.

This commit renames that hook into "useModelWithSampleData" and
introduces a new hook "useModel", which is a lot simpler that the
other one, as it's only goal is to do the plumbing between the
component using the hook and the model (i.e. spawning required
services and loading the data on willStart and willUpdateProps).
This new hook is used in form and activity views.

Note that useModel doesn't trigger deep renderings, as it is only
used on the RelationalModel which is based on fine-grained
reactivity.

Part-of: odoo/odoo#114024
2023-07-24 20:17:54 +02:00
Aaron Bohy e325603172 [FIX] web: form: do not reload record before leaving
...when using the pager.

When a record is dirty and the user clicks on the pager to go to
the next/previous one, it is automatically saved. Before this
commit, the record was reloaded after the save, which is useless
as we're leaving it anyway. This commit ensures we only save, and
we do not reload.

Part-of: odoo/odoo#114024
2023-07-24 20:17:54 +02:00
FrancoisGe 49b7328376 [FIX] web: evalContext must contain the x2m currentIds
Before this commit, the x2m present in a record's evalContext was
represented by the resIds defined in the config. It therefore did not
contain the current changes. It should therefore be represented by the
currentIds of non-virtual records.

How to reproduce:
- Create a new record with a m2m field having at least one default record
- Edit a field which triggers an onchange with a context depending on the
  value of the m2m

Before this commit:
  The domain and context used contain an empty list for the m2m.

After this commit:
  The domain and context used contain a list with the default id for the m2m

Part-of: odoo/odoo#114024
2023-07-24 20:17:54 +02:00
Aaron Bohy 0a64516858 [FIX] web: form: do not add display_name if in dialog
In form views, the "display_name" field is automatically added to
the list of activeFields as we need its value to display in the
breadcrumbs. However, this isn't necessary when there's no control
panel, in particular in dialogs. Without this commit, the test
"test_addremove" of addon test_apikeys didn't pass.

Part of task~3179751

Part-of: odoo/odoo#114024
2023-07-24 20:17:53 +02:00
Aaron Bohy c98f050435 [FIX] web: x2many onchange: always send id of parent record
Be on an existing record containing an x2many field. Add a row
or click on an existing one to edit it. The changes sent for
onchange done for the subrecord contains a key with the changes
in the parent record. Before this commit, this object didn't
contain the id of the parent record. As a consequence, the
onchange (in py) couldn't correctly link the sub record with
its parent to compute field values. This commit ensures that we
always provide at least the id when the parent record exists.

Part of task~3179751

Part-of: odoo/odoo#114024
2023-07-24 20:17:53 +02:00