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>
To make cleaner code and keep a similar API than fields, the
extractProps static method is added to the the widgets.
extractProps allows making new props out of the attrs of the widget
node.
Part-of: odoo/odoo#96843
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>
This commit fixes following html block [1]
``` xml
<div class="fc-content">
<span class="fc-time">08:00</span>
<div class="o_event_title">Mitchel Admin - Administrator</div>
</div>
```
`rtlcss` lib changes `padding-right` to `padding-left`, which doesn't work if we
use `span` block next to `div` block, because position of the blocks are not
changed (time is still on the left side and title is on the right). Adding the
`ignore` directive solves the issue.
[1]: https://github.com/odoo/odoo/blob/4a996060e6b922fecb299eca32d6763dbb12b831/addons/web/static/src/legacy/xml/web_calendar.xml#L16-L17
opw-2925491
closesodoo/odoo#97129
X-original-commit: e6807b75e33ab3a083c84ace0b6c337e7566e64b
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
Fields with widget `radio` and `boolean` can't be edited
Steps to reproduce:
1. Install Discuss
2. Connect as demo and go to your preferences (top right)
3. You can't edit your notification type
Solution:
Use widgetOptions' mode along with hasReadonlyModifier to disable the
fields
Problem:
This PR https://github.com/odoo/odoo/pull/88223 modified the value of
hasReadonlyModifier which is used to disable radio and boolean fields
opw-2898464
closesodoo/odoo#97106
X-original-commit: 6befccd7c8ac22fe4da2a741efeecde2d036a7b9
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
In the context of an action, one can specify the "dialog_size" key
(only useful for actions in target="new"), which impacts the size
of the dialog. Before this commit, the corresponding bootstrap
classname wasn't applied. As a result, the dialog size was always
"large". This commit fixes that issue.
closesodoo/odoo#97085
Signed-off-by: Géry Debongnie <ged@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>
Since the migration to BS5 at [1], the feature that makes a "+" button
appear at the end of the website menu was not properly working anymore
(the "+" button appeared while there were still enough spaces for more
menus).
This is because the logic uses regexes to match ml-auto and mr-auto
classes which do not exist in BS5 anymore, as they have been replaced by
ms-auto and me-auto classes (for "start" instead of "left" and "end"
instead of "right"). This also adds the new XXL breakpoint to the regex
(to match ms-xxl-auto and me-xxl-auto classes). This also adds a comment
so that if we were to grep searching for ms-auto or me-auto classes in
the future, we will find this code.
[1]: https://github.com/odoo/odoo/commit/971e5a91aab96d36129a823e03f1f9f1b1293968closesodoo/odoo#97081
Signed-off-by: Romain Derie (rde) <rde@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>
Steps to reproduce:
- Open Settings
- Add Languages
- Select a language
- Click Add
=> Text in the "Switch to..." button is miss-aligned and color is
unreadable.
This commit fixes the alignment by removing an exception to the dialog
footer's buttons alignment selector which is no longer needed and to
avoid confusion between inner-fields and buttons container.
Also, it fixes the color by rendering the language name as a readonly
text instead of a link inside a button (sic).
closesodoo/odoo#97007
Signed-off-by: Adrien Dieudonné (adr) <adr@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>
Prior to this commit the placeholder color was different when inputs
used the `.form-control` class.
This commit fixes this color difference.
task-2823627
Part-of: odoo/odoo#92872
Steps to reproduce:
- install approvals
- in the approvals app go to filters>add custome filter> approval type
Issue:
- traceback
Cause:
- When no other module is installed, there is nothing to display under
the approval type filter. Even if the field is not required,
the javascript try to access the first element of the selection array
to auto-fill the menu.
Solution:
Add a check, if empty and not required, do not display it and leave the
field empty
opw-2895516
closesodoo/odoo#96617
X-original-commit: 7fdbb1783ec65919a709e5fcac111994d0eb3cd5
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Vranckx Florian (flvr) <flvr@odoo.com>
Co-authored-by: nle-odoo <nle@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>
The DateRangePicker on mobile has a few caveats (sic) like its
positionning which prevents the user from accessing the buttons (cf. out
of the viewport).
Steps to reproduce (on small device like iPhone 5/Moto G4):
- Open Time Off
- Click on New Time Off
- Click on From/To field
=> buttons are inaccessible
This commit fixes it restyling the daterangepicker on smaller screens to
display it as Bottom Sheet-like element (cf. popping from the bottom of
the screen and growing upto 90% of the viewport).
opw-2803227
closesodoo/odoo#97024
X-original-commit: dd2bd3c22c22c49a60ca0541f84a64c3a613971c
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
An enterprise without apps would crash on launch because of a template
web_enterprise would inherit but was only there with base_setup
installed.
closesodoo/odoo#97017
Related: odoo/enterprise#29919
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Since BS5 migration, clicking on the backdrop of a "static" modal
triggers a weird scaling-up/down effect on the modal.
Steps to reproduce:
- Open Livechat Channels
- Open a channel
- Click on operator which opens a modal
- click on backdrop
=> scale-up/down effect
This commit fixes it by disabling the scaling transform effect on
modals.
closesodoo/odoo#96958
Signed-off-by: Adrien Dieudonné (adr) <adr@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
This commit will trap the focus on the dialog, this will avoid modifying
a background record when a dialog is open. Trapping the focus on the
dialog is a well-known technique for modals (dialog).
closesodoo/odoo#96361
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, the buttons without classes in a button_box were
assigned the default btn-secondary.
Now, the default class for the buttons without classes in a button_box
is the class oe_stat_button
closesodoo/odoo#96881
Signed-off-by: Géry Debongnie <ged@odoo.com>
With the merge of the new views, we introduced an owl directive which is
t-call-context, that allows a t-call to execute in a controlled context
that is not the context of the component itself. In doing so, we forgot
that some existing templates rely on the presence of the env in the
rendering context for things like knowing if we are in debug mode or if
the device is small/mobile.
This commit fixes that by simply adding the env to the rendering context
of tooltuips.
closesodoo/odoo#96875
Signed-off-by: Géry Debongnie <ged@odoo.com>
Previously, unnecessary space was present horizontally
around the status circle. This space has been adapted
to improve the style of the widget in views.
closesodoo/odoo#96831
Signed-off-by: Simon Genin (ges@odoo) <ges@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>
Form views in dialogs should not display a control panel. Before
this commit, they did. To fix the issue, we reworked a bit how we
pass to the Layout component its "display" information (e.g.
whether it should display a control panel, and which parts of it).
Before this commit, it retrieved this info from the searchModel, in
the env. This doesn't allow a specific view to override it, for
instance the form view when it's in a dialog. To ease this, we
changed the Layout component s.t. it now takes a "display" props,
and no longer looks in the searchModel. Each view thus needs to
pass this as props.
closesodoo/odoo#96818
Related: odoo/enterprise#29857
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Previously, when the name attribute was set on a notebook in a form view
arch, we would pass that as a prop to the Notebook component, but this
prop is not supported by the component, so it would crash in debug mode
when validating the props. This commit fixes that by simply not copying
this attribute to a prop as it is useless.
closesodoo/odoo#96814
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit fixes the API of the Notebook component
that mixed props of page templates with its attributes
(isVisible, title and index). Mixing page props and
attributes was confusing. Tests have been adapted
to reflect those changes.
closesodoo/odoo#96807
Signed-off-by: Samuel Degueldre <sad@odoo.com>
A field input always asks for a record update when it is the target of
a "change" event but such an event might occur after some keyboard
events (e.g. a "Enter"). In order to make keyboard navigation work, it
is necessary to make a dirty field communicate its new value before a
change event and make sure the record is correctly updated before being
saved.
Before this commit, this was done via a system based on a special event
triggered on the model each time a record is saved but that solution was
not appropriate:
- the updates done in that way were not correctly awaited.
- they would be asked for even if the save would not be the result of
a keyboard event.
Here we replace the old system by a simpler one that works. When some
specific keyboard events occur, a dirty field ask for an update that is
correctly awaited.
closesodoo/odoo#96101
Related: odoo/enterprise#29873
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit removes most of the calls to checkValidity outside of the
(Basic)RelationalModel.
The validity checks in ListRenderer were not useful
because the operations done after them (like a switchMode) would make
a validitity check and the expected goal would be achieve in any case.
Part-of: odoo/odoo#96101
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
Previously, attempting to add a class to a button box would crash
because the button box divs are compiled to ButtonBox component which
did not accept a class prop. This commit fixes that.
closesodoo/odoo#96726
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Since odoo/odoo@2dd37982e6 , Kanban
column's width is flex based. But sadly two types of columns were not
adapted properly:
- Kanban small column didn't reduce the column width
- Quick create kanban column shrinked too much
This commit fixes both these issues by properly setting the flex-basis
size for one and disabling shrinking for the other.
closesodoo/odoo#96650
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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>
As the `color-contrast` function provided by BS5 basically fulfill the
same need as the custom `o-get-most-contrast` function and the later one
isn't used, we can safely remove the custom one.
closesodoo/odoo#96626
Note: last (and only) usage was in mrp_workorder's tablet view.
Related: odoo/enterprise#29802
Signed-off-by: Samuel Degueldre <sad@odoo.com>
This commit refactors the way we handle the "<>" case in domain
evaluation, for the sake of consistency with the "==" case. Indeed,
we tried to avoid using JSON.stringify as it could have an unwanted
behavior (e.g. it could crash, or it could have been overridden on
the value we manipulate).
closesodoo/odoo#96614
Signed-off-by: Géry Debongnie <ged@odoo.com>
Since the revamp of the Kanban View in mobile and the migration of the
Settings view to the OWL views, the jQuery.touchSwipe library is not
used anymore.
closesodoo/odoo#96608
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, the records created in grouped kanban view via
the quick create feature were displayed in the bottom of the column
where they had been created. They should be on top. This commit
fixes that issue. Note that this only concerns the state of the
kanban view before the next reload, as from that moment onwards,
the default order on the model is used.
Issue introduced by the conversion of the kanban view to owl.
closesodoo/odoo#96606
Signed-off-by: Samuel Degueldre <sad@odoo.com>
The purpose of this component was not helpfull
as it has no real use case and was only used
by the BinaryField component.
Instead of using an entire component, we only
keep the DOM that is now used directly in the
BinaryField template.
closesodoo/odoo#96357
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
In SearchModel, the calls to search_panel_select_range and
search_panel_select_multi_range were done without using the global
context (e.g. the action context), contrarily to what is done in the
legacy SearchPanelModelExtension. We fix that.
closesodoo/odoo#96458
Signed-off-by: Géry Debongnie <ged@odoo.com>
During the BS5 migration, the .text-body class wasn't properly ported.
As it is a standard Bootstrap class and useful to override component's color with the one used by the body (ie. set a heading color the same as the content).
This commit restores it.
closesodoo/odoo#96173
Signed-off-by: Pierre Paridans (app) <app@odoo.com>