Commit Graph
3365 Commits
Author SHA1 Message Date
Sergey ShebaninandAaron Bohy 91b80fbb5c [IMP] web: blockui when executing a target=self act_url action
An act_url action in target "self" redirects the current window/tab
to the given url. It always reloads the page, except when only the
hash or query string changes.

This commit blocks the ui when the page reloads, because there's a
lack of feedback and interacting with the ui is unnecessary anyway.

For instance, module operations (install, remove and update) end
with page reload. During the operation, the ui is already blocked
because the operation takes time. After the operation and before
the page is actually reloaded, the ui is unblocked. As the reload
also takes time because of asset rebuilding, it makes false feeling
for the user that operation completes and interface is ready for
interaction. With this commit ui is blocked until the page is
reloaded.

closes odoo/odoo#107830

Signed-off-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2022-12-14 17:17:47 +01:00
Jorge Pinna Puissant 76add62453 [FIX] web: settings view, always perform an onchange to fetch the data
- On the settings view;
- Open the CRM settings;
- Click on "Update Probabilities" button;
- Change the "consider leads created as of the" date;
- Click on "Confirm" button;

Before this commit, the fields on the settings related to the dialog
were not updated. This occurs because, as the setting model is a
transient model, the settings view should always perform an onchange to
fetch the view, and it wasn't the case here.

Now, we patch the basic model used on the settings view to remove the
res_id, to consider the record always as new. This will always perform
an onchange to fetch the data. Note that, this hack is the same as it
was done before the owl migration.

opw-3073124

closes odoo/odoo#107879

X-original-commit: 792567c71aed626b5566f32b656104e3e70c496c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-12-14 11:42:08 +01:00
Joseph Caburnay fead26df53 [FIX] web: more lenient monetary parser
**Issue:**

- Install CRM.
- Change language to French.
- From CRM, open a lead that has `Revenu espéré` thousands as value, e.g. 10 000,00.
- Try changing `Revenu espéré` by deleting one of the thousands digit.
  E.g. 10 000,00 -> 1 000,00
- BUG: The modified value is not understood by the system.

**Solution:**

This is because the thousands separator from the French language is nbsp.
Coincidentally, the parsing logic assumes that the separator between the
currency symbol and value is also nbsp. So when inputting `1 000,00`,
the parsers thinks either `1` or `000,00` is the currency symbol.

We concluded that it's better to be less restrictive when parsing
monetary values. So, instead of making sure that the current input's
currency is compatible with the currency of the the field, we just
strip the non-numeric characters from beginning and end of the input
without validating the currency symbol, then parse the remaining
string as float.

This leads to a more user-friendly monetary input fields such that
inputting "DOGE 1,000,000.01" in a "$" monetary field will be
parsed as 1000000.01. NOTE that *no* currency conversion is performed.

**Minor breaking change:**

The second parameter `options` of the `parseMonetary` function is now
removed. Any existing use of that parameter is just ignored.

closes odoo/odoo#107862

X-original-commit: dc27f1f4c039bdbf84c55a4fb5364c6398c45949
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-12-13 17:03:25 +01:00
Joseph Caburnay 4e5eebf966 [FIX] web: generalize whitespace separator when parsing
**Issue:**

When the thousands separator is "nbsp" and the user inputs a value
that is "1 234", the parser will crash because the thousands separator
is different from what is manually inputted by the user.

This is problematic because when typing, it's very difficult for
users to enter "nbsp" character in their input.

**Solution:**

This change proposes that if the thousands separator is a whitespace,
we consider all whitespace characters from user input as thousands
separator. As a result, even if the thousands separator is "nbsp",
the system will successfully parse "1 234" as 1234.

X-original-commit: bffddcf015da9cf514fc25cc7f839e923e470d94
Part-of: odoo/odoo#107862
2022-12-13 17:03:25 +01:00
Joseph Caburnay 89c6124599 [FIX] web: properly parse expression
**Issue:**

- Set the decimal point to "," and the thousand separator to ".".
- In a float or monetary field, enter "=1.000,1+2.000,2"
- BUG: It's evaluated to: 30003

**Solution:**

Problematic evaluation steps:
```
-> parseNumber("=1.000,1+2.000,2")
   - thousands separator are removed and decimals are converted to "."
     so the string becomes "=1000.1+2000.2".
-> parseNumber("1000.1") + parseNumber("2000.1")
   - since "." is the thousands separator, it will be removed
     (replaced by empty string)
-> 10001 + 20001
-> 30003
```

Because the main parser `parseNumber` is recursive in nature, we
need to make sure that the logic that removes the thousands separator
and replaces the decimal point to "." is not called in the branch
that evaluates an input expression.

With this change, the new evaluation steps are:
```
-> parseNumber("=1.000,1+2.000,2")
-> parseNumber("1.000,1") + parseNumber("2.000,1")
-> 1000.1 + 2000.1
-> 3000.3
```

