Commit Graph
3107 Commits
Author SHA1 Message Date
Denis Ledoux ef16e96255 [FIX] base, web: graph and pivot views requires more field descriptions
Following odoo/odoo@4636620004
`get_views` only pass the model fields included in the view architecture,
except for the main model when the search views is requested.
Because the search views requires all fields for the user to be able
to make advanced filters and advanced group by using any fields of the
model.

However, other views requires more field descriptions as well than
just the fields included in their architecture:
- the graph view requires all integer and float fields,
    to automatically add suggestions of measures in the measures dropdown
    menu. It's a bit like the search view, the user should be able
    to choose any measure available in the model
    (as long as this is integer or float fields)
- the pivot view requires all groupable fields,
    so the user can group by any groupable fields of the model.

The JS MockServer `getViews` is adapted to include the changes added by the above
revision as well as the current revision,
for the qunit tests suite to be able to reflect these API changes
from the server side.

closes odoo/odoo#100376

Related: odoo/enterprise#31427
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-09-17 00:51:34 +02:00
Aaron Bohy c31a159b4e [FIX] web: ListView: do not show handle column if grouped
The HandleField widget should not be displayed in grouped list
view, probably because we do not support the resequence feature
in this situation. This is the legacy spec.

In the wowl ListView, we didn't implement this restriction. As
a consequence, some list views (e.g. DebugMenu > Open View) didn't
render correctly when grouped, because the presence of the handle
field (which is aggregatable) didn't leave any space to display
the group titles.

closes odoo/odoo#100356

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-17 00:51:29 +02:00
Aaron Bohy 31c975ae94 [FIX] web: ListView: correctly format group aggregates
Before this commit, if a grouped list view contained an aggregatable
field (e.g. a float field) with a widget for which there's no
associated formatter (e.g. progressbar), the aggregate value was
left unformatted. It was for instance the case in the "My tasks"
list view, with the field "progress".

With this commit, the value is formatted according to the field
type, as expected.

Part-of: odoo/odoo#100356
2022-09-17 00:51:29 +02:00
Xavier-Do c61c4a4068 [IMP] web: log qunit for each tests
A previous version tried to log qunit by module but it is still possible
to have multiple random errors in the same test occuring with different
combination. This will help to avoid duplicating automatically
parsed errors in this case.

Also skips the message if it is emppty/undefined.

Part-of: odoo/odoo#100238
2022-09-16 20:52:08 +02:00
Simon Genin (ges) 7fcee56737 [FIX] web: fix grouped kanban hasData
Before: In a grouped kanban view, if all the groups are set to folded
by default, the view incorrectly thought it had no record. They were
simply not loaded and some method was not fetching the right data to
get the number of records.
It resulted in displaying the demo data and the no content helper,
making it impossible to see the actual data.

After: The number of records, despite no being fetch, is correctly used
in hasData and showNoContentHelper to fix the wrong behavior.

closes odoo/odoo#100234

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-16 20:52:04 +02:00
Jorge Pinna PuissantandLucas Perais e234810faa [FIX] web: SettingsPage propagate NoContentHelper slot
Before this commit, we propagate all the slots to the SettingsPage. This
could raise an issue if the default slot (propagated) has a content, for
more information see: https://github.com/odoo/owl/issues/1256

Now, to avoid this, we only propagate the slots that are used on the
SettingsPage component, ie: NoContentHelper.

closes odoo/odoo#100362

Signed-off-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
2022-09-16 16:20:49 +02:00
Dardenne Florent (dafl) af89b46c5b [IMP] web: DomainSelector: enhance user experience
The purpose of this commit is to improve the domain selector UX with
multiple little changes:

- The model field selector popover is now autofocused when opened
- Removal of a div that appeared during a hover on "add leaf" and
"ellipsis button"
- Caret icon next to the root node selector
- Minor CSS changes

task-2861497

closes odoo/odoo#99321

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-16 14:25:21 +02:00
Dardenne Florent (dafl) bd8afccf16 [IMP] web: Dropdown: add caret props
Before, the small "caret" to the right of the dropdown was only
 displayed if the current Dropdown was a child of another Dropdown.

