Commit Graph
15382 Commits
Author SHA1 Message Date
luvi 148c915ed2 [REF] web: remove unnecessary component
The purpose of this component was not helpfull
as it has no real use case and was only used
by the BinaryField component.

Instead of using an entire component, we only
keep the DOM that is now used directly in the
BinaryField template.

closes odoo/odoo#96357

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-27 02:18:29 +02:00
luvi 0d8e4495c0 [FIX] web: upload files with Many2ManyBinaryField
This commit fixes the wrong implementation of the
field. It was not functional and is now using the
FileInput component.

Before the commit, it was not possible to upload or
delete files from the list. Test has been adapted to
those changes.

Toast notifications were also missing, and a new
test has been added to check that a notification is
correctly displayed when the server responds with a
error message for a given file.

Part-of: odoo/odoo#96357
2022-07-27 02:18:29 +02:00
Mathieu Duckerts-Antoine 57be371457 [FIX] web: search panel: use action context when fetching data
In SearchModel, the calls to search_panel_select_range and
search_panel_select_multi_range were done without using the global
context (e.g. the action context), contrarily to what is done in the
legacy SearchPanelModelExtension. We fix that.

closes odoo/odoo#96458

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-07-26 20:46:47 +02:00
Jigar Patel d132421180 [FIX] web: restore .text-body class
During the BS5 migration, the .text-body class wasn't properly ported.

As it is a standard Bootstrap class and useful to override component's color with the one used by the body (ie. set a heading color the same as the content).

This commit restores it.

closes odoo/odoo#96173

Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-07-26 18:44:52 +02:00
Lucas Perais 03bd13e4c0 [FIX] web: legacy list switches view to form with the right resIds
Have a legacy list view, click on a record to open it in a new (WOWL) form view
Before this commit, the pager was wrong, as we never passed the list's current resIds
to the form.

After this commit, the pager of the wowl form view is correct.

closes odoo/odoo#96123

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-07-25 20:12:38 +02:00
Samuel Degueldre 57d97752a2 [FIX] web: use color-contrast instead of color-yiq
Previously, we were using the bootstrap 4 function "color-yiq" to choose
a text color depending on the background color. Since the migration to
BS5, color-yiq is no longer valid, and color-contrast should be used
instead, but the wowl-views migration was maintained in parallel from
the BS5 migration and some instance of this function call were added
back with it. This commit fixes those.

Functionally, this fixes the text color in the m2m_tags field.

closes odoo/odoo#96598

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-25 16:34:10 +02:00
Samuel Degueldre 19d0a92b2c [REF] web: remove useless statusbar css rules from form view css
These rules no longer apply because they use a direct descendant
selector which no longer matches since field widgets now have an extra
div. These rules also already exist in the statusbar_field.scss file.

Part-of: odoo/odoo#96598
2022-07-25 16:34:09 +02:00
Samuel Degueldre 4c2dff9205 [FIX] web: fix enterprise badge in settings being hidden and wrong color
After the bootstrap migration, the enterprise badge in the settings view
were the wrong color because the class bg-primary was not adapted. This
commit fixes that.

After the wowl views merge, the badge has become hidden behind the
navbar, because it can no longer modify the DOM of its label as it is
managed by owl. When there is no label, the widget appends the badge to
its own $el, and uses position: absolute to position it. This didn't
work because the closest parent that was positioned was the view itself.
This commit fixes that by giving a position: relative to the settings
box.

closes odoo/odoo#96580

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-25 16:34:01 +02:00
Samuel Degueldre e9b9f6520f [REF] web: move settings css rules to the correct file
The css rules for the settings view should be in the corresponding css
file, not with the generic form view rules. This commit moves these
rules to the proper files and unnests some rules when the selectors are
specific enough, which generates less CSS.

Part-of: odoo/odoo#96580
2022-07-25 16:34:01 +02:00
FrancoisGe 263bef0737 [FIX] web: ListView use the correct label
This commit solves 2 problems in the list view:
- incorrect label for a column
- the label in the optional column dropdown can be different than
  the label of the displayed column

When converting the list view, we used the displayName of the widget
and not its label.

In order to improve the consistency between the labels in the optional
column dropdown and the associated columns, we decided to use the same
label.

closes odoo/odoo#96408

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-25 16:33:49 +02:00
Abdelouahab (abla) d86ed180a6 [FIX] web : fix bg for bold document layout
To reproduce
============

on settings -> document layout -> choose Bold with blank background.
print a document (quotation for example) that has at least 2 pages.
the second page of the document has a background.

Purpose
=======

