Commit Graph
13867 Commits
Author SHA1 Message Date
Aaron Bohy 79727cca9c [FIX] web: AutoComplete: do not crash on "Enter"
Before this commit, there were two kind of related issues with the
AutoComplete component, involving an "Enter" keydown.

1) Click in an empty Autocomplete input s.t. the (only) source has
   no option, then press "Enter" -> crash
2) Enter something in an Autocomplete input s.t. there are results
   in the dropdown, then update the input again s.t. the (only)
   source has no option, then press "Enter" -> crash

This commit fixes those two issues by
1) Ensuring that we don't store in the state an option index that's
   out of range with respect to the current available options
2) Reseting the options when reloading the sources.

Those issues were reproducible on the Company form view, by using
the company name field (which uses partner_autocomplete).

closes odoo/odoo#107982

X-original-commit: 390a9b589495e67235b15137ccc510b76350443f
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-12-14 22:04:15 +01:00
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
Denis Ledouxandkebeclibre a9f020e777 [FIX] web_studio: fields with groups set as invisible in views
This revision is related to odoo/enterprise#33088

The needs is the same:
While using Studio,
instead of removing the node from the view
when the user is not part of the group,
set the node as invisible.
This is so the xpath expressions computed by Studio
takes into account nodes which are removed from the view
when the user is not part of the group required by the node.

e.g.
```xml
<form>
    <group>
        <field name="name"/>
	<field name="currency_id" groups="base.group_multi_currency"/>
	<field name="foo"/>
    </group>
</form>
```

With the above view, if you want to add a new field after
`<field name="foo"`/>
and the `currency_id` field node is removed from the view
during the post-processing of the view
because the user doesn't have the group,
Studio computed the xpath expression with `field[2]`,
and then the new field was mis-placed,
it was before the `foo` field instead of after.
The strategy is to let the nodes, as invisible,
for which the user doesn't have the groups
so the xpath expression is correctly computed
for the view as it is stored in the database/
before the post-processing step removing the nodes.

The above revision applies this strategy for
nodes other than `<field/>` and `<t/>`.

The `<field>` were not included because it was,
at that time, believed it wasn't necessary.
Even though the index was wrong as demonstrated
in the above example, it was then converted
with the expression `field[@name="foo"]`
instead of `field[2]`, and therefore it was
fine not to include the `field` nodes
in the strategy.
Also, fields were not included in the strategy
because for them, if the `groups` is set
in the Python model
e.g.
```py
currency_id = fields.Many2one(..., groups='base.group_multi_currency')
```
Attempting to read them while you don't have the group
will lead to an AccessError exception.
And there was no way to display the field as invisible in the view
without the web client to try to read its content.

Unfortunately, it isn't the case,
as demonstrated by the tours included in this revision,
field nodes must be included in the views, as invisible,
so Studio can compute correctly the xpath expression.

This revision therefore aims to apply the same strategy
for `field` nodes, make them invisible instead of removing
them from the view when the user is not part of the groups.
The revision takes care to override the web client so it doesn't
try to read the value of group-protected fields when the user
doesn't have the group.
So the field, with the label and everything,
is included in the view, but its content/value is left empty,
as the user cannot read the content.
Technically, there won't be many cases, because
users editing views using Studio are admins,
and in most-cases admins have access to these group-protected fields.
Having a field group-protected to which the admins do not belong
doesn't happen that often.

closes odoo/odoo#107877

X-original-commit: 91f213e202ca29c4ef0bb190663fc48f169a64a6
Related: odoo/enterprise#34940
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
Co-authored-by: kebeclibre <lpe@odoo.com>
2022-12-14 11:42:02 +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
FrancoisGe c82cb3b5cd [IMP] base: add widget in tree view rng validation
Before this commit, it was possible to define a <widget/> in the arch of
an x2many in list mode. But this was not supported in normal list views.

So in order to unify the api, we decided to support in the list
view as well.

In a future commit, we plan to improve the widget api to receive only
the necessary props.

closes odoo/odoo#107811

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-12-13 13:51:48 +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
Romain Estievenart 36f2d1688f [ADD] web: Android mobile app feature detection
This commit adds a proper way to detect the Android OdooMobile app using
the User-Agent.