It is sometimes necessary to display this caret in a parent
 `Dropdown` in order to make the user understand that there is a
  dropdown if he clicks on the text.

Now, it is possible thanks to a props to display manually this carret
 if desired.

Part-of: odoo/odoo#99321
2022-09-16 14:25:20 +02:00
Odoo's Mergebot 4e82c45abd [IMP] core: store translated fields as JSONB columns
[IMP] core: store translated fields as JSONB columns

Translated fields no longer use the model ir.translation.  Instead they store
all their values as JSON, and store them into JSONB columns in the model's
table.  The field's column value is either NULL or a JSON dict mapping language
codes to text (the field's value in the corresponding language), and must
contain an entry for key 'en_US' (as it is used as a fallback for all other
languages).  Empty text is allowed in translation values, but not NULL.

Here are examples for a field with translate=True:

    `NULL`
    `{"en_US": "Foo"}`
    `{"en_US": "Foo", "fr_FR": "Bar", "nl_NL": "Baz"}`
    `{"en_US": "Foo", "fr_FR": "", "nl_NL": "Baz"}`

Like before, writing False to the field makes it NULL, i.e., False in all
languages.  However, writing "" to the field makes its value empty in the
current language, but does not discard the values in the other languages.

Here are examples for a field with translate=xml_translate:

   ` NULL`
    `{"en_US": "<div>Foo<p>Bar</p></div>", "fr_FR": "<div>Fou<p>Barre</p></div>"}`

Change for callable(translate) fields: one can now write any value in any
language on such a field.  The new value will be adapted in all languages, based
on the mapping of terms between languages in the old values.  Basically the
structure of the value must remain the same in all languages, like before.

Reading a translated field is now both simpler and faster than the former
implementation.  We fetch the value of the field in the current language by
coalescing its value with the 'en_US' value of the field:

    `SELECT id, COALESCE(name->>'fr_FR', name->>'en_US') AS name ...`

The raw cache of the field contains either None or a dict which is conceptually
a subset of the JSON value in database (except for missing languages).  For the
sake of simplicity, most cache operations deal with the dict and return the text
value in the current language.

Trigram indexes have been adapted to the new storing strategy, and should enable
to search in any language.  Before this change, only the source value of the
field ('en_US') could be indexed.

Computed stored translated fields are not supported by the framework, because of
the complexity of the computation itself: the field would need to be computed in
all active languages.  We chose to not provide any hook to compute a field in
all languages at once, and the framework always invokes a compute method once to
recompute it.

Code translations are no longer stored into the database.  They become static,
and are extracted from the PO files when needed.  The worker simply uses a cache
with extracted code translations for performance.  This is reasonable, since
fr_FR code translations for all modules takes around 2MB of memory, and the
cache can be shared among all registries in the worker.  Changing code
translations requires to update the corresponding PO file and reloading the
worker(s).

Performance summary:
(+) reading 'model' translated fields is faster
(+) reading 'model_terms' translated fields is much faster (no need to inject
     translations into the source value)
(+) searching translated fields with operator 'ilike' is much faster when the
     field is indexed with 'trigram'
(+) updating translated fields requires less ORM flushing
(-) importing translations from PO files is 2x slower

Some extra fixes:
- make field 'name' of ir.actions.actions translated; because of the PG
   inheritance, this is necessary to make the column definition consistent in
   all models that inherit from ir.actions.actions.
- add some backend API for the web/website client for editing translations
- move methods get_field_string() to model ir.model.fields
- move _load_module_terms to model ir.module.module
- adapt tests in test_impex, test_new_api
- because env.lang is injected into SQL queries, its returned value is
   now guaranteed to correspond to a valid active language or None
- remove wizard to insert missing translations (no longer makes sense)

closes odoo/odoo#97692

Task-id: 2081307
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-09-16 14:25:13 +02:00
Achraf (abz) 8d4bb8c109 [FIX] web: Allow to hide model in ReferenceField
In legacy, hide_model attribut on FieldReference was used to hide
the model input, but it was not implemented in ReferenceField
(new version).

closes odoo/odoo#99819

Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2022-09-16 10:09:26 +02:00
Chong Wang (cwg) b43d117e0e [IMP] web, web_editor: translation dialog for new translate api 2022-09-15 22:37:50 +02:00
Mathieu Duckerts-Antoine 48801a0d40 [FIX] web: graph: use attribute order
For now, the graph view completely ignores the order attribute set on
its arch root node if written in the correct way, i.e. with "asc" or
"desc" (lower case). We fix that.

closes odoo/odoo#100302

X-original-commit: 0fb64bef16914937cf4a1d1618fb58ade6d16f14
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-09-15 20:17:54 +02:00
Julien Mougenot 40c81b3d8f [FIX] web: Apply correct active fields on quick created records
Before this commit, a record quick created in kanban would have values
left from the quick create form view in its `data` object, that would
then be used by the model of the parent view to perform onchange
actions.

This would cause a crash if said values were set on a field not included
in the parent view's active fields.

In this commit, records data are cleared at each load, ensuring that
they only contain values for their current active fields.

closes odoo/odoo#100182

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-15 19:21:11 +02:00
Julien Mougenot f26f555f0c [FIX] web: Correctly unpack groups data in kanban
Before this commit, the groups returned by `web_read_group` were
unpacked using the current 'group by' field name, and not the entire
'group by' value (potentially including a granularity for date/datetime
fields). This caused mismatches in some cases and the value couldn't be
retrieved.

Also, a needless 'sum_field' parameter was passed to the
'read_progres_bar' calls, which does not exist in the request API.

This commit fixes the first issue and removed the excess parameter.

closes odoo/odoo#100149

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-15 19:21:06 +02:00
Julien Mougenot d20de3113e [FIX] web: Fix mock server read_progress_bar
This commit aims to make the behavior of the mocked 'read_progress_bar'
requests closer to their server implementation.

Namely, the returned dictionnary is supposed to contains the display
names of the current groups in its keys. This was not the case and has
been fixed.

Part-of: odoo/odoo#100149
2022-09-15 19:21:06 +02:00
Mathieu Duckerts-Antoine 774aaa4984 [REF] *: remove legacy graph and pivot views
Now that web_studio no longer uses the legacy graph and pivot views and
that all their extensions have been converted, we can finally remove
them from the code base.

closes odoo/odoo#99734

Related: odoo/enterprise#31112
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-15 19:20:53 +02:00
Aaron Bohy 66d9fe67a6 [FIX] web: Many2OneField: do not display a link if unset
Before this commit, an empty many2one field in readonly rendered
an empty `<a href"...">` node. Even though that link was no visible,
it had a non null width, and was thus clickable (the cursor changed
when hovering it). When clicked, it opened the form view of the
comodel, in create mode.

This commit fixes the issue by not rendering anything if the value
is false.

closes odoo/odoo#100158

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-15 12:41:07 +02:00
Antoine (anso) 68f1c90a03 [IMP] web: make "notebook" component more consistent
"Notebook" component had to be adapted to make the use of tabs
more consistent trough the app. The component now allows a use of
default tabs style in a vertical display

task-2950591

Part-of: odoo/odoo#98706
2022-09-15 12:40:55 +02:00
Romeo Fragomeli b6a36df34a [IMP] web: convert many2one_barcode to OWL
Before this commit there is a widget `many2one_barcode` that allows
to scan a barcode.

After this commit, we have converted it to OWL, but it's more than a new
component. From now, the logic is in the basic Many2One as a
property/option (`canScanBarcode`) and we also have the equivalent
Component (`widget="many2one_barcode"`). This choice has been made to
support multiple use cases (e.g. having the product_configurator and the
barcode on the same product field).

Note:
now we use the `browser` class to allow to patch the browser feature
during testing.

Part-of: odoo/odoo#100082
2022-09-15 11:05:22 +02:00
Simon Genin (ges) ddfd141165 [FIX] web: use command hook in component
Before: the command service was used inside components instead of the
hook. It introduced problems as the commands were not unregistered.
The commands were added multiple time to the registry.

closes odoo/odoo#100135

After: It uses the hook, "it just works".
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-15 01:23:21 +02:00
Gorash 39ea7a1fab [IMP] web/all: XML templates are now declared into the python manifest.
Adapt all manifest, split some XML file and update JavaScript files.

Part-of: odoo/odoo#95500
2022-09-14 20:25:01 +02:00
Gorash 5410b7c238 [IMP] base/web: XML templates are added into the asset bundles.
XML files are now declared in python module manifests. During the qweb
't-call-asset' directive, assetbundle will fetch the declared xml files,
apply the inheritance (t-inherit) and create a javascript service (for
eg: 'web.assets_backend.bundle.xml') which is added at the end of the
*.js mimifier file.

When the debug mode is activated, comments are added in the template
indicating which file the template comes from as well as the
inheritances applied to it.

****

JavaScript:

assets.js (module @web/core/assets) takes care of loading libraries,
javascripts and styles.
`loadJS(url)` (loads the javascript and returns a resolved promise when
the templates are also loaded via the '*.bundle.xml' service)
`loadCSS(url)` (loads the style a resolved promise when the file is
loaded)
`loadXML(xml, app=assets.defaultApp)` (load template into
application/owl, used by the `*.bundle.xml` services)
`getBundle(bundleName)` (get the bundle descriptor)
`loadBundle(desc)` (load the files and bundle from a descriptor)

templates (XML element content all owl templates)

A new `ready(serviceName)` method on boot.js lets you know when a
service is loaded are the require.

The xmlDependencies attribute no longer exists.

Python:

The xmls taken into account by assetbundle.py, applying `t-inherit`
inheritances and adding an `name_of_the_bundle.bundle.xml` service in
the generated JavaScript file.

****

Every manifest changes is into the next commit, except 'web_tour' in
this current commit as example.

Part-of: odoo/odoo#95500
2022-09-14 20:25:01 +02:00
Julien Mougenot d121ce8cdd [FIX] web: Fix filtering by progress bar in kanban
This commit addresses 2 issues in kanban views with progress bars:

1) When updating the field on which the progress bars are computed in a
record, an inert "Load more" button would appear