the issue is caused by the condition :
https://github.com/odoo/odoo/blob/0436709f33e57479bd6d62c2e0a2de74743cbaa4/addons/web/views/report_templates.xml#L403
where we don't take into account the case where no background is set.

Specification
=============

to solve the issue the condition was corrected

opw-2888650

closes odoo/odoo#96528

X-original-commit: bf2ce0aa0c7d45c90d7ff104d5af5f99b29d59ae
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2022-07-22 16:22:02 +02:00
Sébastien Theys 28200c5ad5 [IMP] mail, web: adapt chatter container in new form
task-2871070

Part-of: odoo/odoo#78221
2022-07-22 16:21:45 +02:00
+2 bc0a0cead6 [IMP] web,*: enable owl list & form views
The new list and form views were merged recently [1], but they
weren't activated because they weren't 100% ready yet. This is now
the case. This commit adds those views to the view registry. As a
consequence, a lot of qunit tests and tours needed to be adapted,
mostly for selector changes.

We also add legacy list and form views to the view registry, with
keys 'legacy_list' and 'legacy_form'. This allows to force those
legacy views when necessary. For instance, we did it in views
using complex custom legacy x2many field widgets that haven't been
converted yet (we have a compatibility layer but it isn't complete
and doesn't support every advanced usecases).

[1] odoo/odoo#92475

Part-of: odoo/odoo#78221
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>
2022-07-22 16:21:45 +02:00
Jorge Pinna Puissant 6994ccb31f [IMP] web: BasicModel: improve the performance of context eval
Before this commit, the evaluation of the context was done for all
the context, even when only a subset of the context was needed.

Now, we evaluate only the attributes of the context that are used.

Part-of: odoo/odoo#78221
2022-07-22 16:21:45 +02:00
Géry Debongnie 5329b9a9ae [IMP] web: prevent toPyDict from iterating on keys
The `toPyDict` method is used to transform an object into a "python" dictionary,
by returning an equivalent object with the PY_DICT object in the prototype chain.
In practice, it is called everytime we create an evaluation context.

This is a performance problem, since creating the context is not cheap in the
case of Odoo form views: we need to iterate on all the values of the current
record, checking for each changes, applying all relational operations, ...
And even worse, almost all of the domains that we need to evaluate have very
simple conditions, which just needs to check the value of one field. So, it is
useful to make the computation of the eval context keys lazy, and this commit
make sure that pyjs does not undo the lazyness of the eval context, if any.

Part-of: odoo/odoo#78221
2022-07-22 16:21:45 +02:00
Mathieu Duckerts-Antoine c5a8c4414c [FIX] web: load legacy x2many subviews
In a view form, legacy x2many fields with no view inline would not have
their subviews loaded. We fix that.

Part-of: odoo/odoo#78221
2022-07-22 16:21:44 +02:00
Mathieu Duckerts-Antoine 1d61d68207 [FIX] web: processing of field mode attribute
The view mode in which to display a legacy x2many field in a new form
view was badly processed. This lead those fields to be not renderered at
all (no list or kanban renderer displayed) or be renderered with the
wrong renderer in mobile mode. We fix that.

Part-of: odoo/odoo#78221
2022-07-22 16:21:44 +02:00
Mathieu Duckerts-Antoine 182b241e7d [IMP] web: support of fieldDependencies
Sometimes a field component might need to know some other fields values
to render itself or for other purposes. In legacy, a mechanism allowing
to load some field values not displayed was available: a field would
declare a fieldDependencies object specifying some field names and
their types and the related values would be loaded along the other data.

Here we introduce the same mechanism for the new views.

Note that in a new view list, the tag widget is not currently supported
so that we have remove some lines in the list arch parser that were
useless.

Part-of: odoo/odoo#78221
2022-07-22 16:21:44 +02:00
FrancoisGe ce61a35cf8 [FIX] web: crash when an arch as tree inside another tree
Before this commit, if an arch contained a tree which itself contained
a tree, the parser would crash.

The reason for this crash is that the parser was trying to parse the
second tree with the model of the first. So it didn't know the fields.

The solution is to stop the exploration of children when it is not
necessary. For example, for fields, it is not necessary to explore
the children, it is parseFieldNode that takes care of it.

Part-of: odoo/odoo#78221
2022-07-22 16:21:44 +02:00
Lucas Perais e3a54289ac [FIX] web: useViewButtons: add beforeExecute param
This rev allows the function built by the useViewButtons hook to take
a beforeExecute callback at call time, in addition to the existing
beforeExecuteAction callback that we can pass to the hook, at the
function's build time.

The rationale for this is to allow any caller to prevent the execution
of the action represented by the clickParams at the call level. It is
useful to check if a user is allowed business-wise to execute an action.

Part-of: odoo/odoo#78221
2022-07-22 16:21:43 +02:00
Samuel Degueldre 6ebf19b189 [FIX] web: fix statusbar field not displaying correct value in mobile
Previously, the statusbar field didn't display the currently selected
value for selection field in mobile, as the getter to compute the name
of the currently selected item only accounted for the many2one case but
not for the selection field case.

This commit adds handling for the selection field case and a test for
it.

Part-of: odoo/odoo#78221
2022-07-22 16:21:43 +02:00
Samuel Degueldre 3562946bf3 [FIX] web: fix many2one quickcreate in legacy fields in new views
Previously, legacy many2one fields and their extensions in new views
were unable to quick create records, this is because the compatibility
layer between the legacy fields and the relational/basic_relational
model is incomplete. This commit adds code to handle this specific case

Part-of: odoo/odoo#78221
2022-07-22 16:21:43 +02:00
FrancoisGe 91c32bb980 [FIX] web: X2m with custom controller
The goal of this commit is to allow an X2m in list mode with a custom
controller to use the controller context when creating a new line with
a 'tab' keydown.

Part-of: odoo/odoo#78221
2022-07-22 16:21:43 +02:00
FrancoisGe 415746602f [FIX] web: ListView with a class
This commit adds the ability to set a class on a list view.
This class will be added at the same level as "o_list_renderer".

For example:
    <tree class="myClass">
        ...
    </tree>

Part-of: odoo/odoo#78221
2022-07-22 16:21:42 +02:00
FrancoisGe f670df3693 [REF] web: ListRenderer: extract function for inheritance
This commit defines a "displayOptionalFields" getter that can be
overriden to force the presence of the optional column dropdown.
For instance, this is necessary in enterprise to add an item to
promote Studio.

Part-of: odoo/odoo#78221
2022-07-22 16:21:42 +02:00
Jorge Pinna PuissantandSamuel Degueldre 2c9db825c1 [REF] base,web,*: convert settings form view to owl
*hr_timesheet,point_of_sale,website

This commit moves the settings form view implementation from base
to web, and converts it to owl.

The setting's search has been improved to take into account more
elements. Before, it was possible to only search on the field's
labels. Now, we can also search on the field's description, and
the titles of setting's group.

Part-of: odoo/odoo#78221
Co-authored-by: Samuel Degueldre <sad@odoo.com>
2022-07-22 16:21:42 +02:00
Aaron Bohy 24e8e10b34 [FIX] web: LegacyField: correct mode and hasReadonlyModifier
Before this commit, legacy fields spawned in wowl views didn't
receive the correct "mode" and "hasReadonlyModifier" params. They
do now.

We do not add qunit tests for this, as tours already identified the
issues, and it only concerns legacy fields that we'll soon remove
anyway.

Part-of: odoo/odoo#78221
2022-07-22 16:21:41 +02:00
Aaron Bohy d3662d370c [FIX] web: editable list: can edit legacy many2one
Have an editable list view with a legacy many2one field (for instance,
an extension that hasn't been converted to wowl yet). Before this
commit, the edited row was unselected when the user clicked in the
many2one dropdown to select a value. The reason is that legacy
many2ones use jQuery autocomplete, that puts the dropdown directly in
the body, which is obviously not inside the table.

We do not add a qunit test for this, as it only concerns legacy
fields that are about to be removed, and it is tested in tours
anyway.

Part-of: odoo/odoo#78221
2022-07-22 16:21:41 +02:00
Aaron Bohy 46e8188443 [FIX] web: fix action menus layout issue
Before this commit, when there were more than one action menu (in
a list or form view), e.g. "Print" and "Actions", they weren't
displayed in the same line.

Part-of: odoo/odoo#78221
2022-07-22 16:21:41 +02:00
Samuel Degueldre 7b9b04f0a9 [FIX] web: fix form labels showing even when they should be invisible
Previously, if a label for a field had an invisible attr which should
cause it to be invisible, and it was not at the top-level of a group, it
would be rendered even when it shouldn't. This was caused by the fact
that when we compile the form arch, we don't copy the t-if attribute
from the original label when generating the FormLabel component.

This happens to work when the label is at the top level of a group,
because when compiling a group, if anything at the top-level of a group
has a t-if, we move it from the node itself to the t-set-slot that gets
generated for the FormGroup component before we would generate the
FormLabel.

Part-of: odoo/odoo#78221
2022-07-22 16:21:41 +02:00
Samuel Degueldre 7ff03baca2 [FIX] web: FormView: add o_xxs_form_view className on small screens
The form view is styled differently on small screens, and those rules
are based on the presence of the "o_xxs_form_view" className. This
commit correctly toggles it.

Part-of: odoo/odoo#78221
2022-07-22 16:21:40 +02:00
Lucas Perais 6a73b3e7ff [FIX] web: form: fix ButttonBox More dropdown style
Before this commit, the More dropdown button of the ButtonBox
(which displays stat buttons) was broken i.e. the more button
was on another line because its size was wrongly set.

After this commit, the style is corrected, every button of the Box
is on the same line.

Part-of: odoo/odoo#78221
2022-07-22 16:21:40 +02:00
Lucas Perais 8ca03fb6e3 [FIX] web: form: the status bar must be present if in arch
Before this commit, when the status bar did not have buttons to display
it was not displayed at all.

After this commit, we display it even if there are not any button inside.

Part-of: odoo/odoo#78221
2022-07-22 16:21:40 +02:00
Lucas Perais 042e1a5c30 [FIX] web: form: form header should end up in sheet_bg
Before this commit, the header declared in a form's arch was not injected
at the right place.

After this commit, the header's elements are put as children of the sheet_bg element
if present.

Part-of: odoo/odoo#78221
2022-07-22 16:21:40 +02:00
Lucas Perais (lpe) d3f26c4aab [FIX] web: MainComponentContainer updates when registry changes
Before this commit, adding a component in the main component registry
after the initial mount did not work that is, the MainComponentContainer
never rendered the new component.

After this commit, adding a component to the registry works as expected.

Part-of: odoo/odoo#78221
2022-07-22 16:21:39 +02:00
Lucas Perais 3c7ace02df [FIX] web: layout: banner should not be in o_content
Part-of: odoo/odoo#78221
2022-07-22 16:21:39 +02:00
Aaron Bohy 8dda736df4 [FIX] web: FormViewDialog: fallback on LegacyFormViewDialog
It might happen that one wants to spawn a FormViewDialog with a
view that has a js_class, and the corresponding js code hasn't
been converted to owl yet (it is still an extension of the legacy
FormView). Before this commit, when that happened, the control
panel buttons of the form view weren't moved to the footer of the
dialog, because this isn't supported with legacy views. This
commit is a workaround, as it fallbacks on the legacy FormViewDialog
in this situation.

Without this commit, the main flow tour fails.

Part-of: odoo/odoo#78221
2022-07-22 16:21:39 +02:00
Mathieu Duckerts-Antoine 1c344b8955 [FIX] web: MonetaryField: can take 0 value
Before that commit a zero value for a monetary field would be wrongly
considered invalid. This would block many flows (e.g. a save).

Part-of: odoo/odoo#78221
2022-07-22 16:21:39 +02:00
Lucas Perais 2320eccf4d [FIX] web: MonetaryField: input should be visible
Before this commit, the monetary input was invisible because its
width was 0.

After this commit, the input is visible.

Part-of: odoo/odoo#78221
2022-07-22 16:21:38 +02:00
Lucas Perais c0a67682cb [FIX] web: AceField: reset ace lib only if editor's element has changed
Before this commit, the ace editor crashed when switching to edit mode or
when clicking in it.

After this commit, it works as expected.

Part-of: odoo/odoo#78221
2022-07-22 16:21:38 +02:00
Géry Debongnie b4063a1e73 [IMP] web: update owl from 2.0.0-beta-14 to 2.0.0-beta-16
Release notes:

https://github.com/odoo/owl/releases/tag/v2.0.0-beta-15
https://github.com/odoo/owl/releases/tag/v2.0.0-beta-16

Details:

- fix: lifecyle_hooks: correctly wrap errors in async code
- imp: use a custom error class for all errors thrown by owl
- fix: package.json: remove browser value
- ref: component_node: slightly simplify code
- fix: components: fix cause left unset when thrown object is not Error

Part-of: odoo/odoo#78221
2022-07-22 16:21:38 +02:00
Géry Debongnie 23caf8b96f [IMP] web: update owl from 2.0.0-beta-12 to 2.0.0-beta-14
Release notes:

https://github.com/odoo/owl/releases/tag/v2.0.0-beta-14

Details:

- [FIX] compiler: better handle update of properties with same value

closes odoo/odoo#95804

Related: odoo/enterprise#29350
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-07-21 10:19:42 +02:00
Samuel Degueldre bebc565269 [FIX] web: m2oautocomplete in some weird cases
Part-of: odoo/odoo#95804
2022-07-21 10:19:42 +02:00
Nguyen Hong Quang 53ebbf92b4 [FIX] web: fix ratio in many2many_avatar widget
Currently in many2many_avatar widget, image shrink with that container,
make avatar user looking weird. Specially with vertical portrait image
and 1:1 ratio image.

This PR will fix this kind of bug UI.

closes odoo/odoo#96439

X-original-commit: 486b7f92318e64242613a07ea5ff365748dd713b
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-07-21 01:53:28 +02:00
Arnaud Joset 144377a016 [FIX] web: remove duplicated key in calendar view
https://github.com/odoo/odoo/commit/57dbfff2db9053276a293d9a20bd8636f10100cc introduced a duplicated key
in calendar view.

closes odoo/odoo#96426

X-original-commit: 4560beab43571454439a932c5f27082254104283
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Arnaud Joset <arj@odoo.com>
2022-07-21 00:50:42 +02:00
FrancoisGe 8746ffdc13 [FIX] web: use OnboardingBanner as default banner
Before this commit, the List and Kanban views did not allow the use of
a Banner without adding it in the View definition.

Like this:
```
export const listView = {
    ...
    Banner: OnboardingBanner,
    ...
}
```

Now, we use by default OnboardingBanner as Banner if no other has been
defined in the View definition.

closes odoo/odoo#95945

Related: odoo/enterprise#29452
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-21 00:50:05 +02:00
FrancoisGe 5ee62cc927 [FIX] web: rename pluck to pick
Name error, the implementation of pluck is the pick function. So we will
rename the pluck function to pick.

Part-of: odoo/odoo#95945
2022-07-21 00:50:05 +02:00
Laurent Stukkens (LTU) 86b683bb38 [FIX] web: add hideCustomGroupBy option
Prior to this commit, it was not possible to hide the 'Add Custom Group'.
This commit adds this feature and associated tests. Hiding this menu entry
 can now be performed by adding `hideCustomGroupBy: false` in the `View`.

This commit also uses `MAPPING`  values in the components assignment of
`ControlPanel` in order to improve code maintenance.

task-2845729
2022-07-20 15:23:54 +02:00
Bruno Boi 6f6fb914b0 [FIX] web: ignore allowed company from session storage
When switching the company, if the displayed action hasn't any
identifier, the RPC will be based on the previous company.

To reproduce the issue:
(Need stock. Use demo data)
1. Inventory > Operations > Inventory Adjustments
2. Enable the column 'Company'
3. Switch the company to "My Company (Chicago)"

Error: The quants of "My Company (San Fransisco)" are listed -> this
does not respect the selected company

On step 1, when clicking on Inventory Adjustment, it loads a Server
Action that returns another action:
https://github.com/odoo/odoo/blob/68657a85eb09dd306feab91d805b8c21eb75010f/addons/stock/views/stock_quant_views.xml#L356-L364
The returned action is a Window Action built on PY-side:
https://github.com/odoo/odoo/blob/b5d16141dc48d4379452ea40e167f3b00f956c20/addons/stock/models/stock_quant.py#L283-L300
So this Window Action hasn't any identifier (there isn't any
`action=...` in the URL)

Later on, when reloading the page (because of the company switch), we
try to load the action. To do so, we first call `_getActionParams`. In
this method, we take the current state and try to extract some
information. Because there isn't any action defined on the state (as
explained in the previous paragraph), we use the `current_action` stored
in the session storage (i.e., the window action returned by the server):
https://github.com/odoo/odoo/blob/590fa18cafe2c7bbd109692f564c2175ca6d820c/addons/web/static/src/webclient/actions/action_service.js#L294-L302
And here is the issue: the stored action contains its context and this
context contains the `allowed_company_ids` key (-> with the previous
company)

As a result, when performing the search_read to get all the quants of
the view:
https://github.com/odoo/odoo/blob/f5ba34e45b66e0fccc2559bf434e255d38a0faa0/addons/web/static/src/legacy/js/views/basic/basic_model.js#L5016-L5025
And when getting the context, it leads to `_getEvalContext`
https://github.com/odoo/odoo/blob/f5ba34e45b66e0fccc2559bf434e255d38a0faa0/addons/web/static/src/legacy/js/views/basic/basic_model.js#L3716-L3728
We apply the user context (which contains the correct value for the
company) and then apply the element context (which contains the
incorrect one, as explained above)
This explains why it will display the quants of the previously-selected
company.

OPW-2871086

closes odoo/odoo#94039

closes odoo/odoo#96161

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-07-19 21:21:55 +02:00
Lucas Perais cdda5f50bf [FIX] web: relational model exports its offset
closes odoo/odoo#96079

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-07-19 20:13:18 +02:00