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, modifiers containing conditions on the `id`
field weren't always correctly evaluated in form views. This
happened on new records, when the `id` field wasn't present in
the view. In this case, its value in the evalContext was
`undefined`, so a domain like `("id", "!=", "False")` was always
evaluated to true. The `id` field is handled a bit differently
than the other ones, as we do not require for the field to be
present to use it in modifiers (mostly because we don't need it
to be present to know its value).
This commit fixes the issue by forcing a `false` value for `id`
when the record has no id yet.
closesodoo/odoo#97587
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@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>
Spawn a form view with a record and set its props "mode" to readonly.
Click on "Create".
Before this commit, the new record was in readonly mode.
This is never what we want, we always want a new record to open
in edit mode.
After this commit, the new record is in edit mode.
closesodoo/odoo#97451
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Before this commit, when the kanban view is grouped by m2o field, the
columns can be resequence by doing a drag and drop on one of them. In
some cases, this resequence should be disabled to keep the order of the
columns in the kanban view. For instance, in the project sharing
feature, the views are accessible by the portal users to easily follow
the tasks in the project shared but the actions allowed to the portal
user are restricted to only one model (that is `project.task` model).
So, in that case, the order of the columns should always be the same.
To avoid doing a customization code to be able to prevent the
resequence of columns in the kanban view, this commit adds a new option
in the kanban view called `groups_draggable`. By default, this option
will be true to allow the user to resequence the kanban columns
(if the field used for the group by is a m2o and not readonly).
If the option is false then the resequence of the kanban columns will
be disabled.
task-2941335
closesodoo/odoo#97447
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, the parameter sent to the legacy fields were
different if the field was used on the form view, or on the kanban/list
view. Specifically, the attrs were not sent when the field was use on
the form view, and the viewType was not send when the field was use on
the kanban/list view.
Now, we standardize the parameters sent to the legacy fields regardless
of the view they are used on.
closesodoo/odoo#97431
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
- Less Overwhelming: reduces the hover zone to an icon. Tooltip
appearances are less intrusive as you move the mouse in the screen
- More discoverable: show an icon for the fields that have a tooltip
- better UX: max-width on the popup
closesodoo/odoo#97440
Note: commit 3363e55cac reduced help messages to useful ones.
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, in a list view with a record being edited, if you
click on the header of a column sortable and press a key then a
crash is displayed.
Solution:
We will unselect the record when we click on a column header
(sortable or not). It will be impossible to focus the header of a column
when a record is in edit mode. Either the record is in readonly mode,
or it is invalid and the invalid field is focused.
How to reproduce:
- Go to a list view
- Switch a record to edit mode
- Click on the header of an sortable column
- Press a key (for example "a")
Before:
Crash is displayed, the record is still in edition and the header
of the column is focused.
After:
When you click on the header, the record switches to readonly mode
and the header of the column is not focused.
closesodoo/odoo#97433
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Changed specialData (as in statusbar) were not discarded when clicking "Discard".
Now, when a form is Discarded, the specialData is restored.
Example: In project.task form view, there is a statusbar in which the domain depends on the project_id.
Edit a task, remove the project and the statusbar is updated. When discarding, the statusbar
is not restored to his initial state. Now it is restored to his initial state.
task_id: 2811530
closesodoo/odoo#97164
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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>
Before this commit, the edit button in form view bounced on any click.
Now, the button bounces only when clicking in the area of a field or its label.
closesodoo/odoo#96784
Signed-off-by: Aaron Bohy (aab) <aab@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, if a form view has a group containing only invisible
elements and at least one invisible group, then the view crashes.
Example:
<form>
<sheet>
<group>
<group invisible="1">
<field name="foo"/>
</group>
</group>
</sheet>
</form>
The solution is to have an empty list as the default props for the
OuterGroup slots. OuterGroup is a group containing at least one other group.
closesodoo/odoo#97295
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, an error was returned when opening a view if the
view's searchArch contained a field with a filter_domain and the view's
context contained an integer "search_default_" for that field.
Example:
<search>
<field name="m2o" filter_domain="[('m2o', 'child_of', raw_value)]"/>
</search>
context: {
search_default_m2o: 1,
}
Part-of: odoo/odoo#97295
When a ViewButton is clicked and the action fails, you would expect to
see an error dialog explaining the failure.
For example:
- go to a form view
- click on a state button which should open another view
- the new view has an issue when rendered
Result before:
We stay on the form view and nothing happens
Result after:
We stay on the form view and an error dialog is displayed.
Part-of: odoo/odoo#97295
- Purpose
Improve the UX of the "column creation" mechanism in the kanban view
so that users better understand what it is they are creating.
- Specifications
In the kanban creation mechanism, use the name of field on the model
(e.g. when grouped by stage_id in project.tasks kanban, "Add a Column"
would become "Add a Stage" because the stage_id field's name is "Stage").
task-2755570
closesodoo/odoo#95550
Signed-off-by: Laurent Stukkens (ltu) <ltu@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>
Stacked bar does not support the stacked option in the y axes.
This option was introduced in the stacked line generalization and was
set to False if the user is in the bar mode.
closesodoo/odoo#97410
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Since 48ef812a63, a warning was raised
(python side) when a grouped list is sorted by anything different from
an aggregate or the first field of the group.
Now, only the first field of the group or an aggregate fields can be
used to sort a grouped list.
closesodoo/odoo#97392
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit fixes the case where classNames set on fields
used in list views were set on the cell instead. This was
causing style issues as some classnames could modify the
display option of the cell instead of styling the field
appropriately. As the layout could break easily, it is more
safe to only apply the classnames to the root div of field
elements.
A test has been added to verify this behavior.
Part-of: odoo/odoo#96957
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>
Before this commit, when clicking on the translate button on a translatable field,
the translate dialog had too much data, among them wrong data because the domain
to fetch them was wrong. The context was also wrong.
This lead to a crash in subsequent operations (modify and save)
After this commit, the translate dialog is usable and fetches data with the right context
and domain.
closesodoo/odoo#97280
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
With the rule const preferred, let something; and assigning only once triggers an error.
let something = undefined; does the trick and is what was intended.
Part-of: odoo/odoo#97280
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>
Be in another language, edit and save a record which has translatable fields.
Before this commit, there was a crash because no changes were done on the record, making
a programming error.
After this commit, we can edit and save a record with translatable fields without changes.
closesodoo/odoo#97240
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, in a list view, if you create a new record without
modifying it and then exit the action then your new empty record will
be saved.
This causes two problems:
- you don't want to save a new empty record
- you get a "View can't be saved" error if there is a require field
The solution is to abandon new invalid records if they have not yet
been modified.
closesodoo/odoo#97169
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, it is possible to have duplicate field names in an
alert translation.
How:
- enable multi-language
- go to a form view with at least one translatable field
- edit the value of that field
- click on save (the translate alert displays the field name once)
- edit the same field a second time
- click on save
Result Before:
The translate alert displays the field name twice.
Result After:
The translate alert displays the field name once.
closesodoo/odoo#97287
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
The mock server's mockReadGroup function would not properly compute the
value, range and domain of the returned groups for date/datetime fields.
The value should be expressed in the local timezone,
and the range/domain shoulb be expressed in UTC timezone.
Consider the following:
- a record with a datetime field of value "2016-12-14 12:34:56" (expressed in UTC)
- a user with an UTC+2 timezone offset
- a read_group with groupby "['datetime:hour']"
The corresponding group would have had the following metadata:
- value: `"12:00 14 Dec"`
- domain: `[["datetime", ">=", "2022-12-14 11:00:00"], ["datetime", "<", "2022-12-14 12:00:00"]]`
- range: `{ from: "2022-12-14 11:00:00", to: "2022-12-14 12:00:00" }`
It now has the following valid metadata:
- value: `"13:00 14 Dec"`
- domain: `[["datetime", ">=", "2022-12-14 12:00:00"], ["datetime", "<", "2022-12-14 13:00:00"]]`
- range: `{ from: "2022-12-14 12:00:00", to: "2022-12-14 13:00:00" }`
closesodoo/odoo#96946
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Add stacked option on line chart.
The option already existed in Project for burndown graph, so I exported
and adapted everything concerning stacked lines from Project to Web.
closesodoo/odoo#96833
Task-id: 2929576
Signed-off-by: Simon Genin (ges@odoo) <ges@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>
Before this commit, in a ListView, the view context was not used when
creating a record.
This caused some problems:
- the record does not use "default_" to initialise its data
- server-side required fields that are not present in the arch and
have a value given in the context return server errors
closesodoo/odoo#97165
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, an error was raised when an invisible button was
found on a list view (for example, if it has a group).
Now, the invisible buttons are correctly managed.
closesodoo/odoo#96963
Signed-off-by: Aaron Bohy (aab) <aab@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, in a ListView, a field containing an invisible
attribute using an expression to be evaluated was never displayed.
Example:
<tree>
<field name="foo" invisible="context.get('notInvisible')"/>
</tree>
The foo column is never displayed.
The solution is to use the column_invisible modifier to know if the
column should be displayed or not. column_invisible contains the
evaluated expression of the invisible attribute by the server.
closesodoo/odoo#97066
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>
explicit-rank class
Before this commit, on all buttons without an explicit rank class (that
means, a button that don't have any of the following classes:
btn-primary, btn-secondary, btn-link, btn-success, btn-info,
btn-warning, btn-danger) the class on the props.defaultRank or the class
btn-secondary was applied.
Now, the class on the props.defaultRank or the class btn-secondary are
applied as following these rules:
- if there is no explicit rank class and there exists a
props.defaultRank, the class on the props.defaultRank will be
applied;
- if there is no explicit rank class and the props forceRank is set
(for instance, on the headers on the form view), the class
btn-secondary will be applied;
- if the button don't have any class, the class btn-secondary will be
applied.
closesodoo/odoo#96655
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>
Before this commit, in a kanban view, if you try to create a new record
while another one is being saved, then a crash is displayed.
To avoid this problem, when we create a new record in quickCreate mode,
we will first wait until the first one has finished saving before
creating the new one.
closesodoo/odoo#96826
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>
Before this commit in tests, when creating a view with makeView, the same env was shared for services, view and
main_components_container. This is rather wrong as bugs in prod could not be reproduced in tests.
For example: env.config was present in the env for every services and components, this is wrong as
only View must receive it in its env.
After this commit, makeView separates the env for services and top-level components from the one dedicated for View.
Part-of: odoo/odoo#96618