X-original-commit: 91eb5c40ce898428fb15d945d70510b92e9ebb03
Part-of: odoo/odoo#107862
2022-12-13 17:03:25 +01:00
Bastien Fafchamps (bafa) 357cd41085 [IMP] Web: SearchPanel, display an empty state when there is no record
Purpose:
When a list view with searchpanel is empty, the searchpanel is completely
empty and white, and it's unclear what it's for. Make it obvious by
displaying an empty state. This will typically happen in some views when
you have no data or don't have the groups needed to show filters.

Spec:
Display the following paragraphs with the bs classes "small" and "text-muted":
"No quick filter available."
"Update the filters in the search bar to display more records."
"Quick filters will become available if the records shown can be filtered."

closes odoo/odoo#107379

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-12-13 13:51:26 +01:00
Lucas Perais 47f5e62288 [FIX] web: sample server grouped by a date range
Have a kanban view by default grouped by a date field, with a granularity
eg: "date:month".

Have no data so that the read group returns with only the groups for the range (fill temporal).
Those groups should have a count of zero, triggering the sample server to make up data.

Before this commit, there were multiple crashes basically because the groupby written
as field:granularity was not handled at least in the case were groups are returned by the server.
That is, from the sample server perspective, groups are reused and records are just made up
matching those groups.
There were two issues in fact:
- the groupBy with granularity (eg: date:month) was not properly handled, sometimes not splitting
the field name and the granularity, sometimes splitting those up where it should not.
- since the RelationalModel's groups are re-used verbatim by the sample server
(which still needs to return what the real web_read_group would), the "__range" data was missing,
since it had been transformed by the RelationalModel after the real call to web_read_group to the server.

After this commit, this use case is supported.

opw-3063067

closes odoo/odoo#107529

X-original-commit: 060b237f3caac5241130915b41a34aab7d28f4cb
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-12-12 18:16:07 +01:00
luvi 929874e633 [IMP] web: add Unselect all button in ListController
This commit adds a new Unselect all button displayed when at least two
records are selected in a list view. This button appears near other list
buttons. Once clicked, the selected items are deselected and the button
disappears.

Some list view tests have been modified since that change now adds a
button in cases where it was not expected before. Those tests now verify
the behavior when the button is clicked.

task-3081101

closes odoo/odoo#107294

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-12-12 15:17:15 +01:00
Mathieu Duckerts-Antoine 050f258bca [IMP] web: search bar: name_search context
The keys from the action context were not available in the context of
a name_search done when a user expand a one2many field in the search
bar. We add them.

closes odoo/odoo#107660

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-12-12 13:19:10 +01:00
Ricardo Gomes Rodrigues (rigr) 5376b60af0 [IMP] base, web: add not like and not ilike operators for the JS Odoo domain
Currently the `not like` and `not ilike` operators are available for the Odoo domain in Python but not in JS.

This commit adds these two operators in the JS Odoo domain too for better code clarity. For instance:
`[('fiscal_country_codes', 'not like', 'AR')]`
instead of
`['|', ('fiscal_country_codes', 'like', 'AR')]`

Part-of: odoo/odoo#106221
2022-12-09 11:48:42 +01:00
Jorge Pinna Puissant ebbc63dbff [IMP] web: improve setting search
Before this commit, the setting search was done exclusively in some
selected texts. These texts needed to be on some specific selectors
(field, label, span.o_form_label and div.text-muted).

Now, all text on a setting are searchable (including the text in
buttons). This commit also re-structure the setting compilers file to
remove the functions outside the class, this is done to standardize the
compilers (setting, form and view).

closes odoo/odoo#107226

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-12-08 08:48:46 +01:00
Aaron Bohy 5a5c2dbbf8 [FIX] web: handle float fields with digits=0
According to the orm documentation, the `digits` attribute of
float fields must be either a tuple (int, int) or a string.
However, people set `digits=0` on a bunch of float fields (some
are there for a while now). Historically, the webclient handled
this as "there's no digits attribute set", so it fallbacked on 2
digits precision.

With the new views, and owl props validation, we assert that the
`digits` props, when given, is an array. In the above situations,
we have a props validation error.

This commit fixes the error by filtering out the `digits` props
when it is not an array, s.t. it keeps working as before (i.e.
fallbacks on 2 digits). In master, we'll remove the fallback.

opw 3083100

closes odoo/odoo#107418

X-original-commit: 36407a9837ba3bf90670ae763751dc631309867b
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2022-12-08 00:43:08 +01:00
Adrien Dieudonné 94cb7ba07d [FIX] web: status indicator next to the breadcrumb
Before this fix, the '.o_form_status_indicator' was in the right
part of the control panel.
But on desktop, we want it next to the last breadcrumb item
to cognitively attach the "save status" to the record name.

closes odoo/odoo#107397

Task-id: 3067691
X-original-commit: 24b098767b03c97ffe108a7f8aa0f77c08aecef5
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-12-07 18:29:33 +01:00
Victor Feyens ba9a84e532 [FIX] web: correctly consider monetary fields currency_field
The currency_field shouldn't have to be specified in the view if it has
the same value as the field specification in python.