closes odoo/odoo#107392

Related: odoo/enterprise#34088
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-12-11 17:42:57 +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
Nshimiyimana Séna bbca44b1a3 [FIX] web: make list view table borders visible in Firefox
## Steps to reproduce
* Using Firefox, Go to Accounting > Invoices > create a new invoice.
* Add a line to the invoice and remove the label.

You should see that there's no indication that the label field is
required. (It works well in Chrome)

## Cause
This is happening because the table borders (that become red when a
field fails validation) are not displayed in Firefox.

opw-3040299

closes odoo/odoo#107564

X-original-commit: 74726c649fa5bddec30573c18acd11020302d093
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Signed-off-by: Nshimiyimana Serge Séna (sesn) <sesn@odoo.com>
2022-12-09 08:46:10 +01:00
xO-Tx 3eebf5e384 [FIX] web: properly handle RTL direction for autoMoreMenu
Issue:

1. Install eCommerce + set up "Contact" header (there are probably other
   configurations where this bug occurs but this one fails for sure).
2. Go to website in english version (with few menu items on header)
3. Switch language to Arabic
=> The "+" dropdown appears on the header even when there is enough
   space for other menu items.

Explanation:

The 'AutoMoreMenu' option is used on website menu to auto adapt the
header layout so that elements are not wrapped on a new line (and sets
a "+" dropdown that contains the overflowing menu items).

When the language is switched to Arabic (or any RTL language), the
current code ('computeFloatOuterWidthWithMargins()' method) won't be
able to compute the reversed margins correctly for "unfoldable" items:

For example, if we want to compute the width (including margins) of the
"user dropdown":

============================================
IW -> Initial width value (without margins)
LR -> Left margin computing
RM -> Right margin computing
============================================

A- On English version (LTR):

1- LM: item has left auto margin class -> left margin won't be added.
2- RM: item has no right auto margin class -> right margin added (=== 0)
3- The final width is the same as the initial value (IW).

B- On Arabic version (RTL):

1- LM: item has left auto margin class -> left margin won't be added.
2- RM: item has no right auto margin class -> right margin added (> 0).
The right margin value added here is just the left auto margin
reversed because of direction. The code will return a final width > IW
and since the item is "unfoldable", its width will reduce the available
space for foldable items.

Solution:

The goal of this commit is to make the code smart enough to avoid adding
wrong right/left margin value caused by left/right auto margin class
on 'RTL' direction.

opw-2963123

closes odoo/odoo#107573

X-original-commit: 8a4a59389338ad1f50c08df3d55c267ca4d830da
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-12-08 19:59:17 +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
niyasraphy 9a976a8c9a [FIX] various: uniquify the the !
Just change double the by single. This fixes various typos in error and
code comments.

closes odoo/odoo#107266

X-original-commit: 09dfedfc19c2bc34c2bb394dcc4bc609c5ac0107
Related: odoo/enterprise#34681
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-12-06 10:52:50 +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
Lucas Perais b50fec6aa9 [FIX] web: x2many fields: set display name and correct supported types
Before this commit, the X2ManyField did not have a display name and its supported
types only mentioned one2many.

After this commit, those fields have a display name and the type many2many
is rightfully put has beng handled by the fields.

Part-of: odoo/odoo#107233
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
niyasraphy d4363b8321 [FIX] web: prevent caret overlap with nested group name in list view
When converting the list view to owl, the caret indicator for groups in
list view was incorrectly given the extra class `fa-fw` which gives the
icon a fixed-width. This is incompatible with using padding as spacers,
and caused the caret to overlap the group name in nested groups.

This commit fixes that by removing the `fa-fw` class.

closes odoo/odoo#106994

X-original-commit: ff1055ddd07653d156a5887081f3ebe22dcbcae0
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-12-01 18:30:55 +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
Bruno Boi 66f60540c6 [IMP] web: update owl from 2.0.1 to 2.0.2
Release notes: https://github.com/odoo/owl/releases/tag/v2.0.2

- fix: compiler: do not look up ComponentNode in the context
- fix: t-model takes precedence over t-on-input
- fix: reactivity: fix issues with reactive objects in proto chain