2) After updating said value, the progress bars would not be recomputed

Both of these problems have been fixed.

Part-of: odoo/odoo#99748
2022-09-14 18:16:09 +02:00
Damien Bouvy 54438fdebf [IMP] web: remove useless tooltips in standard views
Tooltips (and aria-label) should be used when the content of the element
is not self explanatory; but in the case of the create/save/edit buttons
available in several view control panels (kanban,list,form), tooltips
with dubious usefulness were added (e.g. "Create record" when you hover
on a button labeled "CREATE" is not really an information bomb).

Since these buttons tend to be used in tours, and the "coucouilles"
of the tours will also be some sort of tooltips, it means that you
can have frequent weird visual interactions between nunuts and stupid
tooltips.

This commit removes these stupid tooltips.

Feedback-2973374

closes odoo/odoo#100078

Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2022-09-13 22:16:13 +02:00
Aaron Bohy dd72a40926 [FIX] web: can't save o2m with not new dirty invalid record
Imagine a form view with a one2many editable list, containing a
required field. Open an existing record, s.t. in the one2many
there's already a sub record. Modify that subrecord, s.t. the
required field is unset (e.g. empty it, or it can be unset from
the beginning, but then modify another field). Then save the main
record. Before this commit, the record could be saved.

In this situation, the modified one2many record isn't valid, so
we shouldn't be allowed to save. The view should remain in edition
and the invalid field should be indicated.