closes odoo/odoo#107396

X-original-commit: 47cf3688baf6aed6f027fc44db7293d9563789f4
Signed-off-by: Vallaeys Valentin (vava) <vava@odoo.com>
2022-12-07 18:29:31 +01:00
luvi cc411a5076 [IMP] web: only enable spellcheck on focused inputs
This commit adds the ability to enable spellcheck on input/textarea only
if they are in focus. This avoids the UI to be bloated with unwanted
underlined text on unfocused elements. It is especially useful in a context
of form view in always edit mode.

A core hook has been introduced to allow other components to use the same
behavior without reimplementing it. It is currently used by the TextField.
It means it is also used in the HtmlField. Tests have been written, both for
the field component, and the core hook.

task #2861428

Part-of: odoo/odoo#106866
2022-12-07 18:29:10 +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
Hubert Van de Walle (huvw) 355b004775 [FIX] web: many2one field autocomplete not cleared on blur
Steps to reproduce
==================

- Create an invoice
- Add a line
- Type storage in the product field
- Ctrl+A then press backspace
- Press escape to close the autocomplete dropdown
- Click elsewhere
-> The first suggestion is now selected

opw-3055185

closes odoo/odoo#107302

X-original-commit: e0613bc06ba9f2653dd0cfc4057ba93abf8513f7
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2022-12-07 10:02:17 +01:00
Bastien Fafchamps (bafa) c959386249 [REM] web: Remove preview of avatar in sidebar filter in calendar view
Spec:
Completely remove the avatar preview from the calendar sidebar.

Purpose:
The zoom on the employee's picture is not very smooth and can make an
ugly scroll appear while it is being displayed. It brings little
value and adds a lot of edge cases regarding sizing, positioning, etc.

closes odoo/odoo#106887

Task: https://www.odoo.com/mail/view?model=project.task&res_id=2519822&access_token=44b0ba1f-a0c4-43b6-910f-eab462e7a320
Signed-off-by: Luca Vitali <luvi@odoo.com>
2022-12-07 08:03:35 +01:00
Pierre ParidansandJoseph Caburnay 31125eabb9 [FIX] web: mispositioned caret of the list group header
**Issue:**

On the first group level, the caret that prefixes the label is
separated from the label by 5px.

But, on the 2nd group level (and deeper levels), the caret and
the label have no space in between. This is not visually pleasing.

**Solution:**

The span containing the caret has a fixed-width which conflicts with
the specified padding to show hierarchy of the groups.

We avoid this conflict by specifying margin to indent nested groups
instead of padding. This indentation (start) margin is calculated in
css to be able to reuse the values from `$spacers`. It is based on the
dynamically assigned css var "--o-list-group-level" that is calculated
based on the group level.

We also specified the end margin using a utility class (.me-1). This
is the space that separates the caret to the group's label.

closes odoo/odoo#107333

X-original-commit: 1d8f6359bbf55983a9582282d12a187c67cdf509
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Co-authored-by: Joseph Caburnay <jcb@odoo.com>
2022-12-06 17:12:24 +01:00
FrancoisGe 96e158a8b8 [REF] web: simplify customizations of static menu actions
There are several customizations of the list and form view that consist
in modifying the behavior of a static menu action (archive, unarchive,
export, delete, duplicate). We have seen that this one is very complex.
So we decided to simplify it.

Solution:
Add the getStaticActionMenuItems API point. This allows us to easily
modify the behaviour of static actions.

We also took advantage of this commit to simplify the ActionMenu api.
We have removed the other actions because it was not clear enough.
They are directly added in the action category.

closes odoo/odoo#107086

Taskid: 3089039
Related: odoo/enterprise#34598
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-12-06 17:11:53 +01:00
Lucas Perais adb194befb [FIX] web: remaining_days sends correct value to picker component
Before this commit, when a date field with the remaining_days widget did not have a value
typically on a new record form view, the props validation crashed because the datePicker widget
received the wrong type for its value.

After this commit, this is corrected and there is no crash.

closes odoo/odoo#107233

Related: odoo/enterprise#34668
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-12-06 07:01:41 +01:00
Jorge Pinna PuissantandMichael Mattiello (mcm) c7c2959449 [IMP] web, *: simplification and standardization of the settings arch
The aim of this commit is to simplify and standardize the settings archs.

To do this, a small DSL exclusively for the settings was created. This
new DSL introduces 3 tags: `app`, `block` and `setting`.

The `app` tag is used to declare the application on the settings view.
It creates an entry with its logo on the sidebar of the view. It also
acts as delimiter when searching.

```xml
    <app string="CRM" name="crm">
    ...
    </app>
```

- `string` : The "display" name of the application.
- `name` : The technical name of the application (the name of the module).
- `logo` *optional* : The relative path to the logo. If not set, the
        logo is created using the `name` parameter :
        `/{name}/static/description/icon.png`.

The `block` tag is used to declare a group of settings. This group can
have a title and a description/help.

```xml
    <block title="Title of group Bar">
    ...
    </block>
```