closes odoo/odoo#106898

X-original-commit: a86a8544883aaaf5d530320c84706dde35d17ef6
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2022-11-30 19:05:56 +01:00
FrancoisGe f953e91f43 [FIX] web: add Shortcut CTRL+K in user menu
Purpose:
Make the command palette easier to discover - indeed, unless you
know about CTRL+K, it's difficult to know you can use that elsewhere
than the home screen.

Solution:
Add CTRL+K next to the Shortcut menu in the user menu.

closes odoo/odoo#106820

Tackid: 3074492
X-original-commit: 536ea340ec1347a4a7598b5b51e2f2801521973f
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Georis François (fge) <fge@odoo.com>
2022-11-30 15:06:20 +01:00
fdardenne 1182fdebf7 [FIX] web: list: fix focus function for checkboxes
The input element properties `selectionStart` and `selectionEnd` method
applies only to inputs of types `text`, `search`, `URL`, `tel` and
`password`.

This specification is interpreted differently depending on the browser:
Accessing those properties in a `checkbox` input results in a crash in
Safari but not in Chrome/Firefox.

Current behaviour:
In a list view, in safari, press the arrowdown key -> it causes a crash

Expected behaviour:
Pressing the arrowdown key causes the next checkbox to be focused.

closes odoo/odoo#99050

Related: odoo/enterprise#34101
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2022-11-30 15:06:00 +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
Didier (did) c9ea3d0fa7 [IMP] web: expose immediate in useDebounced hook
Expose all debounced param in the hook.

closes odoo/odoo#106762

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-11-29 11:34:03 +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
Romeo Fragomeli 755cb64b4a [FIX] web: titles are smaller in reports
Since the Bootstrap 5 migration the "headings" `<h1>`, `<h2>`, ... are
smaller than before.

This commit, restores the old CSS rules from Bootstrap 4 for reports.

Steps to reproduce:
* Open Sales
* Select a quotation
* Print the Quotation (using Print dropdown) => BUG title is smaller
  than the old version of Odoo (e.g. Odoo v15)

closes odoo/odoo#106721

X-original-commit: 76299a8d63e85249d30d864a777c2f142ea5daf5
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-11-28 17:54:03 +01:00
Romeo Fragomeli 3dc6d81590 [FIX] web: kanban: quick create column text wrapped
In kanban view, the columns are in a flex container and as there is no
specific flex rules on the quick create column and is shrink by
default. So when the new column is above the edge of the viewport, it
starts to shrink.

To avoid this bug we have added the same flex rules has the kanban
column.

Steps to reproduce:
* Open Note
* Create many new column => BUG text wrapped when the new column reach
  the width of the viewport.

closes odoo/odoo#106683

X-original-commit: 62b692b6edd7d57ef14c02ecd5b731c8ba664b98
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2022-11-28 15:53:25 +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
Mathieu Duckerts-Antoine 74c5692f48 [FIX] web: fix the error that the name of the line is too long
- Currently the label of the lines is not limited to the number of characters. When the user gives a name that is too long, the graph will not be displayed.
- This commit limits the number of labels, if exceeded it will display as ...

closes odoo/odoo#106623

X-original-commit: 54657151957c5be5e885c245db9e1830709833c0
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-11-28 14:51:39 +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
Antoine Guenet fc080b960d [IMP] web: extend form default autofocus to textarea and contenteditable
When rendering, the form view looks for the element it should autofocus,
and defaults to the first text input it finds. This extends that default
behavior to the first textarea or contenteditable element.

closes odoo/odoo#106622

X-original-commit: 82a98715ae2937bff8b58212c452a28d0b28e102
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-11-28 13:20:41 +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
Walid HANNICHE (waha) 7214345b25 [FIX] web: adding toggle to view with studio
Steps to reproduce:
- edit RFQ model with studio
- add a toggle widget to the product list
- activate/deactivate the toggle multiple times on different products

Bug:
sometimes the element on the widget is undefined when trying to rerender

Fix:
check the element is defined before trying to render it

opw-3013024

closes odoo/odoo#106614

X-original-commit: 1b09a6314dbce9363f4785c670033f41846359ad
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
2022-11-25 19:51:59 +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