Commit Graph
1530 Commits
Author SHA1 Message Date
Mathieu Duckerts-Antoine 122190b31b [FIX] web: lower precedence for globalContext keys
Go to Project -> Reporting -> Timesheets and Planning Analysis and
select other measures in the pivot view via the "Measures" menu.
After that create a new favorite.

Result: the favorite is saved with the correct measures but the
pivot view will never use those measures. This is due to the presence
of the key "pivot_measures" in the action context.

(Note that the same problems occurs with other keys and other views)

We fix that problem by giving less precedence to keys in action contexts
with respect to those found in the search item contexts as it was
originaly the case in legacy views (cfr. __get method in action_model.js).

opw-2945969

closes odoo/odoo#99631

X-original-commit: 4528f562923cd0524f257f3a9c1ecd0002fd49b7
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-06 21:24:10 +02:00
Aaron Bohy d2bfac8552 [FIX] web: kanban: no quick create icon when quick_create="0"
Before this commit, the "+" icon was displayed in kanban columns
even if the attribute "quick_create" was set to false in the arch.
With this commit, we correctly takes that attribute into account.

closes odoo/odoo#99626

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-09-06 19:20:45 +02:00
Aaron Bohy 40c9986d7d [FIX] web: kanban: reload after creating a record
In kanban arch, one can set the attribute "on_create" on the root
node to an action xmlid. In this case, when the user clicks on
"Create", the action is executed. When this action is in target
new, it opens a dialog (typically to create a record...). Before
this commit, we didn't reload the kanban after closing the dialog.
As a consequence, the newly created record wasn't displayed. For
instance, it was the case in the Recruitement dashboard.

closes odoo/odoo#99589

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-06 10:58:25 +02:00
Lucas Perais e940f14ccb [REF] web: Many2ManyTagsField: only edit color in Form
One can edit the color of a tag in a Many2ManyTags field only in form view.
This commit refactors that field so that the standard field Component doesn't allow for it,
and conversely implements a specialization of the field that can, and should be
selected by the form view.

closes odoo/odoo#99499

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-06 10:58:16 +02:00
luvi 73e2cf08a4 [FIX] web: displays the right status on hover
This commit fixes the StateSelection field, which
displayed the wrong value on hover. In legacy, the title
attribute was set to display that value. Now, it has been
replaced by a tooltip, since it can be used with touch
and is more convenient to use. A test has been modified
to assert the presence of the data-tooltip attribute.

closes odoo/odoo#99561

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2022-09-05 22:51:57 +02:00
Lucas Perais 7f0f7bcdce [FIX] web: Many2One in list: keeps input after record create
Have a many2one in an editable list view. Type something in the input and click
on "Create and edit".

Confirm the record creation in the modal.

Before this commit, the input of the field disappears.

After this commit, the input stays.

closes odoo/odoo#99480

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-05 16:54:16 +02:00
Aaron Bohy b9cf71f2d6 [FIX] web: form: do not add "o_xxl_form_view" class in dialogs
This class is added automatically on large screens, to better
style the form view to benefit form the available space. However,
the width of dialogs is limited, so it makes no sense to apply
this classname in this case. If we do, those form views may display
an horizontal scrollbar. For instance: in project with worksheets
enabled, create and edit a worksheet many2one.

Part-of: odoo/odoo#99503
2022-09-05 12:40:29 +02:00
Lucas Perais f4a8d5bf9b [FIX] web: legacy Many2ManyTags in list view: add/remove records
Have a list view (new RelationalModel inside a WOWL list view) that has
a legacy many2many tags field in its arch.

Try to add or remove some records from that many2many.

Before this commit, there was a crash, because the legacy field wrapper
doesn't use the model the right way for that case.

After this commit, there is no crash.

closes odoo/odoo#99431

Signed-off-by: Georis François (fge) <fge@odoo.com>
2022-09-02 10:16:01 +02:00
Julien Mougenot d3eff197a5 [FIX] web: Fix binary and pdf_viewer fields
This commit aims to make the BinaryField and PdfViewerField appear and
act the same way as they did before their conversion to Owl.

