Before this commit, images' url where just built upon the record's id and model.
Since the browser caches GET requests by url, the same record would always have the same image url.
Hence it appeared that when changing a record's image in form view, and going back
to the kanban, the image displayed was the old one.
A good enough approximation to solve this (and was actually solved in legacy code), is to use
the record's __last_update field, which basically tells the browser to re-fetch
a record's image when then record go through any modification.
After this commit, images are correctly updated in kanban and form views.
closesodoo/odoo#97544
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Before this commit, if the header of a column (X2many/ListView) has the
focus, a record is being edited and a key is pressed, then a crash is
displayed.
closesodoo/odoo#97559
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Have a color field with an onchange on it.
Change the color.
Before this commit, the onchange was not passed to the server. This was
due to the internal of ColorField, which refreshed its value to the old one
even before owl or odoo did anything.
After this commit, the call to onchange is correctly passed.
closesodoo/odoo#97476
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
With the new views in owl, we wrapped every field in a div with the
class o_field_widget. This is a good thing in general, but it has the
issue that before this commit, the display property was set to
inline-block, in all cases.
With this commit, we set it to 'contents', which means that it will
simply get the correct display value from its content.
Part-of: odoo/odoo#96865
Before this commit, the isVisible helper would most of the time work as
expected, except if an element has display: contents. In that case, it
has no bounding box, but it may still be visible if one of its child
is visible.
This is particularly important since we want to set the display property
of all field components to "contents".
Part-of: odoo/odoo#96865
Have an editable list view, displaying a many2many tags field. The m2m field
has a context, mentioning `active_id`. (`context="{'default_field': active_id}"`)
"basic context keys" is to be understood as the usual suspects: active_id, active_ids, current_company_id, active_model
Type something in the m2m input, and selet create and edit, in order to create a new record in a dialog form view.
Before this commit, there was a crash because active_id was not present in the evaluation context.
After this commit, the new record opens in its form view, with the right value for the field that must have a default.
closesodoo/odoo#96910
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
This commit improves the style of the image widget
to use more approriate icons for edition/deletion.
Before this commit, a rectangle was covering the
entire image to highlight those buttons. Now, only
those are visible and highlighted on desktop when
hovered, while being always visible on mobile.
This will improve the visibility of this field
with views being always-edit.
task #2860958closesodoo/odoo#97208
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, the Ace editor field did not update on props change.
Now, it will update its value and options when the props keys "value",
"mode" or "readonly" are modified.
closesodoo/odoo#97396
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Previously, when editing an image field and choosing a new image, the
image preview would update itself to show the selected image. With the
conversion of the image field, this behaviour was lost. This commit
restores that behaviour.
closesodoo/odoo#97370
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Define in python a domain on field in the string form containing a leaf of that style
`[('field', '=', field)]` the second field doesn't have quotes around as we want it to take the current value
of the record, JS side.
Given that the field is a m2o, click on the autocomplete to trigger a name_search with that domain.
Before this commit, there was a crash as the dynamic value for `field` was absent from the evaluation context
of the domain.
After this commit, the domain sent to name_search, or at any time, is correctly evaluated.
closesodoo/odoo#97342
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit converts the radio image field of hr_timeoff
to the new framework and renames the registry key to
time_off_radio_image.
closesodoo/odoo#97103
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Have a x2many field with a _view_ref (ie tree_view_ref) in its context
Open the select create dialog (Search More) of that field
Before this commit, there was a crash because the _view_ref string was passed to the get_views
as if it were an Integer ID.
After this commit, there is no crash, and the select create dialog opens correctly.
closesodoo/odoo#97224
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In the BS5 migration, the legacy `checkbox` and `boolean_toggle` widget
were adapted but not the OWL Component.
Also, we have tweaked the old widget and the component to have better
positioning and margins.
Note:
the CSS for the print is already done in BS5
```css
@media print {
.form-check-input {
color-adjust: exact;
}
}
```
Also we change `offsetWidth` by `getBoundingClientRect().width` in
`list_renderer` to avoid inaccurate rounding in columns width's
calculation.
Lastly a `.o-checkbox` class is added to the Checkbox component for a
more universal and context independent targetting.
closesodoo/odoo#96185
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
An X2many always has at least 4 lines. If the X2many contains less
than 4 filled lines (Record or "Add a line") empty lines are added
to make up the difference.
For example, an X2many in edit mode containing only one record:
- Line containing a record
- Line containing "Add a line
- Empty line
- Empty line
closesodoo/odoo#97070
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, the checkValidity of a record did not wait for
the application of the current updates. This was causing crashes or
records being abandoned despite an update being in progress. It is
necessary to wait until all updates have been applied before checking
the validity of a record.
For an x2many in list mode:
- create a new line
- edit the line in a valid way
- click outside the x2many while the onchange is in progress.
Result before:
- display a crash
Result after:
- X2many correctly updated
For a list view:
- Create a new record
- edit a field of the record in a valid way
- click outside the list view
Result before:
- abandon the record
Result after:
- the record was saved
closesodoo/odoo#96725
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, in a field selection, it was possible to have two
blank options.
To reproduce this problem, you need to have a non required selection
field and one of the selection sent by the server has the value false.
Our solution is to ignore the false selection returned by the server
and add the false option only if the field is not required.
closesodoo/odoo#96951
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Have a form view with a one2many list with one record inside.
Click on it to open it. The form view that will open must also have a one2many list
Before this commit, there was a crash because the information of the main record's view
was not propagated to the form view of the opened record. Generally speaking, env.config was lost.
After this commit, we propagate correctly the config.
closesodoo/odoo#96618
Signed-off-by: Géry Debongnie <ged@odoo.com>
This commit fixes an issue with the ImageUrlField
widget. When no value was given, the image displayed
a broken file instead of being empty. A test
has been added.
closesodoo/odoo#96820
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
When rewriting the Form view, we wanted the keyboard navigation using
"tab" and "shift+tab" to use the native browser behaviour. The purpose
of this commit is to remove the custom behaviour of X2many in a
form view when a "tab" or "shift-tab" make it be focused.
Before this commit, a new empty line would be created automatically.
After this commit, the button "Add a line" takes focus but no new line
is created.
If one wants to add one, that can be done by pressing "Enter".
Part-of: odoo/odoo#96101
In this commit, we improve some tests by making them use the util
function "editInput". Indeed those tests were incorrectly reflecting
the edition of an input: normally, change the value of an input should
trigger an "input" event.
Part-of: odoo/odoo#96101
Before this commit, in an X2many in editable list mode with a handle
field, if you passed a record in edit mode, the handle field was focused.
The expected behaviour is to focus the first editable field.
Part-of: odoo/odoo#96101
Before this commit, in an X2many in editable list mode, creating two
valid records in succession by pressing Enter caused the first record
in the list to go into edit mode. The expected behavior is to add a new
empty line.
How to reproduce:
- Create a first valid record
- Press the enter key to validate it and a new line is created
- Complete this new line in a valid way
- Press the enter key to validate it
Result before the commit:
The first record switched to edit mode and there is no new empty line.
Result after this commit:
A new blank line is created in edit mode.
If you press enter again the empty line is validated and a new line is
created.
Part-of: odoo/odoo#96101
Before this commit, in an x2many in list mode, it was possible to switch
several records to edit mode.
Normally, it is not possible to have more than one record in edit mode
in a list mode X2many.
How to reproduce:
- Have an X2many with at least two record already.
- Modify a field of the first line and make it invalid
- Click on the second record
Result before the commit:
Both records will be in edit mode.
Result after the commit:
The invalid record stays in edit mode and the other record stays in
readonly mode.
Part-of: odoo/odoo#96101
With the conversion of views to the new webclient, the o_xxl_formview
class was no longer applied as expected, which broke the layout and the
width calculation in embedded list views (as the chatter would take up
more space than intended during the width computation). This commit
fixes that by adding the class when needed.
This commit also moves the css rules relative to that class which are
mainly used for the side-chatter, from enterprise to community, as the
side chatter has been made available in community as well.
closesodoo/odoo#96627
Enterprise: odoo/enterprise#29803
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit fixes the wrong implementation of the
field. It was not functional and is now using the
FileInput component.
Before the commit, it was not possible to upload or
delete files from the list. Test has been adapted to
those changes.
Toast notifications were also missing, and a new
test has been added to check that a notification is
correctly displayed when the server responds with a
error message for a given file.
Part-of: odoo/odoo#96357
The new list and form views were merged recently [1], but they
weren't activated because they weren't 100% ready yet. This is now
the case. This commit adds those views to the view registry. As a
consequence, a lot of qunit tests and tours needed to be adapted,
mostly for selector changes.
We also add legacy list and form views to the view registry, with
keys 'legacy_list' and 'legacy_form'. This allows to force those
legacy views when necessary. For instance, we did it in views
using complex custom legacy x2many field widgets that haven't been
converted yet (we have a compatibility layer but it isn't complete
and doesn't support every advanced usecases).
[1] odoo/odoo#92475
Part-of: odoo/odoo#78221
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>
Before this commit, if an arch contained a tree which itself contained
a tree, the parser would crash.
The reason for this crash is that the parser was trying to parse the
second tree with the model of the first. So it didn't know the fields.
The solution is to stop the exploration of children when it is not
necessary. For example, for fields, it is not necessary to explore
the children, it is parseFieldNode that takes care of it.
Part-of: odoo/odoo#78221
Previously, the statusbar field didn't display the currently selected
value for selection field in mobile, as the getter to compute the name
of the currently selected item only accounted for the many2one case but
not for the selection field case.
This commit adds handling for the selection field case and a test for
it.
Part-of: odoo/odoo#78221
The goal of this commit is to allow an X2m in list mode with a custom
controller to use the controller context when creating a new line with
a 'tab' keydown.
Part-of: odoo/odoo#78221
Before that commit a zero value for a monetary field would be wrongly
considered invalid. This would block many flows (e.g. a save).
Part-of: odoo/odoo#78221
Before this commit, the ace editor crashed when switching to edit mode or
when clicking in it.
After this commit, it works as expected.
Part-of: odoo/odoo#78221
The legacy ProgressBar could receive a title in props that it had to
display.
In this commit, we add support for the title props in the new
ProgressBard field.
closesodoo/odoo#95922
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
The new implementation of float field has some problems dealing with
external changes that would impact it. The specs are changed to format
on blur. It was overly complicated not to as the behavior of all input
fields are controlled through the input field hook.
Note: in the past, formatting would only occur after a save action, now
the formatting is on blur.
The input field hook had some issues dealing with invalid and dirty data
so this has been fixed as well.
closesodoo/odoo#95364
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, we asserted that the view did not switch to form when clicking
on the the color picker. It was wrong because there is no action manager, hence no possibility
to effectively switch view.
After this commit, we assert that the list view's callback selectRecord is not called, which
is equivalent.
closesodoo/odoo#96159
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In legacy, the domain field had an `in_dialog` option that was
used to display a button that opens a dialog to edit the value.
This commit reimplements the `DomainSelectorDialog` in owl
and adds the option the new domain field.
closesodoo/odoo#95768
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, a class was missing when the monetary field was on
edit mode. This results in a non-alignment between the monetary symbol
and the value.
closesodoo/odoo#95620
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, the record was given to `field.extractProps`
so it could return props based on the record.
Now, only the attrs and field is given so it can be called
only once when parsing the arch (except for kanban).
closesodoo/odoo#95389
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, all radio buttons were on horizontal style,
the o_vertical class was not taken into account.
closesodoo/odoo#95553
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
- modal 'show' option doesn't exist anymore
-> We need to call .show()
- by default, show is not the default
-> we need to call .show() explicitly.
- generic close button for dismissing content like modals and alerts.
- BS5 modals needs `modal-dialog` class to work
- normally we need also to add `modal-content` class but as the original
XML don't have this nested level of div we don't use it, but instead
we add `pointer-events: auto` for all children `DIV` of `modal-dialog`
-> See DocumentViewer
Task ID: 2766483
Part-of: odoo/odoo#95450
This commit adds the ability to pass a placeholder to all fields
containing an input.
This commit tests the ability to use a placeholder in all fields
containing an input.
closesodoo/odoo#95309
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit
There is an issue about the translatable field button not properly
shown.
A translatable field <input/> or <textarea/> should have a right padding
in order to ensure its text content does not go behind the translate
button.
After this commit
Existing style regarding this is reapplied.
Part-of: odoo/odoo#94952
*base, event, hr_holidays
Before this commit, `<t t-set/>` nodes declared outside the main
div of a kanban card where ignored by the kanban compiler. This
commit fixes that issue. To do so, we refactor a bit the way the
compiler and KanbanRecord handle multiple root cards (typically,
several roots with a t-if/t-elif/t-else, s.t. there's a unique
rendered root), by removing the faulty logic from the compiler
that identified card root nodes (and filtered out t-set nodes),
and introducing a div for the KanbanRecord component on which we
can set classNames, attributes and handlers.
The issue could be observed on the Apps kanban view, as it
displayed the "Install" button, whether the app was already
installed or not.
closesodoo/odoo#95211
Signed-off-by: Géry Debongnie <ged@odoo.com>
This commit fixes the behavior of the tooltip
enabled by the zoom option which displays
the full image when the field is hovered.
Before the commit, the preview_image option was
not used by the field and the full value was used
for both the field image and the tooltip.
A test has been introduced to check that the
field uses the right images sources when both
attributes are present.
closesodoo/odoo#95208
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit fixes some inconsistencies of the progressbar
field widget since it was converted to Owl. Some behaviors
were wrongly adapted and edition was not enabled in kanban
views. It was also missing an option to allow editing the
field value in readonly mode.
closesodoo/odoo#95033
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
"All" is capitalized but not "records".
It should be consistent: either all capitalized, none, or only the first word
closesodoo/odoo#94963
Related: odoo/enterprise#28990
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
With this commit, if the user types something in a numeric field
input that doesn't match its localization, we try to parse it with
the english localization. If it works, we considerer that value.
Otherwise, we throw an error.
al request
Part-of: odoo/odoo#92475
This commit introduces the new kanban, list and form views written
in owl. Even though it contains the implementation of those 3 views,
only the kanban view is activated for now (the list and form views
aren't 100% ready yet, so they aren't added to the view registry).
Alongside the views, the fields (<field name="..."/> in archs) and
widgets (<widget name="..." in archs) of web/ have been implemented
in owl as well. Legacy ones remaining in other addons are supported
in our new views, thanks to a compatibility layer. The goal is to convert
them asap though.
Legacy views, fields and widgets are kept for now, which explains the
number of added lines in this PR (around half of them concern tests).
They are still extended by custom code in other addons, that still need
to be converted (a lot of them are already on the way). Moreover,
they are still used in Studio as well. The plan is to lazy load them in
the Studio bundle when all custom code extending them will be
converted. Studio will be converted for v17.
Part-of: odoo/odoo#92475
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>