- `title` *optional* : The title of the block of settings (the old h2),
        you can perform research on its text.
- `help` *optional* : The description/help of the block of settings
        (the old h3), you can perform research on its text.

The `setting` tag is used to declare the setting itself. The first field
in the setting is used as the main field (optional). This field is
placed on the left panel (if it's a boolean field) or on the top of the
right panel (otherwise). The field is also used to create the setting
label if a `string` is not defined. The `setting` tag can also contain
more elements (e.g. html), all of these elements are rendered in the
right panel.

```xml
    <setting string="this is bar">
        <field name="bar"/>
        ...More elements
    </setting>
```

- `type` *optional* : By default, a setting is visually separated on two
        panels (left and right), and is used to edit a given field. By
        defining `type='header'`, a special kind of setting is rendered
        instead. This setting is used to modify the scope of the other
        settings. For example, on the website application, this setting
        is used to indicate to which website the other settings apply.
        The header setting is visually represented as a yellow banner on
        the top of the screen.
- `string` *optional* : The text used as label of the setting. If it's
        not defined, the first field is used as label.
- `title` *optional* : The text used as tooltip.
- `help` *optional* : The help/description of the setting. This text is
        displayed just below the setting label (with classname
        `text-muted`).
- `company_dependent` *optional* : If this attribute is set to "1" an
        icon is displayed next to the setting label to explicit that
        this setting is company-specific.
- `documentation` *optional* :  If this attribute is set, an icon is
        added next to the setting label, this icon is a link to the
        documentation. Note that you can use relative or absolute path.
        The relative path is relative to
        `https://www.odoo.com/documentation/server_version`, so it's not
        necessary to hard-code the server version on the arch anymore.

closes odoo/odoo#106425

Task-id: 3081367
Related: odoo/enterprise#34337
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: "Michael Mattiello (mcm)" <mcm@odoo.com>
2022-12-02 14:40:25 +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
Denis Ledoux 59e3269988 [FIX] base, web: transfer readonly/required modifiers for kanban/tree
Since odoo/odoo@69c3d5aa25
the readonly and required modifiers were no longer passed
for non-editable views. Which means:
- kanban: never passed,
- tree: passed only when `editable="1"` or `multi_edit="1"`,
- form: always passed.

The rationale behind that is that a view which is considered
as readonly doesn't need to know if its field are readonly or required,
as by definition, if the view is readonly, the user shouldn't
be able to modify anything in the view.
This was to make the views sent to the web client more light-weight,
not sending unused information, and save KB of transfers.

However, some widgets, used in the kanban and non-editable tree,
allow to modify fields, even in readonly considered views,
and therefore need to know these readonly/required modifiers
from the field definition in the Python model.

e.g. the `widget="color"`, odoo/odoo#103478

Ideally, these readonly/required modifiers should be transferred
only when the widget requires it, to avoid transferring the
readonly/required modifiers
when they are not useful in kanban/tree views
(which is 99% of the time).
However, this would require a bigger refactoring,
which is considered too risky compared to the added value
for a stable release.

task-3013110

closes odoo/odoo#106838

X-original-commit: 5a68d254949f1d0ff545023cfd14890efff10f5f
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-11-30 20:03:15 +01:00
Dardenne Florent (dafl) edd296da29 [IMP] web: list: select range of records with shift
Before, in the list view, the user could not select a record range easily. He had to
check/uncheck manually each checkbox in the range.

Now, the user can select a range of records in list view by hitting its first record
and and its last record while holding SHIFT for the second.

It's also possible to do it with the keyboard:
- pressing <SPACE> to select a record and <SHIFT+SPACE> to select a range of records.
- pressing <SHIFT+ARROW> to extend to current checkbox

task-2039894

Part-of: odoo/odoo#99050
2022-11-30 15:06:00 +01:00
fdardenne 8414b797c3 [FIX] web: hotkey_service: replace by space
Pressing `<space>` in browsers results in a ` ` event key.
We don't want this event key as ` ` is not recognized and not
whitelisted in the hotkey service.

Instead we want to use `space` because it is more readable in the
codebase.

Part-of: odoo/odoo#99050
2022-11-30 15:06:00 +01:00
Samuel Degueldre 2b33d2113e [FIX] web: make originalError the root of the error chain
Previously, when calling error handlers, we would give them a new error
created by the error service, as well as an `originalError` which is the
error that was caught by the error service. In some cases, this error is
part of an error chain, eg: errors that happen in the owl lifecycle are
wrapped in an `OwlError`, so that when an error occurs in a callback
passed to a lifecycle hook, the position where the hook was called to
register the offending callback is part of the stack trace.

In practice, most error handlers only care about the error that caused
the entire error chain (the root) when deciding whether they should
handle the error or not, eg: an RPCError should be handled by the rpc
error handler, regardless of whether it occured in an event handler or
in a component's willStart. It already reads the traceback to display on
the UncaughtError provided by the error service as this traceback
contains the entire error chain stack information and is annotated with
source maps by the error service.

This commit makes it so that the `originalError` passed to handlers is
now the root of the error chain, it also sets the `cause` of the
UncaughtError which is passed to handlers as the error that was caught
by the error service, so that if a handler needs to inspect the error
chain to know whether it can handle the error or not, it can still do
that.

related to OPW-3069633

closes odoo/odoo#106720

X-original-commit: dd6f103b1635868e03a7aa40eb7186861d22d377
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-11-28 18:51:47 +01:00
Valentin Vallaeys (vava) 3e0c80270d [FIX] product,web: color_field fixes for product variant color
There was a typo in the color_field xml not allowing to disable the
pop-up in case of readonly. A test validates the feature is active.

The color_field now displays the transparent symbol (instead of black
color) in case the color is undefined.

The product configurator also displays the transparent symbol for
undefined non-custom colors.

task-3013110

closes odoo/odoo#106669

X-original-commit: c67c32c2dbe10b4885ec1177852839b3d18ecf05
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Vallaeys Valentin (vava) <vava@odoo.com>
2022-11-28 15:53:11 +01:00
Bruno Boi 7f257a2025 [FIX] web: popovers and arrows repositioning
**Before this commit**
When a popover is shown and then repositioned to a different placement
(i.e. due to window scrolling or resize), its arrow is misplaced.

This is due to the fact that classnames added in order to correctly place
its arrow are just added to the previous ones instead of replacing all
the needed classnames.

**After this commit**
The classnames are now properly replaced instead of just being appended.

closes odoo/odoo#106495

X-original-commit: c54cc2f87930147b5addb6f447574c677ef3504d
Signed-off-by: Luca Vitali <luvi@odoo.com>
2022-11-28 14:51:16 +01:00
Mathieu Duckerts-Antoine 84a0d31ca7 [FIX] web: search model: one2many search default labels
When a one2many is used as a search default, its label has to be fetch
via a name_get in order to get a correct display of the facet
corresponding to that field in the search bar. It turns out that the
search model did not wait properly the return of the name_gets before to
start to compute the facets.

closes odoo/odoo#106624

X-original-commit: 50f58212410b321c1c4ad3d42a91cd1d23567308
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-11-28 13:20:44 +01:00
amdi-odoo 57c8e7face [FIX] web: prevents not dirty forms saving
Purpose
=======
Prevents auto save of not dirty forms with
text fields on page reload and tab/browser closing.

Specifications
==============
The text field default value is making Odoo consider
the form as dirty even when it's not which triggers
auto saving for not dirty forms.

Change the text field widget setDirty condition to
prevent considering empty textarea string dirty.
Typically, if the previous value was false, false and
empty string should be considered as the same value.

Task-3031570

closes odoo/odoo#106619

X-original-commit: 787ef58dd3f91f829509f738ee40c8764c403757
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-11-25 19:52:02 +01:00
Hubert Van de Walle (huvw) e23f0e1125 [FIX] web: kanban: add a onPagerUpdate callback
Use case:
in the reconciliation widget, we need to know when the pager
is updated before the next render because we need to select the
appropriate id to use.

cf the following PR: https://github.com/odoo/enterprise/pull/33631

opw-3031131

closes odoo/odoo#106581

X-original-commit: 19523b511d54278613a3d3e7389a51665dcc3fc1
Related: odoo/enterprise#34408
Signed-off-by: Georis François (fge) <fge@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2022-11-25 18:55:54 +01:00
Chong Wang (cwg) 75c72735fa [FIX] core: fix translation dialog
The fix in #106174 was not good.
The translation dialog cannot update not translated terms

the initial term value may be empty "" when the source and the translation are
the same at first. So, the source to for update_field_translations should be
  const source = term.value ? term.value : term.source;

closes odoo/odoo#106528

X-original-commit: 1ed5ce6f16d32efc0c5ec4cead67b2d8a57f6c41
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-11-25 17:56:40 +01:00
Romain Estievenart 72440e016c [FIX] web: text header appears over the text kanban card
Scrolling inside a grouped kanban with a lot of cards on a column
makes the text header appear over the kanban card due to the missing
background.

Steps to reproduce :
- Open Helpdesk on small screen like a mobile
- Open VIP Support
- Made a Group by "Create date => day" (there should be enough cards on
  a column to scroll)
- Scrolling the column => bug, the text header appears over the kanban
  card

closes odoo/odoo#106368

X-original-commit: 041fddf0c884ae9a6e2b040decfb1f31e9d25a29
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Signed-off-by: Romain Estievenart (res) <res@odoo.com>
2022-11-24 11:08:42 +01:00
Ivan Yelizariev 0c8e158393 [FIX] web: fix error on creating new record with ref field
STEPS:
* Open ``Settings >> External Identifiers``
* Click `[Create]`

Patch in `getValue` fixes js error:

> Caused by: TypeError: Cannot read properties of undefined (reading 'model')

Patch in `onWillUpdateProps` fixes infinite loop

task-3047190
opw-3056362

closes odoo/odoo#106195

X-original-commit: 92c4f55e341437b20f9320eded0baaa44628fb25
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2022-11-24 11:08:36 +01:00
Joseph Caburnay ac2074bd1a [FIX] web: update records of the current page when deleting
**Issue:**

When at the first page of the list, and the user deleted all/or some
of the records, the next page is not automatically displayed.

**Solution:**

This is because the first page (offset=0) is exempted from offset
adjustment (_adjustOffset) which is responsible in reloading the
records in the list.

In this commit, we propose to reload the list if the call to
`_adjustOffset` didn't call `load` and there are actually deleted
records.

closes odoo/odoo#106317

X-original-commit: 2863978041d2856644da938ced9eedc640b8f198
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-11-23 13:25:03 +01:00
Joseph Caburnay d9fafdd08e [FIX] web: should update group count when deleting records
**Issue:**

- Open a list view and group the records. Notice the count per group.
- BUG: When deleting a record under a group, the count in the group
  is not updated.

**Solution:**

When calling `deleteRecords` in the `DynamicGroupList`, we call
`deleteRecords` on each group's `list`. This "list" can be
`DynamicGroupList` or `DynamicRecordsList`. Regardless which instance
calls the `deleteRecords` method, we should take the number of the
deleted records and subtract it from the group's current count.

If it turned out that the calling object is a `DynamicGroupList`,
we should make sure that it returns the ids of the deleted records
so that the parent group can update its count as well, that's why
we are collecting the deleted record ids.

It's not so easy to follow but we can roughly imagine the structure
this way:

DynamicGroupList
-> DynamicGroupList[]
   -> DynamicRecordsList[]

Deleting items from the inner dynamic records list should result to
update of the parent group list, and eventually, to the update of the
root group list.

X-original-commit: 865c1b37f7986f00b85c9e8135e46cc4b2ac70da
Part-of: odoo/odoo#106317
2022-11-23 13:25:02 +01:00
Bruno BoiandLuis González 29ca002ee5 [FIX] web: menus missing aria attributes
Some missing aria attributes from 14.0 are reintroduced.

They are required for screen reader users to be able to know if menus
are opened and if menuitems are checked (e.g. if a filter is applied).

closes odoo/odoo#106277

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Co-authored-by: Luis González <lgonzalez@vauxoo.com>
2022-11-23 13:24:51 +01:00
Bruno BoiandLuis González 192e80c03e [FIX] web: dropdown unusable by screen readers
Dropdown menus/items were refactored and moved to OWL when migrating to
15.0. Now, the focus is always on the dropdown button, which captures
and handles all keyboard events, to be able to move over the menus.
Currently-selected item is highlighted by toggling classes.

However, since the focus is always on the dropdown button, screen
reader users are  no longer able to know what menu item is being
selected, as it's only a visual change (in previous versions, the focus
actually moved to the selected element).