This commit fixes this issue.

closes odoo/odoo#100059

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-13 22:16:08 +02:00
Pierre Paridans 0c4819f8c3 [FIX] web: list selection banner takes the whole width on mobile
On mobile, in list view's selection mode, both the left & right bottom
parts of the ControlPanel are displayed but only the left one
(containing the selection banner and actions menu) should be displayed
(and take the full width).

Also, small alignment adjustments.

closes odoo/odoo#99483

Related: odoo/enterprise#31269
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-09-13 20:30:01 +02:00
Pierre Paridans 2736d832bd [FIX] web: Layout's display props could be dynamic
Before this commit, if the Layout's `display` props is a dynamic value
coming from the parent Component (ie. a getter on the component that
controls which parts of the ControlPanel should be displayed), this
value isn't applied after the first initialization.

This commit fixes it by extracting the `display` logic applied in the
constructor to a getter (moving from initialization only to once
called).

Part-of: odoo/odoo#99483
2022-09-13 20:30:01 +02:00
Dardenne Florent (dafl) 30bcdf1b91 [IMP] web: kanban: add bottom quickCreate button
The purpose of this commit is to add a quick create button at the bottom
of each column in order to facilitate the user when he wants to quickly
create a record.

It was already possible to quick create a record in the kanban view.
To do so, the user needed to click on the quick create button placed
on top of the kanban view, forcing the user to scroll to the top of
the view if he consults records at the bottom.