This mostly consists of a few tweaks in the conditional rendering of
certain elements in the template, and the rest of the changes are meant
to clean and simplify the values the component is working with.

closes odoo/odoo#98251

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2022-09-01 19:17:00 +02:00
FrancoisGe c70d01f429 [FIX] web: save a x2m with an invalid new record
The purpose of this commit is to prevent saving to a form view
if you have created and edited a new invalid record in an x2many.

How to reproduce
- go to a form view with an x2m
- create a new record with at least one required field empty in the x2m
- edit another field than the required one
- click on the save button

Before this commit:
- The view is switched to readonly mode and the new record is deleted.

After this commit:
- The view stays in edit mode, the new record is not deleted and
a notification indicating invalid fields is displayed.

closes odoo/odoo#99288

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-01 17:11:08 +02:00
Bruno Boi 78ac086539 [REF] web,*: raw_value as ISO8601 in kanban templates
This commit will make date(time) raw_value an ISO string
instead of a native JS Date.

- Before this commit
In kanban templates:
  - the raw_value property of a record's date/datetime field is
    a native JS Date object.

The problem with raw_value is that JS Dates toString
method depends on the system locale and timezone.
In the code base, the usage of raw_value for date/datetime fields
usually parse the raw_value into a luxon DateTime object
in order generally to display it in a specific format, or in order
to compare it to another luxon DateTime object (e.g. the now instant).