The above is fixed by making the activeElement follow the visual change.

Part-of: odoo/odoo#106277
Co-authored-by: Luis González <lgonzalez@vauxoo.com>
2022-11-23 13:24:51 +01:00
65dd6e2f78 [FIX] web: calendar filter autocomplete issues
**Before this commit**
Various issues are present in the calendar filter autocomplete:
- typing a character in the input would close the autocomplete dropdown
- search for a term yielding to no results would not display the
  "No records" entry
- click on the "Search more..." entry yields to a validation error
  message: "a mandatory field is not set". [1]

**After this commit**
The FilterAutoComplete component has been removed as it was useless.
It was a kind of higher order component trying to manage the
AutoComplete component's input state, leading to unwanted complexity.

We decided to remove this component despite being in a stable branch
for the following reasons:
- it was not exported and only used by the CalendarFilterPanel
- it brought unnecessary complexity
- it was not working properly
- the branch is still a bit young
- the diff in the CalendarFilterPanel template is minimal

Now that the CalendarFilterPanel directly make use of the
AutoComplete component, the first listed issue has been solved.
The two other issues were simple fixes addressed in the mean time.

[1] this issue comes from opw-3031045, more infos below:
Steps to reproduce:
- Go to calendar basic view
- Click on "+ Add attendees" and then on "Search more ..."