task-2823605

closes odoo/odoo#98703

Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2022-09-13 16:27:47 +02:00
Aaron Bohy 8640f33b36 [FIX] web: FormView: do not switch record if invalid
In a form view, modify a record s.t. a required field is unset,
and then click on the pager to navigate to the next or previous
record. Before this commit, a notification was displayed (because
a required field is unset), but we switched to the other record
anyway.

This commit restores the desired behavior, which is to stay on the
current record to let the user fix it or discard it.

closes odoo/odoo#100050

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-13 13:53:41 +02:00
Aaron Bohy 8f58b1c768 [FIX] web: actionService: do not allow to leave invalid form
From a (e.g.) list view, click on "Create". In the form view, fill
in some fields, but leave a required field empty. Click on the
breadcrumbs to come back to the list. Before this commit, a
notification was displayed (because some required fields are
unset), but we left the form to come back to the list anyway.

The desired behavior is to stay on the form view, and display a
notification indicating that some fields are invalid.

In legacy views, we rejected promises to indicate that we couldn't
leave. This is a pattern we tried not to use anymore in new code.
Instead, we return a promise (if the method is async obviously)
which resolves to a boolean value, indicating if it works or not.
As a consequence, the action service wasn't properly dealing with
new views, as the promises they return always resolve.

This commit fixes the issue by adapting the code in the action
service.

Part-of: odoo/odoo#100050
2022-09-13 13:53:41 +02:00
Aaron Bohy 69a72aa4e1 [FIX] web: Many2ManyField: use correct title in dialog
Before this commit, the title of the SelectCreateDialog opened
when clicking on "Add a line" in a Many2ManyField was always
"Select Records" (the default value), whereas in this case, we
want to see "Add: something", where `something` is the `string`
attribute of the field (which can be overriden by an attrs on the
field node in the arch). This commit restores the desired behavior.

closes odoo/odoo#100046

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-13 13:53:36 +02:00
Aaron Bohy c313c25ff1 [FIX] web: x2many: send field context to x2many dialogs
Have a x2ManyField displayed as a (non-editable) list view, and
with a context defined on the x2m field node in the arch. Before
this commit, this context wasn't propagated to the dialog opened,
for instance, when adding a new record. It is now the case.