- After this commit
The raw_value property of a record's date/datetime field
has become an ISO8601 string, instead of native JSDate toString
format (which I recall depends on system's locale and timezone).
The ISO8601 format is easier to work with.

Part-of: odoo/odoo#98980
2022-09-01 17:10:59 +02:00
Bruno BoiandJulien Mougenot 0f49724436 [IMP] web: simplify format/parse/deserialize date(time) utils
The goal is to improve the dates utility functions (parse/format) by removing the timezone option, which is difficult to understand and has proven to be error prone.

- Rationale
When manipulating DateTime objects on the JS side, associated timezones
must be always coherent.
Until now, there were several code parts that had to check the DateTime
timezone and handle things differently in a case or another.
This sometimes lead to wrong code.
E.g. there was a bug in the DatePicker component because the DateTime
object it receives in props is in local timezone, but once it updates it
through the parse utility, the new object is in UTC.

- After this commit
The DateTime objects you'll get through deserialization or parsing are
always set in the user's local timezone.
The formatted strings you'll get through formatDate and formatDateTime
utils will always be expressed in the user's local timezone.
The formatted strings you'll get through serialization utils will always
be expressed in UTC.

- serializeDate and serializeDateTime
  - expected input: a DateTime object (its timezone does not matter)
  - outputs: a string formatted for the server expressed in UTC

- formatDate and formatDateTime
  - expected input: a DateTime object (its timezone does not matter)
  - outputs: a string formatted for the user, expressed in the user's TZ

- deserializeDate and deserializeDateTime
  - expected input: a date(time) string provided by the server, in UTC
  - outputs: a DateTime object in user's TZ

- parseDate and parseDateTime
  - expected input: a date(time) string provided by the user, in its TZ
  - outputs: a DateTime object in user's TZ

- Other changes in this commit
As the timezone option has been removed from parsing/formatting utils,
all their usage had been adapted in the codebase.
The large diff in dates_tests.js is because some tests were reorganized,
others were removed/adapted/joined.
A test has been removed from daterange_field_tests.js, because it has
no sense: it displays a date field as a datetime, but a date field does
not have any time information.

Part-of: odoo/odoo#98980
Co-authored-by: Julien Mougenot <jum@odoo.com>
2022-09-01 17:10:59 +02:00
Lucas Perais a62768a8a6 [FIX] web: FormRenderer is responsible for focusing default field
The FormView can autofocus a `default_field` if it exists, or, the first usable
field.

This commit moves the logic to the FormRenderer, has we need this feature in the KanbanRecordQuickCreate.
Besides, it makes sense for the FormRenderer to have that responsibility.

closes odoo/odoo#99297

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-09-01 15:33:08 +02:00
Dardenne Florent (dafl) 86feda1968 [IMP] web: kanban: drop card only when a column is highlighted
Before, when the user dragged a card outside of a column
(e.g. whitespace to the right), the card was moved to the last stage
for which the event handler for the target was registered.

Now, we move the card only when the card drop is done inside a column.

task-2459381

closes odoo/odoo#98897

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2022-09-01 15:32:59 +02:00
Dardenne Florent (dafl) 209a97c61b [IMP] web: kanban: highlight destination column on drag&drop
Before, the destination column while drag&drop was not highlighted.
Therefore it was not obvious for the user in which column the card
would be dropped. e.g. when the column header is not visible because
the user scrolled

Now, the destination column is highlighted when drag&dropping a card.

task-2459381

Part-of: odoo/odoo#98897
2022-09-01 15:32:58 +02:00
Achraf (abz) a51eecbddb [FIX] web: Move context in kwargs
The context should be a key inside the kwargs object.

since https://github.com/odoo/odoo/pull/99018/commits/97cf55fc1e510b1473670863fd44a0a38047ce9c

closes odoo/odoo#99331

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-01 11:32:35 +02:00
luvi 679739a63d [FIX] web, *: fix ProgressBarField behaviors
*: survey

This commit brings back the correct behavior on blur
to the progressbar field. It turns as a text value as
soon as the user has focused out of the input. It
also removes the wrong usage of the max_value option.

The behavior was wrongly adapted from the legacy
progressbar implementation. Tests have been adapted
to assert the correct behavior.

closes odoo/odoo#98902

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-01 11:32:32 +02:00
Aaron Bohy 0b3212c4b6 [FIX] web: Many2ManyTagsField: honnor options
In the legacy implementation of FieldMany2ManyTags, we instantiated
a FieldMany2One with the attrs of the many2many field node. As a
consequence, the FieldMany2ManyTags honnored its own options and
all options supported by the FieldMany2One.

In the new implementation, before this commit, we lost the support
of the Many2ManyField's specific options, in particular "no_create"
and "no_create_edit". This commit fixes that issue.

With this commit, the FieldMany2ManyTags also takes into account
the "can_create" attribute that is automatically set to "0" by the
framework if the user hasn't the required access rights.

Note: Many2OneField options is a mess, it would be nice to
refactor and simplify them in the future.

closes odoo/odoo#99283

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-31 21:11:58 +02:00
Bruno Boi 0ae158bf43 [LINT] web
closes odoo/odoo#99295

Related: odoo/enterprise#30900
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-31 18:53:51 +02:00
Achraf (abz) 31f389b983 [FIX] *: Adapt old custom-control class of Bootstrap
* = hr_holidays, mail, sale, web, web_editor, website, website_forum,
website_payment, website_sale

https://getbootstrap.com/docs/5.1/migration/

replacing `custom-control` by `form-check` because in bs4 this class had
a use which is not the case in bs5.

closes odoo/odoo#98965

Related: odoo/enterprise#30768
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2022-08-31 16:05:20 +02:00
Aaron Bohy a86d4edb89 [FIX] web: grouped list: support buttons in between aggregates
Before this commit, the list view crashed when it was grouped if
there was a button column in between two "aggregatable" fields
columns. The reason is that "formatAggragatableValue" makes sense
only on field columns, and it crashes when called on a column of
another type. It was for instance the case in the Stock > Locations
list view.

closes odoo/odoo#99289

Signed-off-by: Georis François (fge) <fge@odoo.com>
2022-08-31 12:38:17 +02:00
Mathieu Duckerts-AntoineandMichael Mattiello a29691bfd8 [FIX] web: DomainField: debug input value lost on blur
Edit a domain in the debug text area of a domain field in debug mode
was possible but the value displayed in the text area was reset to the
value displayed in the part above. For instance, starting with a domain
field value like "[('id', '=', 1)]" then editing it in the text area to
be "[('id', '=', 3)]", the value for the domain field would be correctly
updated but the value displayed in the domain field would be the initial
value "[('id', '=', 1)]". We fix that by making the DomainSelector
component accept an extra prop "debugValue" to be displayed in the debug
area instead of the prop "value" if it is defined.

closes odoo/odoo#99207

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
2022-08-31 12:37:51 +02:00
FrancoisGe 1f43844549 [FIX] web: save an empty many2many_tags required
Before this commit, the required attribute has no effect on the x2many
fields. It will always be valid unless one of its records is invalid.

Problem:
In some cases, we would like to be able to make some x2many fields
required. For example, many2many_tags should be invalid if it contains
no records.

In legacy, if a field is required, then it has the responsibility to
evaluate if its value is valid. To do this, each field contained the
isSet function which returns true if the value is set.

In our new architecture, it is the model that evaluates if the value of
a field is valid based on the field type. It is therefore no longer
possible to customise the evaluation of the validity of a field based
on the FieldComponent.

Solution:
This commit will reintroduce the possibility to customize the evaluation
of the validity of a field based on the FieldComponent.
To do this, we add the possibility to define a static isSet function
on the FieldComponent. If this function is present, it will be used
to evaluate if the field value is set or not.

closes odoo/odoo#98873

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-31 12:37:35 +02:00
Lucas Perais 11c1bbbdd0 [FIX] web: changing the priority of a new record in kanban
Have a grouped kanban which display a priority field widget.
Quick create a record.

Click on any priority widget to change the priority.

Before this commit, the model was still considered in edition, preventing any change
in other record. Hence, the priorities did not change (at least, there was no write operation)
when clicked on.

After this commit, this flow works as expected.

closes odoo/odoo#99199

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-30 21:25:15 +02:00
Aaron Bohy bedce02bb7 [REF] web,mail,account: orm service: move context in kwargs
This commit standardizes the API of orm service functions by adding
a "kwargs" parameter, s.t. one can always use those functions even
if the target model overrides the corresponding method to add the
support of a given kwargs. Furthermore, to simplify those function
API, and to close the gap between the js and python APIs, we moved
the "context" argument inside the kwargs.

closes odoo/odoo#99018

Related: odoo/enterprise#30830
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-30 20:23:17 +02:00
Julien Mougenot 8f8f6a52ac [FIX] web: Dropping record in folded kanban column loads it
Before this commit, when dropping a record on a folded column in a
kanban view, the column would not load its records and display a "load
more" button instead.

Now, dropping a record on a folded column loads it entirely before
unfolding it, displaying its records normally (including the newly
dropped one).

closes odoo/odoo#98922

Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-08-30 20:22:58 +02:00
Simon Genin (ges) 5e754ffd4d [FIX] web: fix field update
When a field in readonly view can be modified, it should write to the
backend immediately. (No changes are stored to be comited later)

For some reason, a bit of code was preventing this if the field was
required and had a falsy value. Furthermore, the code seemed incorrect
or at least misplaced. Removing these lines didn't affect the test.

The fix simply remove this extra check.

There was a condition in the update code for required field in readonly
views that prevented the correct flow to be executed. Since no test are
broken removing this check but it fixes the problem, it is removed.

closes odoo/odoo#98978

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-30 09:23:13 +02:00
svs-odoo cbee4b0c06 [IMP] web: add onSave/onDiscard on form_controller
Adds two new props in `form_controller` in order to call a function from
the parent `Component` just after the form view is saved/discarded.

closes odoo/odoo#97314

Related: odoo/enterprise#30045
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-30 09:23:09 +02:00
FrancoisGe e50bee88c4 [FIX] web: touch a record in a x2m
Before this commit, if a touchstart event is performed on a row in an
x2many, then a crash is displayed.

We also use this commit to rename the hasSelector props to allowSelector.
allowSelector is true if checkboxes can be present.

How to reproduce:
- go to a form view in mobile mode with an x2many field
- touch a row in the x2many (trigger an event touchstart)

Before this commit:
    An error is displayed

After this commit:
    Nothing happens.

closes odoo/odoo#98893

Related: odoo/enterprise#30773
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-30 03:44:56 +02:00
FrancoisGe 1ecdbfcfbf [FIX] web: empty a many2one field
Before this commit, it was impossible to empty a many2one in a list view.

How to reproduce:
- go into a list view with a many2one
- empty a many2one containing a value
- click outside the line

Before this commit:
The record goes into readonly mode and its many2one returns to
its original value.

After this commit:
The record is saved and its many2one is empty.

closes odoo/odoo#99140

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-30 02:51:12 +02:00
luvi 33925701aa [FIX] web: fix the copied tooltip of CopyButton
This commit fixes the style of the field, which was
pretty broken since the Owl conversion.
It also bring back the tooltip (as in legacy) when
the button is clicked.

The button now only shows the tooltip if the text
has been copied successfully to the clipboard, and
not appear when it is not allowed or not available
in the browser.

Tests have been added to assert those behaviors.

Enterprise PR to adapt a selector in tests:
https://github.com/odoo/enterprise/pull/30832

closes odoo/odoo#98340

Related: odoo/enterprise#30832
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-30 00:46:26 +02:00
Tiffany Chang (tic) a066638cd5 [IMP] web: allow custom row click action
This commit adds a generic `action="action_some_method"` attribute to
the list view to allow for a custom action when clicking on a (record)
row. This feature mirrors the existing Kanban "action" attribute.

Note that in cases where the action method does not return a valid
action then the default action `act_window_close` will be called
instead (same behavior as the kanban view and buttons in general).

Supports "magic link" part of Task: 2882539

Part-of: odoo/odoo#97109
2022-08-29 23:46:36 +02:00
std-odoo f26cae6db5 [IMP] web: allow non administrators to use relational properties
Purpose
=======

Allow non administrators to use relational properties.

Standard internal users can not read ir.model. Because of that we
created a component that simulate the behavior of a many2one, but
that call custom public method that check which model the user can
access.

Task-2852259

Part-of: odoo/odoo#95184
2022-08-29 23:46:07 +02:00
std-odoo 3961038ddb [IMP] web: create a properties field component
Purpose
=======

Create a component for the new Properties field. This component instantiates
the right sub-component based on the property type (e.g. a DatePicker for a
DateTime, a Many2XAutocomplete for relational properties, etc).

This component also allow changing the properties definition (default
value, model, property type, etc).

Note that currently it is limited to children properties, assuming definition
is done from children to containers.

Add unit tests to ensure that behavior of the properties component is correct.

Task-2852259

Part-of: odoo/odoo#95184
2022-08-29 23:46:06 +02:00
Denis Ledoux 43953c2a4d [IMP] web: allow to have nested buttons in form header
Before this revision,
it wasn't possible, in the form header,
to organize buttons in nodes.
If you attempted to do so, the buttons were not appearing.

e.g. for the below form
```xml
<form>
  <header>
    <button name="0"/>
    <button name="1"/>
    <div id="special_buttons">
      <button name="2"/>
      <button name="3"/>
    </div>
  </header>
</form>
```
Before this revision, the buttons 2 and 3 were not appearing.

Adding this possibility can allow simpler inheritage,
for instance by organizing buttons in sections and then
the inherited view can add buttons directly within the right section,
using a selector targetting the section.

It also allows to restrict a button to users having 2 groups.
e.g.
```xml
<button name="action_draft" position="after">
    <div groups="sale.group_auto_done_setting">
        <button name="action_done" type="object" string="Lock"
            states="sale"
            help="If the sale is locked, you can not modify it anymore. However, you will still be able to invoice or deliver." groups="sales_team.group_sale_manager"/>
        <button name="action_unlock" type="object" string="Unlock"
            states="done"
            groups="sales_team.group_sale_manager"/>
    </div>
</button>
```
If you want to restrict the button `action_done` to users
having both `sale.group_auto_done_setting` and `sales_team.group_sale_manager`,
you cannot put both groups on the same node,
because otherwise it's an OR connection, not an AND.
`groups="sale.group_auto_done_setting,sales_team.group_sale_manager"`
means
"users has `sale.group_auto_done_setting` or `sales_team.group_sale_manager`",
not AND.
So, the only possibility to restrict a button to two groups with an AND
connection is to restrict the button to a group and nest the button
inside a block restricted to the second group.

The above example is an actual example/need from the existing code.
But, as this possibility wasn't there before this revision,
they achieved the goal by using the `groups_id` feature:
```xml
<record id="view_sales_order_auto_done_setting" model="ir.ui.view">
    <field name="name">sale.order.form</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="groups_id" eval="[(4, ref('sale.group_auto_done_setting'))]"/>
    <field name="arch" type="xml">
        <button name="action_draft" position="after">
            <button name="action_done" type="object" string="Lock"
                states="sale"
                help="If the sale is locked, you can not modify it anymore. However, you will still be able to invoice or deliver." groups="sales_team.group_sale_manager"/>
            <button name="action_unlock" type="object" string="Unlock"
                states="done"
                groups="sales_team.group_sale_manager"/>
        </button>
    </field>
</record>
```
So they had to use an inerited view for that purpose only to restrict
the button to two groups. It's a work-around.

It is much simpler to allow to have nested buttons in the header of the
form.

closes odoo/odoo#98551

Related: odoo/enterprise#30643
Related: odoo/upgrade#3812
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-08-29 22:42:56 +02:00
Samuel DegueldreandAchraf Ben Azzouz b9bdf2a139 [FIX] web: display translation alert after status bar
The newly converted form view displays the translation alert above the
form renderer, but we want the translation alert to be present below the
status bar when there is one.

This commit fixes that by moving the display from the form controller to
the form renderer.

closes odoo/odoo#98434

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Achraf Ben Azzouz <abz@odoo.com>
2022-08-26 21:36:58 +02:00
Brieuc-brd 8fa6e923d0 [REF] web, website: FormView, review and simplify scss
Review, simplify SCSS and adapt legacy code.
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2918464

closes odoo/odoo#98101

Related: odoo/enterprise#30421
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-08-26 18:41:36 +02:00
william d92a8b5ffd [IMP] web: continue to edit lists when editable=top
Previous behavior
================

When `editable=bottom`, when we hit tab until the end of the line, the
user starts to create a new record.
But when `editable=top`, when hitting tab multiple until the end of the
line, the user starts to edit the first line that was existing before
instead of creating a new one.

New behavior
============

The behavior is consistent between both cases: the user can always
continue to edit lines one after the other.
The behavior for `editable=bottom` is not changed, but `editable=top`
continues to add lines on top one of each other.

linked to task-2879904

closes odoo/odoo#98603

Signed-off-by: Georis François (fge) <fge@odoo.com>
2022-08-25 22:46:00 +02:00
Bruno Boi ec70294e64 [FIX] web: invalid kanban record quick_create stays open
- Before this commit
Validating an invalid kanban record on quick creation
would leave the quick creation mode.

- After this commit
Validating an invalid kanban record on quick creation
will stay in quick creation mode, indicating which fields are invalid.

closes odoo/odoo#98874

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-25 12:05:47 +02:00
Julien Mougenot b8d4c41331 [FIX] web: Fix behaviors of ProgressBarField
This commit fixes behavior issues in the progress bar field:

- the progressbar would not write on a field if it was declared as
'readonly' on the server (it sounds counter-intuitive but this widget
was supposed to write on records unless given the 'readonly' flag in the
field options);

- the "isEditable" prop was incorrectly computed, resulting in the field
not being editable in kanban views when it should be;

- when editing a value in the field, the focus should be automatically
given to the first input.

These issues have been fixed in this commit.

closes odoo/odoo#97411

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2022-08-25 12:05:03 +02:00
FrancoisGe c200b0cc8a [FIX] web: many2one close "No records"
Before this commit, when a many2one's input shows the choice
"No records", the dropdown does not close.

Cause:
When blurring, the many2one will select its first item. In our case,
"No records" is not selectable and it will not close the dropdown.

How to reproduce:
- go to a form view with a many2one field
- insert a non-existent value in the many2one ("No records" is displayed)
- leave the many2one input ("blur" event)

Result before:
The dropdown containing "No records" is still open.

Result after:
The dropdown containing "No records" is closed.

closes odoo/odoo#98799

Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2022-08-25 10:32:04 +02:00
FrancoisGe 15a032e84a [FIX] web: placeholder in required SelectionField
This commit adds the possibility of having a placeholder in a
required SelectionField.

Solution:
We always add a false option with the placeholder but it is "display:none"
if the field is required.

How to reproduce:
- create a new record in a form view with a required selection field

Result before:
    The first option of the selection field will be selected

Result after:
    The placeholder of the selection field will be selected

When editing the selection field, the selection field does not propose
the placeholder.

closes odoo/odoo#98823

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-25 09:06:30 +02:00
Simon Genin (ges) cc6c1e5d92 [FIX] web: kanban dropdown should close on click
With the current implementation of the kanban dropdowns, clicking on a
element doesn't drop the dropdown.
Often it's not a problem as the clicked element initiates a new action.
However, on some occasions (like with a color picker), we want it to
close.

Waiting for a kanban card refactoring, we need to find a bit of a hack:
we wrap the content comming from the arch inside a small component that
only listen for clicks and close the parent dropdown.

closes odoo/odoo#98773

Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2022-08-25 04:20:45 +02:00
Samuel Degueldre f00df383ea [FIX] web: correctly compute colspan of empty line in list renderer
Previously, the colspan of empty lines in list view did not account for
the fact that the column with the delete action is not always present,
resulting in incorrect colspan on empty lines when it is not.

This commit fixes that by accounting for it, and also fixes the size of
the header of that column, which is supposed to be fixed at 32px but
wasn't in some circumstances.

closes odoo/odoo#98711

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-25 03:11:45 +02:00
Aaron Bohy 545e2378ab [FIX] web: render label with empty string to preserve layout
Previously, when a label in a form arch had an empty string attribute,
we would not render it at all as it seemed useless. In practice, some
existing form arch rely on empty labels being rendered for layout
reasons, and the corresponding views are now broken.

This commit fixes that by instead rendering an empty label, just as
legacy views used to.

Part-of: odoo/odoo#98711
2022-08-25 03:11:45 +02:00
Bruno Boi a7fb02e3fa [FIX] web: autocomplete should keep input value on search more
# Before this commit
When searching more in an autocomplete component,
the input value is emptied before opening the Search More dialog.

# After this commit
The input value keeps its content when the Search More dialog opens.

closes odoo/odoo#98639

Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2022-08-25 01:54:04 +02:00
FrancoisGe 145234749a [FIX] web: create="0" in a grouped kanban view
This commit is to remove the "Create" button in a grouped kanban view
with create="0".

Problem:
In a kanban view with create="0", the "Create" button should never be
displayed.

How to reproduce :
- go to a kanban view with create="0"
- group the view

Result before:
The "Create" button is displayed

Result after:
The "Create" button is not displayed

closes odoo/odoo#98691

Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2022-08-24 18:38:53 +02:00
FrancoisGe 211a38b4b0 [FIX] web: ReferenceField with model_field option
Before this commit, if we have a reference field with a "model_field" in
X2many in list mode and we modify this record, then the value of the
reference field is set to false.

Cause of the problem:
The reference field assumes that the preloadedData are always available.

How to reproduce :
- Go to an x2many in list mode containing a reference field with a
 "model_field" already containing a value
- edit another field than the reference
- click outside the record

Result before :
The record switches to readonly mode and its reference field contains
the value false

Result after:
The record switches to readonly mode and its reference field has not
changed value.

closes odoo/odoo#98630

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-23 17:55:28 +02:00
Dardenne Florent (dafl) d3905b5bb7 [IMP] web: improve statusbar widget performance
Purpose:
Improve performance/reduce server load for the status bar widget when
the underlying field is a m2o.

Before this commit:

The status bar widget does two calls:
- a search_read request to retrieve ids and folds
- a name_get to retrieve names

With this commit:

The name_get can be avoided to save a call by fetching display_name in
the search_read.
This commit removes the name_get call to retrieve the name directly
from search_read.

task-2919535

closes odoo/odoo#98164

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-23 17:55:18 +02:00
FrancoisGe 4f87c9c07f [FIX] web: switch the record with keynav in FormView
Before this commit, in a formView, if you modify an input and use
the keynav (alt+n or alt+p) to change the record, then the modification
is not saved.

How to reproduce?
- go to a form view with a pager containing more than one record
- edit an input
- press alt+n to move to the next record
- press alt+p to go back to the previous record

Result before:
    The record has not changed

Result after:
    The record has saved the change.

closes odoo/odoo#98602

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-23 16:29:25 +02:00