Current behavior:
Validation error on partner_id in calendar_filter create

Expected behavior:
You can look for a partner with advanced research options

Explanation:
The code treated the "Search more ..." option like a partner
option instead off calling the onSearchMore method that creates
the advanced research dialogue.

opw-3031045

closes odoo/odoo#106292

X-original-commit: 73af1d04d9d49eace16e3f88c32ce5d457b44b83
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Martin Fockedey <mafo@odoo.com>
Co-authored-by: Hubert Van de Walle <huvw@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
2022-11-23 09:24:03 +01:00
Romeo FragomeliandRomain Estievenart d3ad21cdfc [FIX] web: Many2One field don't show all records in small screen
Since the conversion in OWL of the `many2one_barcode` widget, on Mobile
when we open the search more a filter value is added automatically in
the filter and so when we want to change the value we need an additional
step to remove the filter to see all records.

This commit, use a 'custom event' to open the barcode search and restore
the normal behaviour on the `click` event.

Steps to reproduce:
* Go to Timesheet
* Add a new line
* Select a project
* Try to change the project => BUG show only the selected project

closes odoo/odoo#106267

X-original-commit: 6d7f5a0abd79f6185831a2b9617b031d13da89be
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
Co-authored-by: Romain Estievenart <res@odoo.com>
2022-11-22 17:09:30 +01:00
Chong Wang (cwg) 0e3d496936 [FIX] web: fix translation dialog for model terms
Before this commit, new model term translations cannot be saved if it has been
translated before.
The reason is while translating fr_FR
the backend needs the mapping {old_term_fr: new_term_fr} to update old_value_fr
However the UI sent {old_term_en: new_term_fr} which was wrong

