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
Before this commit, the List and Kanban views did not allow the use of
a Banner without adding it in the View definition.
Like this:
```
export const listView = {
...
Banner: OnboardingBanner,
...
}
```
Now, we use by default OnboardingBanner as Banner if no other has been
defined in the View definition.
closesodoo/odoo#95945
Related: odoo/enterprise#29452
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Have an editable list, select a record, click either on a group header or on the list header
press the arrow down key.
Before this commit, there was a crash because we attempted at navigating with the keyboard inside the list from
a wrong entry point. The crash occured because no record was selected.
After this commit, when clicking on something else than a data row or a column that is sortable
we unselect the record. Hence there is no crash when navigating with the keyboard
closesodoo/odoo#96233
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
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>
Doing a `search_count` on millions of records could be very slow. On
large databases, the pager counter "1-80 / 8000000" could take several
seconds just to get the total number of records.
This commit limits the counter in list and kanban views to 10k records,
and shows "1-80 / 10000+" if the limit is reached. If you click on
10000+, it updates with the real count (or if you go up to 10000 with
pager or input value).
The search_count on res.partner of odoo.com takes 4s. With this patch,
it will take ~20ms.
Task 2761165
closesodoo/odoo#95642
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Damien Bouvy <dbo@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>
When unselecting an export template, the list was empty
instead of just keeping the current list. I also added
some tests for this component introduced in Owl recently.
Some scss changes have been done to remove unnecessary
lines from the file and fix the style in a small window.
With a small window, items from the export list are not
draggable and the list must be placed at the bottom
part of the dialog
closesodoo/odoo#95226
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>
Problem:
Have a pivot view in some state. Toggle a favorite with a context in
which a key "pivot_row_groupby" is defined. The pivot view should be
grouped (on rows) by that pivot_row_groupby but it is not always the
case. The basic problem is that the key "pivot_row_groupby" is never
considered after the first load (see method load in pivot_model.js).
Solution:
We make the search model used by the pivot view send as groupby for the
favorite its pivot_row_groupby instead of its groupBy (which can be
different). We do something similar for the graph view that presents a
similar problem.
closesodoo/odoo#95688
Opw: 2837428
X-original-commit: ea9f66f99caaa6136912c467e5b80fe605586845
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
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>
In a grouped kanban view, drag a record to another column can modify the
record validity. In that case, the group changes should not be validated
and the drag and drop canceled.
closesodoo/odoo#95437
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In BS5 there is a check to avoid having multiple handler for one
element and we can't add two components' instance on an element.
So, before disposing a tooltip we check if there is an instance of a
tooltip and we avoid instantiation of tooltip if not already done.
e.g.:
> Bootstrap doesn't allow more than one instance per element. Bound
> instance: bs.collapse.
e.g.:
> Bootstrap doesn't allow more than one instance per element. Bound
> instance: bs.carousel.
> Bootstrap doesn't allow more than one instance per element.
> Bound instance: bs.tooltip.
Task ID: 2766483
Part-of: odoo/odoo#95450
- 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
Before this commit, a form view with an empty button box would
produce a crash, in the ButtonBox component, because it assumed to
have slots. This commit prevents this from happening as we no
longer put a ButtonBox component in the template if there's nothing
in it.
closesodoo/odoo#95427
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Problem:
Have
- a slow network
- a kanban view grouped
then move a given record from a column to another twice quickly.
An error occurs.
This is due to the way the transaction system in kanban model works:
the first move done in the first transaction being not yet finished,
no other transaction can begin and an error is thrown.
Solution:
Subclass Error and catch the specific transaction error at the
appropriate time to cancel the second order.
Note that the problem does not occur in a not grouped kanban view
because the hook useSortable prevent asking again a resequencing via
a proper management of the class o_record_draggable. That class is also
used in the grouped case but a rendering of the kanban view takes place
possibly before the end of the transaction: the record is moved in any
case to the targeted column and moved back if the overall operation
fails for some reason.
closesodoo/odoo#95235
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In an x2many sub view, the attribute "force_save" on a field
indicates that the field value must be saved, even if the field is
readonly. Before this commit, this attribute was ignored by the
new views. In the BasicRelationalModal, we only needed to propagate
this attribute to the fieldsInfo given to the BasicModel. In the
RelationalModel, we needed to take the attribute into account.
closesodoo/odoo#95396
Signed-off-by: Géry Debongnie <ged@odoo.com>
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
Before this commit
On an empty kanban having a record in quick creation, if a user manage
to give the focus somewhere inside the bottom-left zone of the control
panel (or inside the searchview input) WITHOUT closing the form of the
record in quick creation, and then press the ArrowDown key on its
keyboard, a traceback appears.
How to reproduce?
- i.e. go to "Social Marketing > Campaigns"
- change the filter to show no records
- click on create
- make the record dirty BUT invalid (no value for the Responsible field)
- click on the search input
- press arrow down
- => traceback
After this commit
The traceback is not shown anymore because the kanban renderer makes a
safer check before trying to focus a kanban card.
Part-of: odoo/odoo#94952
Before this commit
When defining a view button in some view arch, the combination of its
class attribute with a `t-attf-class` is not correctly handled.
After this commit
This is fixed.
Part-of: odoo/odoo#94952
Before this commit
The quick create form view uses the new wowl form renderer, but
with the CSS style of the legacy form view.
This led to some issues, i.e. the width of some input fields
were ridiculously small.
After this commit
The quick create form view still uses the new form renderer, but with
the proper class "o_wowl_form_view" to ensure the proper style is
applied.
Part-of: odoo/odoo#94952
Problem:
In a kanban view with progress bars, have
- a record with a false value for the progress bar field
- "muted" be the color of a progress bar field value different from false
a crash occurs.
This happens because no fallback is found for value = false in
findProgressValueFromRecord.
Solution:
Always add a bar for the value false (as it was the case before).
closesodoo/odoo#95215
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
*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>
The search model should always return [] as groupBy if searchMenuTypes
does not contain "groupBy". This allows a kanban view (for instance) to
define easily that it should not never be grouped.
closesodoo/odoo#95179
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>
Before this commit, subtemplates in kanban did not share the same
ViewCompiler instance, thus losing the aggregation of the dropdowns.
Now, a single ViewCompiler is used for each KanbanRecord, properly
taking into account dropdowns declared in subtemplates.
closesodoo/odoo#94977
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In the new Kanban view, clicking on a BooleanToggle field (on any card)
always toggles the field of the first card. We would like to toggle the
field of the card that is clicked on.
This is because the same id (fieldName) is used for all Checkbox
in the BooleanToggle. If you click on a label, its native behaviour is
to click on the input with the same id. In our case, this will always
create a click on the first ToggleBoolean (the first card).
The solution is to make the id passed to the field unique. To do this,
we will add the datapointID to it.
Before:
Card 1: id = fieldName
Card 2: id = fieldName
After
Card 1: id = fieldName_datapoint_1
Card 2: id = fieldName_datapoint_2
closesodoo/odoo#94966
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>
This commit allows multiple declarations of a dropdown menu in a kanban
card to generate a dropdown component for each definition.
Part-of: odoo/odoo#92475
In legacy kanban views, one could use JSON in the arch to, e.g.
parse text field values encoding data. This was no longer the case
in the new implementation. This commit fixes the issue by adding
it to the kanban record rendering context. However, we'll consider
adding it in owl directly.
Part-of: odoo/odoo#92475
Some attributes of the elements determining the "ellipsis" dropdown menu
of a kanban card were invalidly reported on the main Dropdown node
created during the compilation. This could cause crashes (during the
props validation) or broke the CSS.
In this commit:
- we fix the above mentioned problem
- we put the class o_drowdown_kanban on all "ellipsis" dropdowns
generated by the kanban compiler in order to get the appropriate CSS
- we make sure that those dropdowns are visible in kanban dashboards
by default
Part-of: odoo/odoo#92475
This commit removes the SimpleDialog class and adapts the
KanbanCoverImageDialog to use the Dialog component instead.
It also makes sure that the KanbanCoverImageDialog uses the FileInput
component to use a more centralized way of calling the HTTP
'upload_attachment' route.
Part-of: odoo/odoo#92475
Before this commit, in `getModifier` method when a modifier contains a
domain in a string, the domain is not evaluated and just converted into
a boolean value that is if the string is not empty then the method will
return `true` and `false` otherwise.
Also, the `applyInvisible` method does not take into account an invisible
domain in a string. That is if the `invisible` variable contains a domain
in an `Array` then the domain is evaluated otherwise the domain is
considered as a boolean value.
This commit checks if the modifier contains a boolean value as value to
evaluate it as a boolean and return it otherwise the modifier value is
returned in the `getModifier` method.
In the `applyInvisible`, this commit allows to evaluate the domain if
the domain is containing in a string.
Part-of: odoo/odoo#92475
Co-authored-by: Xavier BOL (xbo) <xbo@odoo.com>
This commit re-adds support for the kanban-tooltip template in kanban
view arch, to do this, it also refactors the tooltip service to give it
a programmatic API, so that we are not constrained to only giving
tooltip info in serialized form, but can instead give the same context
to the tooltip template as to the kanban record's template.
One current limitation is that components that are available in the
kanban record cannot be used in the tooltip, as these are mostly used
for interactive content and one cannot interact with the contents of the
tooltip, we have decided to not work around this issue until needed.
Part-of: odoo/odoo#92475
Previously, we would use t-set to add the tooltip info under the key
"info" in the rendering context, while this works fine, it was mostly
just a workaround for the lack of support in owl for passing a rendering
context to be used by the t-call directly. Since this is now supported
in owl, the commit uses this feature for the tooltips and adapts the
call sites.
Part-of: odoo/odoo#92475
When on click outside of a quick create record, one wants
- to remove the quick create record if it is not dirty
- not to remove it if it is dirty with some exceptions:
if the click is on a "Create", "Load more" or "+" (quick add) button
This fix makes the external listener of KanbanRecordQuickCreate work as
expected.
Part-of: odoo/odoo#92475
The call to web_read_group done in _loadGroups was incorrect when the first groupby
was of the form date_field:granularity (e.g. "create_date:day"). The groupby was
sent as a mesure and interpreded as such, leading to an error of the form
"Invalid aggregation function ...".
This was not detected before by lack of manual testing: the mock server used in tests
checks the read group parameters in a different way from what is done server side.
So the error was not visible in the testing environment.
In this commit, we remove the error in web_read_group and improve the mock server
(a bit) so as to make such errors be detected.
Part-of: odoo/odoo#92475
The kanban view is not supposed to be grouped by more than one groupby.
In this commit, we make sure that the param groupBy is correctly process at
the first level to only keep the first groupby (if any)
Part-of: odoo/odoo#92475
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>