To make the tests pass, we also needed to make a slight change in
the BasicModel, as it didn't correctly process the context when
adding a new record with additional contexts (e.g. in x2many list
views with custom `<creates>`.

closes odoo/odoo#100000

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-13 13:53:30 +02:00
FrancoisGe 194dbc8a0d [IMP] web: export graph helper clickOnDataset
closes odoo/odoo#100030

Related: odoo/enterprise#31191
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-09-13 13:53:24 +02:00
Julien Mougenot 55f30554ea [FIX] web: Kanban columns are created at correct position
Before this commit, quick creating a column in a kanban view would not
necessarily put it at the right index.

Now, after creating a new kanban column, the columns are immediatly
resequenced to have a consistent order.

closes odoo/odoo#99347

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-13 11:31:17 +02:00
Samuel Degueldre 01aaca36b7 [FIX] web: log source of QUnit test failures in info instead of error
This allows easier parsing of the logs for indeterministic errors, so
that when the same error happens in different build, it has the same
error message, as the stack trace contains the file name of the assets
which get generated with a different hash every time, while also
preserving the existence of potentially useful tracebacks to debug
indeterministic issues.

closes odoo/odoo#100028

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2022-09-12 17:33:48 +02:00
Aaron Bohy 91e242e1c7 [FIX] web: kanban grouped by date: display None if not set
Before this commit, `false` was displayed as column title in kanban
views grouped by date(time) fields, for the column containing
records with unset value. When grouped by relational and date(time)
fields, we expect `None` to be displayed. This commit restores the
legacy behavior.

closes odoo/odoo#100020

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-12 17:33:35 +02:00
Aaron Bohy 1fb3882cd4 [FIX] web: kanban: display no content helper
The no content helper logic (determining when it is displayed) in
kanban is quite complicated. Apparently, in a kanban view grouped
on a field that isn't a many2one, with no groups (and thus no
records), and where we don't have the "group_create" permission,
we want the no content helper to be displayed. At least, this is
how it used to work in the legacy kanban view. This commit restores
the previous behavior and encodes this situation in a test. In the
future, it would probably be a good idea to sit down and challenge
the corner cases of this feature.

closes odoo/odoo#99914

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-12 17:33:26 +02:00
William Braeckman 44cfa03587 [IMP] mrp: migrate mrp_documents_kanban to wowl2
This views has multiple custom features such as file upload, attachment
viewer and download.
A lot of files have been rendered obsolete and have been deleted,
notably `file_upload_mixin` which has been replaced by the
file_upload service and hooks.

closes odoo/odoo#99769

Related: odoo/enterprise#31145
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-09-12 17:33:14 +02:00
Aaron Bohy 5f499d170e [FIX] web: apply default favorite even if active_id(s)
Before this commit, we didn't apply the default favorite (if any),
when there was an active_id or active_ids in the context. This was
a mistake. Note that it only impacted owl views.

closes odoo/odoo#99989

X-original-commit: 1e13e6cd073e57b3744caefc4b8f3795c35a4c10
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-12 13:49:37 +02:00
Florian Damhaut b3489af4c1 [FIX] web: basic_model: save a paged nested o2m
In a form view, have a o2m field (A), with a nested o2m field (B).
The A field should have multiple pages, with each record having at least one record
in their B field.

Have a (C) field that will modify a record in the nested o2m when changed.

Change the C field, and save.

Before this commit, the record's nested o2m from the other page had a wrong value
(a mere 4 command).

After this commit, their value is a command 4 and a command 1, with the right values.

closes odoo/odoo#99986

X-original-commit: e45e3b83f0f3116cc983c6bd8a9212e815b4d4f5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-12 13:49:31 +02:00
Aaron Bohy e9aac69e6b [FIX] web: adapt views to invisible attr removal in archs
PR [1] removes some `<field/>` node attributes from view archs that
were transfered into the `modifiers` attribute (e.g. `invisible`).
However, the `invisible` attribute was still used in some views
(e.g. graph, pivot, search and cohort). This issue hasn't been
spotted by the tests as the MockServer was still sending archs
with both `invisible` and `modifiers` attributes.

This commit adapts the MockServer to make it behave like the real
server, which makes some tests fail, and adapts the impacted
views to make them look into the `modifiers` attribute, which fixes
the failing tests.

Closes odoo/odoo#99920

[1] odoo/odoo#99619

closes odoo/odoo#99948

Related: odoo/enterprise#31220
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-09-12 13:49:25 +02:00
Samuel Degueldre 3db59860cb [IMP] web: display full tracebacks for error chains
Since owl now uses error chains/causes when errors happen in the owl
lifecycle, when an error happens in the owl lifecycle, the displayed
tracebacks generally only contain the stack trace of where owl called
the corresponding lifecycle hook.