This commit fixes the bug by changing the key of the mapping from the
old_term_en to the old_term_fr

opw-3074712

closes odoo/odoo#106257

X-original-commit: f28c11917e093d0d3f5d18f0b377cfb24a7dbd92
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Wang Chong (cwg) <cwg@odoo.com>
2022-11-22 17:09:24 +01:00
Joseph Caburnay cd3af17a27 [FIX] web: limit fetched records when grouping
**Issue:**

- Open a list view with `expand="1"` and `limit=<arbitrary small number, say 5>`.
- BUG: The pager shows that it's displaying the limited records, but in reality,
  it's displaying all records under each group.

**Solution:**

This is because we are *not* limiting the number of records being fetch in the first
read_group rpc. We are now specifying the expand_limit in this commit.

closes odoo/odoo#106238

X-original-commit: e5bba9f5eb63ee95924c892801fe18feaef6d1fc
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-11-22 16:06:04 +01:00
Joseph Caburnay 7ec41bb9e1 [FIX] web: image field resets when using manual save
**Steps to reproduce:**

- go to a product page
- replace image (=> image is shown)
- click on "Save manually" (the cloud upload icon)
- BUG: previous image is displayed.

But it was saved: if you move to another record and return then it
shows the correct one.

**Solution:**

Basically, in an image_field: If its props.value is a "binary size",
then the image source is a url pointing to a server endpoint and
this url is based on the rawCacheKey, otherwise, we use the "base64"
of the uploaded image.

The proposed solution for the said issue is to invalidate the
rawCacheKey during upload. Then, during the calculation of image url
(at `getUrl`), we reassign the rawCacheKey with the newest
"__last_update" value of the record when needed (if the props.value
is a "binary size").

closes odoo/odoo#106236

X-original-commit: 93911daab238e96c8aa9b0a951b9a268d83a9847
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-11-22 13:46:04 +01:00
Denis Ledoux 5631887594 [FIX] web: "Set Defaults" feature from the debug menu
Since odoo/odoo#99660
the `depends` field attribute is no longer passed
from the server to the web client.

Because of this, the "Set Defaults" feature
of the debug menu is completely unusable,
as the list of fields on which to set a default is empty because of it.

The use of this `depends` field attribute has been introduced in
revision odoo/odoo@ce9bbf6c10
In the commit description, we can read that setting a default
on computed fields having depends has been disabled
because the defaults set were being overwritten by the call to onchange.
Note that only the fact the field has depends is required,
the actual list of field names is not used, just the fact the list is
not empty.

However, since revision
odoo/odoo@488e334fc8,
available since Odoo 14.0,
this is no longer the case, the defaults are no longer being overwritten
by the call to `onchange`, since the `default_get` has been integrated
into the `onchange`.

A video attached to the pull request of this revision
shows the behavior difference.

Hence, setting a default on a computed fields having depends
(with an inverse method, hence not readonly)
can be allowed again in this "Set defaults" debug feature,
therefore avoiding to have to send back the `depends` field attributes
to the web client.

opw-3031290
opw-3038711
opw-3055292

X-original-commit: 48ac799288e76a0256b9ce0712a70ed5abc0f62e
Part-of: odoo/odoo#105251
2022-11-21 14:56:53 +01:00
Thomas Lefebvre (thle) 37dfb6d12e [FIX] web: placing the domain in the kwargs of an rpc call
Steps to reproduce:
    - go to Contacts app;
    - add a reporting view (Graph, Pivot or Dashboard) (with studio for example)
    - tape any character in the search bar;
    - on "search related company for" field either use the arrow keys to go down to this and then click the right arrow key or click on the triangle to the left of this field.

Issue:
    An error occurs.

Cause:
    There is a mismatch between the parameters that are sent by the rpc call and those processed by the logic part.
    Specifically, the domain must be part of the kwargs and not the args of the params key in the rpc call.
    The problem occurs with a filter that looks like: `<field name="parent_id" domain="[('is_company', '=', True)]" operator="child_of"/>`

Solution:
    Move domain in kwargs under key named args in the params of the rpc call.

opw-3031096

closes odoo/odoo#106074

