XXL Form View doesn't apply the right max-width (1320px instead of
1140px).
This is due to the precedence of the selector for `.o_xxl_form_view`
since https://github.com/odoo/odoo/pull/96627. Also this code block
applies to both legacy an new FormView instead of only the new one.
This commit fixes it by properly targetting the `.o_form_view` with the
`.o_xxl_form_view` and restores the previous behavior.
closesodoo/odoo#98686
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
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.
closesodoo/odoo#98434
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Achraf Ben Azzouz <abz@odoo.com>
This commit moves the form variables from primary_variables.scss to
the FormView folder.
Part of the overall v16 SCSS optimization/restyle, task-2704984
task-2918464
Part-of: odoo/odoo#98101
Introduce a new Dynamic Placeholder Generator
in mass mailing and SMS creation.
Using a specific character (#) in subject or via the PowerBox in body
we open a field selector popup, which can be use to select
the wanted field and enter a default value. on validation, the dynamic
placeholder will be inserted in the corresponding input/editable.
task-2154624
closesodoo/odoo#71878
Related: odoo/enterprise#30333
Related: odoo/upgrade#3766
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
If datetimepickers were used too soon after page loading, they would use
the wrong format and UI options as the code in charge of initializing
those options was not fully lazy loaded yet.
With this patch, we prevent the tempusdominus lib to consider pickers
that are in a body that is marked by the lazyloader during the lazy
loading of JS files. We could potentially not add the lib attribute
(data-toggle="datetimepicker") on those elements and let the business
code initializing the pickers add it but that would not have been a
stable fix and it may be better this way as this works generically.
opw-2944720
closesodoo/odoo#98917
X-original-commit: 7e012340d3adcd64e829a5dca34173da24d649bc
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#98603
Signed-off-by: Georis François (fge) <fge@odoo.com>
A modal using the 'ADD' and 'SAVE' buttons will have the same keyboard
shortcut for both of these buttons
Steps to reproduce:
1. Install Inventory
2. Go to Inventory > Operations > Transfers and open a transfer with a
contact and in status 'Ready'
3. Click on 'EDIT' and open the contact in the Delivery Address with the
quick edit button
4. Push on 'Alt' key: the 'ADD' and 'SAVE' buttons use the same shortcut
Solution:
Modify the current hotkey used for button 'SAVE'
opw-2954146
closesodoo/odoo#98884
X-original-commit: 0f8d28269f4900e70d7fefbb359580390656cdf7
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
- 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.
closesodoo/odoo#98874
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, in a legacy view, clicking on debug menu
"View Metadata" causes a crash.
closesodoo/odoo#98866
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
- Before this commit
On an empty m2m_tags(_avatar)_field, triggering a keydown event yields to a traceback due to an owl issue.
This will be fixed in owl later.
- After this commit
The 't-on-keydown' attribute on TagsList component has been moved into the tags themselves.
closesodoo/odoo#98840
Signed-off-by: Samuel Degueldre <sad@odoo.com>
- Before this commit
The browser autocompletion feature may conflict with
the AutoComplete component. First, the browser could
display its own autocompletion dropdown over our component's.
Secondly, selecting an item in the browser's autocompletion
dropdown simulates a keydown event with an undefined 'key' property,
leading to display traceback when the AutoComplete component
uses the keydown event (i.e. in getActiveHotkey).
- After this commit
The <input/> of our AutoComplete component now has the following attr
`autocomplete="off"`. This disables the browser's autocompletion feature
for this <input/>.
Part-of: odoo/odoo#98840
Before this commit, clicking on any part of a kanban record would
initiate a drag & drop sequence, this included its dropdown. This caused
2 issues:
- You could start to drag & drop records by dragging their still opened
dropdowns ;
- Said dropdowns would remain open when dragging their parent record.
This commit fixes both of these issues by hiding dropdowns during drag
sequences and preventing drag when clicking inside the dropdowns.
closesodoo/odoo#98791
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
This commit adds a new parameter to the 'useSortable' hook that allows
HTML elements to prevent a drag sequence. This 'ignore' param can be a
string or a function returning a string, that will be a selector
targetting the elements that need to prevent drag & drop sequences.
Part-of: odoo/odoo#98791
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.
closesodoo/odoo#97411
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
This commit introduces an object parameter to the "useAutofocus" hook,
that has 2 new optional keys:
- "refName": to override the ref "autofocus" (effectively allows to run
the hook multiple times)
- "selectAll": selects the whole value of the input/textarea (instead of
putting the cursor at the end).
Part-of: odoo/odoo#97411
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.
closesodoo/odoo#98799
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
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.
closesodoo/odoo#98823
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Previously, if you updated a legacy field widget in a new view twice in
quick succession, it may be that the first update recrates the widget,
but the second update doesn't wait for that widget to be created by the
previous update, even though the second update may rely on the widget's
$el to be defined, which can result in a crash.
This commit fixes that by making sure the widget has finished starting
before attempting to recreate it with the new params.
closesodoo/odoo#98822
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
closesodoo/odoo#98773
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
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.
closesodoo/odoo#98711
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
With the conversion of the views to owl, we added an extra div around
fields that represents the whole field, and wraps potentially multiple
elements that may be rendered by a field widget. This changes the DOM
structure, and to allow concrete fields to control everything about the
way they are displayed, we decided to use the css rule "display:
contents" for that div. As it turns out, while this does give more
control to the field widget, it breaks a lot of existing css rules, and
also prevents classes that are applied on that div from the arch from
affecting any css property related to layout (such as margin, position
or padding).
Because of that, we decided to revert this change, and set this div's
display property to inline-block (the same as legacy field widgets) and
adapt the few fields where this does not work out of the box, which
fixes many issues.
Part-of: odoo/odoo#98711
# 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.
closesodoo/odoo#98639
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
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
closesodoo/odoo#98691
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
This commit fixes a visual issue with the input element of field widgets
in editable lists: the inputs were too narrow and offset to the left.
These inputs should now take the whole width of their containing cells.
> Example view: CRM / Configuration / Tags
closesodoo/odoo#98288
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
To compute the correct size of the text field, the vertical
borders are removed and reset after the computation.
The second part was not done correctly and so the
textarea didn't have any border.
closesodoo/odoo#98284
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
This commit removes vertical padding of the dropdown
toggler used in the StateSelection field widget converted
to Owl recently. In a list, it was causing an unexpected
higher row.
closesodoo/odoo#98718
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
closesodoo/odoo#98630
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
closesodoo/odoo#98164
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
*: bus, calendar, hr_attendance, iap_mail, im_livechat, project, snailmail,
snailmail_account, survey, web, web_editor, website_livechat.
This commit is part of the websocket integration in Odoo.
This bus service now communicates with a shared worker in order to provide
a single websocket connection for multiple tabs. It is designed to
be used as a websocket except that events are slightly different,
re-connection is handled automatically. If the browser does not support shared
worker (Safari), the service fallback on a simple web worker.
Available events are:
- connect : fired upon a successful connection.
- disconnect : fired upon reception of the websocket close event.
The close code and reason are given to the listeners callback.
- reconnect : fired upon a successful re-connection.
- reconnecting : triggered when the worker starts to try reconnecting.
- notification : fired upon the reception of notifications.
Since multiple tabs are now handled by a worker, the cross_tab bus is no longer
required and has been removed.
Part-of: odoo/odoo#75510
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.
closesodoo/odoo#98602
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
- First issue
The format passed to the daterangepicker locale options could have been
wrong as the daterangepicker lib uses moment and we would pass to it
the date(time) format expressed with luxon's format tokens.
Furthermore, there was no need to pass the format to the daterangepicker
library as the DateRangeField component already handles this.
- Second issue
There was also another issue with the DateRangeField component:
When applying the daterangepicker values, the conversion between a
moment object to a luxon DateTime object was wrong because of the format
used to convert the moment object to a string.
- Explanation
The format tokens are different between luxon and moment.
- After this commit
An helper function has been introduced in order to transform a luxon format into a moment format.
The DateRangeField component now properly converts a moment object to
a luxon's DateTime object when applying the daterangepicker selection.
- Additional note
Also, the DatePicker component was locally converting the luxon's
datetime format and thus has been adapted to use the new helper.
closesodoo/odoo#98578
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
- Before this commit
Using a daterange field with an empty start/end date(time) will result in an unusable field.
The datepickers shown are set with invalid moment.js objects.
- Explanation
A formatted empty value yields an empty string.
Calling `moment("")` results in an invalid moment objet.
- After this commit
When the formatted empty value yields to a falsy value (i.e. an empty string), we call the global moment function without arguments.
Calling `moment()` results in a valid moment object representing the current date and time.
This is what we are looking for, and thus our issue is resolved.
Part-of: odoo/odoo#98578
The purpose of this commit is to enable the "group by" functionality of
many2many in graph views.
Some other views also implement it (e.g. Gannt odoo/enterprise#20192,
List and Kanban odoo/odoo#74985), it is therefore a logical step to also support group
by many2many in graph views.
Previous behavior:
It is possible to select a many2many in the group by but it has no effect in the graph.
Expected behavior with this commit:
It is possible to select a many2many in the group by and it has an impact in the graph.
task-2721035
closesodoo/odoo#98009
Related: odoo/enterprise#30272
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Before this commit, pick did not work on non-enumerable properties.
For example, getters in a class are non-enumerable properties. It was not
possible to pick the value of a getter in a Class with the pick function.
closesodoo/odoo#97558
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, when you want to modify or add a record in a
non-editable x2many, the call to get_views to receive the arch for the
FormViewDialog did not contain a context.
Problem:
The arch of the form view that is received for adding or editing a
record in a non-editable x2many is not evaluated correctly.
Cause:
An empty context is passed to the "get_views" to receive the arch
for the FormViewDialog.
Solution:
We use the context of the StaticList that represents the x2many for
the "get_views".
Part-of: odoo/odoo#97558
This commit adds the possibility to define control action buttons in the
arch of a list view for a x2many. These buttons are action buttons that
will be placed in the same place as the control create ("Add a line").
The goal of this new feature is to offer the possibility to define
buttons that execute actions linked to an x2many.
Here is an example where we define a control create and a control action
button:
<tree>
<control>
<create string="Create" context="{}" />
<button string="Action Button" name="do_something"
class="btn-link" type="object" context="{'parent_id': parent.id}"/>
</control>
<field name="display_name"/>
</tree>
Part-of: odoo/odoo#97558
Before this commit, when a ListViewHeaderButton was clicked, the view
context wasn't sent to the server.
As ListViewHeaderButton shows, the onClickViewButton API is not correct.
It expects a record in params but this is not correct in the case of
ListViewHeaderButton. So we decided not to pass a record but a getParams
callback that allows us to calculate the params when we need them.
Part-of: odoo/odoo#97558
When using the keyboard to switch records (e.g.: Leads records), we can use
keyboard shortcuts (ALT + N / P) to travel from records to records. However,
when using these shortcuts, the changes on the current record are not applied
when switch.
Step to reproduce the issue:
1. Install CRM module and activate Lead
2. Ensure that there are multiple Lead already created
3. Go on one Lead and edit its title WITHOUT clicking outside the box
4. Press ALT+N on your keyboard to switch to the next record
5. Press ALT+P to come back to the initial record
You will see that the initial record's changes have not been saved.
Solution: The issue is a racing condition. Somehow, when we use the keyboard
shortcuts, the `mutex.exec` from the `applyChanges` function (cfr. Line [1]) is
not prioritized and the `isDirty` check from `saveChanges` is executed first (
cfr. [2]). We can check this with the debugger, we stop on the `mutex.exec`
then we execute the `isDirty` then we execute the callback of the initial
mutex. The issue is that, it is the callback of the mutex that allows to set
the `_isDirty` flag to True which in return allows the `saveChanges` to
save the record as he spot some changes.
[1]: https://github.com/odoo/odoo/blob/ef789170ce2f1553b325b379aac4452e473de1e9/addons/web/static/src/legacy/js/views/basic/basic_controller.js#L281
[2]: https://github.com/odoo/odoo/blob/ef789170ce2f1553b325b379aac4452e473de1e9/addons/web/static/src/legacy/js/views/basic/basic_controller.js#L180
opw-2824986
closesodoo/odoo#96696
X-original-commit: d9ec7b4b4a9f3cc8caa4c7f5fade8ce1fb8baaea
Signed-off-by: Desausoi Laurent (lade) <lade@odoo.com>
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
The clickbot click default timeout was increased in #98495, but missed
the fact that the default was overridden for the "Settings" menu to a
lower value.
With this commit, the "Settings" exception is completely removed as the
default timeout is higher. Also, checking that the text contains
"Settings" was a bit weak.
While at it, the timeout for the global testing of an app is also
increased to 10 minutes instead of 5 as this limit is reached by the
Field Service app.
closesodoo/odoo#98617
X-original-commit: 0247e6f4abef4121b451c1373ae3c1ce184451c0
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Prior to this commit, `default_period` attribute is taking a single value.
This commit adds the support for comma separated values.
task-2941625
Part-of: odoo/odoo#97321
Previously, when evaluating a button's context from its attributes, we
would evaluate it with the record's data as context, this resulted in
x2many fields being evaluated as a datapoint (in particular, as a
StaticList). When we then went to call doAction with that context, the
action service tries to serialize that context with JSON.stringify,
which crashes as the StaticList contains circular references. This is a
mistake, as contexts and domain that are to be evaluated from a
string/attribute should be evaluated using the record's evalContext, not
its data. This commit fixes that.
closesodoo/odoo#98469
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
With the conversion of the kanban view, it was no longer possible to
validate the quick-creation of a column using enter while within the
quick-create input, this is because the hotkey service ignores hotkeys
being pressed while within an editable element by default except for the
escape key.
This commit fixes that by configuring the enter hotkey that
is registered to bypass the editable protection, and also restricts this
hotkey to only be active while focused inside the input.
closesodoo/odoo#98535
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Previously, when registering a hotkey without an area then a hotkey with
area, there would be a crash, as that latest hotkey is the candidate
winner, and we then check that there is no other matching hotkey with an
area that's more specific. In doing this, we assume all other candidates
have an area and call it as a function, but since some hotkey
registrations don't have one, we get a crash.
This commit fixes that by filtering the candidates to only those which
have an area before trying to narrow down to the most specific one.
Part-of: odoo/odoo#98535
Before this commit, when creating a record containing an invisible
x2many, the fields related to this x2many were not asked during the
creation onchange.
Problem:
Some required values were missing when igniting a new record.
Cause:
The arch related to an invisible x2many was ignored.
closesodoo/odoo#98086
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
It happens that some pages are exceeding the click timeout of ten
seconds. Notably the settings, and as the settings are linked to
different menu's, it's difficult to black-list them.
closesodoo/odoo#98525
X-original-commit: 26665a5055842a40f3beb718bd63546758f190f4
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Steps to reproduce:
- Load odoo on a mobile view
- Go to Inventory > Products > Products Variants
- Switch to the list view
- Long press a record to enter the selection mode
-> The selected records should be highlighted in blue
closesodoo/odoo#98186
Related: odoo/enterprise#30465
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>