This commit modifies the error service and the error utils so that now,
when completing/annotating a traceback, we also add the tracebacks
(annotated when appropriate) of the error cause chain, as it contains
valuable debugging information.

This commit also makes it so that the QUnit suite logs the source of
each test failure (which may be an error with a chained stack trace)

closes odoo/odoo#98157

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-12 13:48:49 +02:00
Hubert Van de Walle (huvw) 04b3a890d4 [FIX] web: duplicated breadcrumbs when discarding settings
Steps to reproduce:

  - Go to settings
  - Click on discard
-> the breadcrumbs contains twice the "Settings" entry.

This commit fixes the issue by restoring the legacy behavior in
the "Discard" button handler, that is, calling doActionButton with
the special="cancel" param. This had been changed by mistake during
the conversion of the settings form view.

To make the fix work, a slight changed has been done in the model
as well, as reloading a datapoint could lead to the creation of
a new datapoint (typically when it's a new record), so the handle
must be updated in this case.

closes odoo/odoo#99904

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-12 11:38:18 +02:00
Hubert Van de Walle (huvw) 50b47fee1b [FIX] web: innergroup separator should add a new line
Steps to reproduce:

  - Go to Accounting > Configuration > Chart of account
  - Click on the setup button on the "Current Assets" line
  - items are not correctly aligned

Cause of the issue:

  `<separator/>` should take an entire row
  The separator was on the same row as the field label.

closes odoo/odoo#99641

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-09-12 10:07:20 +02:00
stefanorigano (SRI) 8add0bf5ec [IMP] web: ListRenderer improve design, simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984.

task-2946835

Part-of: odoo/odoo#98234
2022-09-12 10:06:56 +02:00
stefanorigano (SRI) eb1fa44652 [IMP] web: o_optional_columns_dropdown, move into thead
This commit moves the element inside the table to avoid that the
dropdown may overlap thead column labels.
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2946835

Part-of: odoo/odoo#98234
2022-09-12 10:06:56 +02:00
Xavier-Do 0a695ab6b2 [IMP] web: one log per qunit module.
Right now the qunit will log all results at the end.

This means that the runbot may wait for all qunit before detecting the
failure.

This also mean that all failure are in one ir.logging on runbot, making
the automated parsing difficult if multiple modules fails during the
same build.

We could also log all failure immediately, but grouping them my qunit
module will avoid duplicating logs for linked causes (one failure
leading to a `Expected %s assertions, but %s were run` message)

closes odoo/odoo#99912

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2022-09-10 01:54:12 +02:00
Aaron Bohy e28c581a62 [FIX] web: fix tests failing randomly
This commit fixes several tests involving the Autocomplete
component that would sometimes fail because it delays its
next rendering on input (by a setTimeout 0 in the tests). This is
sometimes not enough as it may imply that the next rendering
occurs after the next animation frame, which isn't what we wait
for in the tests (we expect the next rendering to be applied
before the next animation frame).

This commit fixes remaining tests that we forgot in [1]

[1] de6cd189a4

closes odoo/odoo#99919

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-09 17:29:55 +02:00
luvi cbdea4010e [FIX] web: hide the phone field if empty
This commit hides the <a> representing the phone
number if it is unset. Before this commit, it
could display "false" instead of being invisible.
Now, the <a> element is no longer added to the DOM.
A test has been added to assert that behavior.

closes odoo/odoo#99905

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-09 14:41:34 +02:00
tsm-odoo f7e0da7b71 [IMP] mail: improve after event error stack trace
Before this commit the error raised/logged when rejecting the afterEvent
promise was imcomplete. This is due to the fact we're creating the
error inside the promise itself. In order to get a better stack trace,
the error is now declared outside of the promise.

Moreover, both `afterNextRender` and `afterEvent` functions were using
`console.error` before rejecting the promise. This is also a problem
since runbot will show the error printed by `console.error` instead of
the one of the test failure. In order to solve this issue, those two
`console.error` have been replaced by `console.warn`.

closes odoo/odoo#99899

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-09 14:41:25 +02:00