X-original-commit: 8a9b418b27dcc9b904413f14cd0443f9a5b10d17
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2022-11-21 08:25:20 +01:00
Victor Piryns (pivi) f800523e18 [FIX] web: correct calendar header weekday
Current behaviour:
When rendering a calendar view with "Year" option,
the weekday headers may be incorrect in some cases
when the timezone is set to a negative timezone GMT.
For ex. it renders "S S M T W T F" instead of "S M T W T F S",
if the first day of the week is Sunday.

Expected behaviour:
Formatting should be consistent with the first day of the week,
and be indepedent of the timezone.

Steps to reproduce:
- Change your system timezone to somewhere in Alaska
- Install TimeOff
- Open TimeOff and switch to the yearly view.
- Observe that the weekdays headers are incorrect.

Reason for the problem:
The custom calendar header formatter was trying to generate
the end result directly based on the date marker, which is
incorrectly set in that context. This patch doesn't fix the root
cause of why the `info.date.marker` starts at an incorrect date.

Fix:
A formatter shouldn't read state. Since we are using the luxon plugin,
we use the `"EEEEE"` format, which is equivalent to the `"narrow"` options
from JS's `Intl.DateTimeFormat()` available in all browsers.

Affected versions:
- 16.0
- master

opw-3033464

closes odoo/odoo#106041

X-original-commit: e212f8752047222d1d81e1e9589934e70ecacf2a
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
2022-11-18 15:01:02 +01:00
Samuel Degueldre a1e7e3ef7e [FIX] web, *: tours correctly break when there are missing deps
*: im_livechat, website_livechat, website_slides

In c989ff3, the odoo module system has been changed so that it now
errors out when modules are defined but have missing dependencies and
cannot run. Unfortunately, tours are defined in a single bundle,
`assets_tests`, and this bundle is used everywhere tours need to run,
but some of these tours depend on modules that only exist in the backend
and others on modules that only exist in the frontend. We don't want to
break up the `assets_tests` bundle as this creates a poor developer
experience, and so the solution that was chosen at the time is that when
the `assets_tests` bundle is defined, we ignore all module dependency
errors.

This causes a problem however, which is that if a module dependency is
missing in production code, the page will be broken by the module error
(which is expected) but if the `assets_tests` are present, which is the
case when running tours and tests, then it won't, meaning the tours will
happily pass despite the application being broken, which is
unacceptable.

This commit fixes this issue by replacing the assets_test bundle by a
new bundle (`__assets_tests_call__`) within which all module dependency
errors are ignored, which lets dependency errors that are hapenning in
other bundles (ie in production code) happen even during the tests.

Because of this, this commit also fixes the dependency errors that
already existed but were previously silent:

- for im_livechat and website_livechat, the code was refactored to use
the standard mechanism that we use elsewhere to add data directly in the
page: we store the data in __session_info__, and the module that exposes
that data is always present, instead of having a module that's defined
conditionally, which causes issues when non-conditional modules depend
on it.
- in web, the `report_assets_common` bundle was used alongside
`assets_common` but without `assets_frontend` or `assets_backend`.
Reports do not need any js and it appears that it already had what it
needed as far as css is concerned except for one fontawesome override.
Code was changed so that the js from the bundle is not included and it
reports no longer use `assets_common`, the js part of the bundle is no
longer used.
- in website_slides, the `slide_embed_assets` bundle is used alongside
`assets_common` without using `assets_frontend` or `assets_backend`
which is required for `assets_common` to function, the approach here was
to simply take the files from `assets_common` and remove the files that
were causing issues. This bundle should be trimmed at some point, as it
contains way too many things that it does not need.

The file colors.js was also moved to core, as it isn't graph specific
and was causing dependency issues with a field that was importing it.
Fields shouldn't depend on files in specific views' directory.

closes odoo/odoo#104794

Related: odoo/enterprise#33909
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-11-17 15:59:16 +01:00
Aaron Bohy 2d7a32a223 [FIX] web: do not combine field domain with view domain
Have a many2one field with a domain set in the field definition in
python. Use this field in an editable list view, with a domain set
on the field node. For instance, go to Sales > Sales Team and see
Team Leader field.

Before this commit, we combined the field domain with the domain
set in the view, which isn't the spec. The spec is to use the
domain set in the view if there is one, and if there is not, use
the field domain (see _getDomain in basic_model.js).

In the scenario described above, it produced a crash because the
field domain couldn't be evaluated with the fields defined in the
view.

This commit restores the previous behavior.

closes odoo/odoo#105774

X-original-commit: 32654fd17ab366d20fff8b3fc8134ee209569f1d
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-11-15 18:25:53 +01:00
fdardenne 4edbe54456 [REM] web: qweb views
QWeb views allowed to render QWeb templates rendered by the server in
a view.

Today, QWeb views are only used in website to see the hierarchy of
their views. The use case of website has now more sense in a client
action rather than an extension of a QWeb view.

This commit removes this view because it is not used anymore and will
probably not find any useful use case in the future.

closes odoo/odoo#103477

Related: odoo/upgrade#4016
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-11-15 18:25:12 +01:00