In the reference widget, the focus was always on the input (many2one) even
though the first select (with the model) was not set.
Thanks to @kaerdsar for the original PR.
Partially closes#24070
On a pivot view expand a field in column
another one in row
Then put a domain in the search view
Save the whole thing (ir.filter) as favorite
Before this commit, the ir.filter was not saved the right way when a domain was present
(Let alone its restoration)
This was because of
- the internal default groupbys of the pivot model was not updated, and what we got in the params was overwritten
by what existed before
- a slight typo in the code made the row updated with the col values
OPW 1835865
OPW 1829925
closes#24215
In the calendar view there is some mixing of moment with:
- a local date with given timezone
- a UTC date with added timezone manually applied
The setDate function of calendar model sometimes received either of the
two types, and always transforms them to UTC date with added timezone.
This cause eg. the following issues:
- in the minicalendar, if we click on a day (eg. 12) the day highlighed
will be the one of 12th at midnight with timezone applied. So with a
negative timezone the 11th would be highlighted in the mini calendar
(but the 12th would still be the day shown).
- if we change scale (week/day/month) or open calendar or use next or
previous button: we call `setDate` with a UTC+timezone moment. So each
time this is done, we get an additional timezone
eg. when opening the calendar view on the 12th at 5:00 with GMT-0200:
-> the target date is 12th at 1:00
-> if we set the day mode: target date is 11th at 23:00
-> if we set the week mode: target date is 11th at 21:00
With this change we keep target_date and highlight_date as local date so
setDate always receives a local date and jquery-ui DatePicker gets the
date in the expected format.
opw-1831368
closes#24188
Reproduce the issue:
- open the manual reconciliation (it is a client action)
- add a reconciliation (using the + sign)
- expand it (using the > sign)
- put the focus on the first field and hit TAB
--> you would expect that the focus moves to the second field
--> what happens is: the focus stays on the first field
Before this fix, when in a client action (or any place that contains
fields) that contains fields, the keyboard navigation did not occur
correctly because the default behavior of the TAB key was prevented.
After this fix, if the navigation_move event was not stopped, we allow
the default behavior of the TAB key.
In the form view, a new problem appeared since we introduced the extra device
size_class: the buttonbox was folded for large screens, even if there is
only two buttons.
The reason is that the form renderer code used a list to map size class
numbers to the number of buttons allowed to be displayed. With the
extra size class, this number was undefined, which caused an issue.
In the form view, a new problem appeared since we introduced the extra device
size_class: the buttonbox was folded for large screens, even if there is
only two buttons.
The reason is that the form renderer code used a list to map size class
numbers to the number of buttons allowed to be displayed. With the
extra size class, this number was undefined, which caused an issue.
Revision on https://github.com/odoo/odoo/commit/32b8cec5361174c92c45a4975d4e02f1fb448aa2
Before this commit, when we switch channels in the Discuss app, the breadcrumb
was visually not updated: it keeps the name of the first opened channel.
With this commit, the breadcrumb is updated on each change of channel, so that
it displays the name of the currently opened channel.
Technical details:
This is due to a change of logic of updating the GUI of the breadcrumb:
before the refactoring above, discuss had to pass the content of the
breadcrumb to the control panel, in order to update the breadcrumb visually.
After the refactoring, the action manager should warn the control panel to
update the breadcrumb on any change of the title. This is already the case
for `ir.actions.act_window`, but not for all types of client actions.
When Odoo display a phone number number, on phone or if VOIP is
installed a invisible `­` character was added from 9.0 up to
saas-11.2 so an applications such as skype would not be concerned with
the number.
But if someone copy-pasted from this to somewhere else in Odoo, we would
get incorrect number with this invisible caracter. So this change make a
special case for the "FieldPhone" so the character is removed from data
saved.
opw-1834858
closes#24223
Before this rev., a crash occured when a default_get returned a
command 0 (CREATE) for a one2many, with a value for a date(time)
field (e.g. [0, false, {some_date_field: '2018-12-08'}]). This
was because the related values (inside the commands) weren't
parsed. This only impacted date and datetime fields, for which the
parsing converts the string into a moment instance.
Fixes#23672
Have the create_date field displays on a one2many list
Try to add a record onto the list
Before this commit, when the virtual record is added onto the list
it crashes because the datetime field is undefined and cannot be parsed
After this commit, It doesn't crash though the value would have to wait the save on the main record
to be updated (because it is the create_date)
OPW 1834250
closes#24097
Here is the issue that initiated this work: the bank reconciliation tour
sometimes failed in community. The reason was that the discuss client
action seemed to be loaded after the tour started, and interfered with
the second step of the tour.
What happened exactly was the following:
- web client is loaded
- initial action is starting (but not complete) (this is discuss)
- tour manager is loaded and starts the reconciliation tour
- the reconciliation tour changes the url to trigger an hash change
- the web client calls loadState on the action manager
- the action manager perform a doAction with the tour url
- the discuss client action is now ready, and replace the reconciliation
action
- the tour is broken.
The underlying cause is really a generic problem: the action manager
does not add the client action starting process in its 'dropprevious'
concurrency primitive. This is probably not really an issue for the
act_window actions, since they have custom loading code that make sure
the loading process is put in the drop previous, but it is definitely a
problem for all client actions.
The solution is quite simple, and should also protect the act window
renderers: put the action controller in the drop previous
Whenever a widget is destroyed, it should be as inactive as possible.
Before this commit, it could happen that a widget was destroyed after
the willstart method, but before the start method. In that case, bad
things could happen.
For example, the discuss client action tries to look up some information
into the session, with the getSession method. This causes a crash
whenever the widget is destroyed.
With this commit, we introduce a new 'fail fast' feature to our qunit
test suite: when it is activated, the qunit test suite will immediately
stop after the first failed test.
It is accessible as a flag in the url (failfast), or by clicking the
checkbox in the UI. It is currently not activated by default.
Note that this commit also change the url for the runbot phantomjs test
in order to activate this feature. This allows us to increase the global
timeout for the js test suite without fear!
Whenever a widget is destroyed, it should be as inactive as possible.
Before this commit, it could happen that a widget was destroyed after
the willstart method, but before the start method. In that case, bad
things could happen.
For example, the discuss client action tries to look up some information
into the session, with the getSession method. This causes a crash
whenever the widget is destroyed.
With this commit, we introduce a new 'fail fast' feature to our qunit
test suite: when it is activated, the qunit test suite will immediately
stop after the first failed test.
It is accessible as a flag in the url (failfast), or by clicking the
checkbox in the UI. It is currently not activated by default.
Note that this commit also change the url for the runbot phantomjs test
in order to activate this feature. This allows us to increase the global
timeout for the js test suite without fear!
Here is the issue that initiated this work: the bank reconciliation tour
sometimes failed in community. The reason was that the discuss client
action seemed to be loaded after the tour started, and interfered with
the second step of the tour.
What happened exactly was the following:
- web client is loaded
- initial action is starting (but not complete) (this is discuss)
- tour manager is loaded and starts the reconciliation tour
- the reconciliation tour changes the url to trigger an hash change
- the web client calls loadState on the action manager
- the action manager perform a doAction with the tour url
- the discuss client action is now ready, and replace the reconciliation
action
- the tour is broken.
The underlying cause is really a generic problem: the action manager
does not add the client action starting process in its 'dropprevious'
concurrency primitive. This is probably not really an issue for the
act_window actions, since they have custom loading code that make sure
the loading process is put in the drop previous, but it is definitely a
problem for all client actions.
The solution is quite simple, and should also protect the act window
renderers: put the action controller in the drop previous
Whenever a widget is destroyed, it should be as inactive as possible.
Before this commit, it could happen that a widget was destroyed after
the willstart method, but before the start method. In that case, bad
things could happen.
For example, the discuss client action tries to look up some information
into the session, with the getSession method. This causes a crash
whenever the widget is destroyed.
With this commit, we introduce a new 'fail fast' feature to our qunit
test suite: when it is activated, the qunit test suite will immediately
stop after the first failed test.
It is accessible as a flag in the url (failfast), or by clicking the
checkbox in the UI. It is currently not activated by default.
Note that this commit also change the url for the runbot phantomjs test
in order to activate this feature. This allows us to increase the global
timeout for the js test suite without fear!
Here is the issue that initiated this work: the bank reconciliation tour
sometimes failed in community. The reason was that the discuss client
action seemed to be loaded after the tour started, and interfered with
the second step of the tour.
What happened exactly was the following:
- web client is loaded
- initial action is starting (but not complete) (this is discuss)
- tour manager is loaded and starts the reconciliation tour
- the reconciliation tour changes the url to trigger an hash change
- the web client calls loadState on the action manager
- the action manager perform a doAction with the tour url
- the discuss client action is now ready, and replace the reconciliation
action
- the tour is broken.
The underlying cause is really a generic problem: the action manager
does not add the client action starting process in its 'dropprevious'
concurrency primitive. This is probably not really an issue for the
act_window actions, since they have custom loading code that make sure
the loading process is put in the drop previous, but it is definitely a
problem for all client actions.
The solution is quite simple, and should also protect the act window
renderers: put the action controller in the drop previous
Before this fix, when navigating with LEFT and RIGHT keys on a grouped
kanban view, if there were empty columns in the direction of the
navigation, the focus did not change to the next column.
After this fix, the navigation left and right ignore empty columns and
jump to the first non-empty column.
Consider the following scenario involving a one2many list (non
editable) inside a form view:
- click on 'Add an item', a model opens,
- fill the fields and click on 'Save & Close',
- reopen the freshly created record,
- maybe make some changes (this is optional, but makes sense),
- click on 'Save & New',
- fill the fields and click on 'Save & Close',
-> the second created record isn't added to the list.
The problem comes from the fact that when the dialog is opened for
the second time (in this case by clicking on a record), the 'save'
handler registers an 'UPDATE' command. While this is correct for
the 'Save & New' click (as we update an existing record), this
isn't for the second record which doesn't exist yet, and thus
requires an 'ADD' command.
This rev. ensures that the two cases are handled in the 'save'
handler given to the dialog.
OPW 1829723
In a kanban grouped by many2one with a progressbar, after emptying a column
by moving all records, the column wasn't correctly updated. This was causing,
in the best case, a record duplication or, in the worst case, a traceback.
This issue comes from the fact that, with a progressbar, a read_group is
performed each time a record is moved. When the group (column) becomes empty,
the read_group won't return this group even though the group still appears in
the kankan. When moving back the record in this empty column, there is a
desynchronization between the kanban controller data and the model.
To fix this issue, an option `keepEmptyGroups` is passed when performing the
mentioned read_group ; this mimics the kanban display that keeps empty groups
displayed and there is no desync anymore.
Fixes#23982
To reproduce the error, go to Accounting > Import Statement, then
Cancel. An error occurs because `belongs_to_company` is not in the data.
Indeed, it is directly set on the action
`open_account_journal_dashboard_kanban`.
Commit 9961bbf4eb re-evaluates if a record should be displayed in the
Kanban view after applying an action (in particular, archive a record).
However, the domain evaluated might contain values which are not in the
data. This is for example the case if there is a domain on an action.
Fixes#24142
opw-1835216
opw-1835123
With this commit, the menu item for editing a view in debug mode has been
changed.
Instead of "Edit List View", it is now "Edit View: List".
That way, the code is shorter, generic, and translatable.
Exception to above changes: search view, which is unchanged
(it remains "Edit Searchview")
With this commit, the fields many2one are not always measures in pivot
and graph views. By default, they are *not* measures.
In order to have them as measures, we should pass `additionalMeasures`
as a param to any of the views, which contains a list of fields to consider
as measures.
example:
Suppose a model with the following fields:
- `product_id` (many2one)
- `categ_id` (many2one)
- `sold` (float)
By default, only the field `sold` is a measure
in a graph or pivot view.
In order to pass `product_id` as a measure of
a graph view, you should instantiate this view
as follow:
``
var viewInfo = /* ... */;
var params = {
additionalMeasures = ['product_id'],
};
var graph = new GraphView(viewInfo, params);
``
An exception to the rule above is when the many2one field is of type `measure`
in the arch: this field is set as the default measure of the view, therefore
it is implicitly added as an additional measure.
We recently added the possibility of aggregating the graph view on a
many2one field (with count distinct operator). This is useful, but then
a rare situation could happen: the view could be grouped by the same
field.
In that case, there is a name clash in the read_group, and the result
will be that the [id, nameget] of a m2o field will be used as an
aggregate.
The readgroup method should be improved (its API is a mess), but
meanwhile, we have a solution for this issue: if we group by a m2o, then
it is guaranteed that each group has an aggregate value of 1 for the
same field.
With this commit, we add the possibility of using many2ones as measure.
The way a many2one is aggregated is by using the count distinct
operator.
Some care had to be done to gracefully support the situation when a
pivot view is grouped by a m2o field F, and the same field F is used as
a measure.
1. Added the ability to navigate within the kanban view using UP,
DOWN, LEFT and RIGHT keys.
2. By defaults, the focus should be set on the search input field.
3. From the search input field, using the DOWN key, the focus goes
to the first card of the kanban
4. From the search input field, using TAB key, the focus goes to the
create button
5. From the create/import buttons, using TAB or DOWN key goes to the
first card of the kanban, then UP and DOWN keys moves the focus
from card to card in the same column or if it is not a grouped
view from left to right.
6. In grouped view, LEFT and RIGHT keys moves the focus to the next
column
7. When on a card, hitting ENTER opens the view of that card.
Not included in this commit
1. Memorize the position on the kanban when opening an card, than restoring
when going back to that kanban
The goal of this commit is to allow fast entry of the same model using
the keyboard for navigating through the form once, by blocking the user
from advancing in the form if there is a required field or once they
went through the form once to get them to a primary action (button)
This commit includes the following changes
1) Enable moving forward from field to field using the TAB key
2) Entering the one to many and many to many using the TAB key
a. When entering it, set the focus on the "add new line" link or
button
b. When adding a new line, set the focus on the field visible
editable field of the new line
c. Discard adding a new line with ESC key
d. If the user leaves the first field empty and uses TAB, we
will cancel the adding of a new line and move to the next
field of the form
3) When a field is required and not filled in, do not allow the user
to move out of the field using the TAB key (the user is still
allowed to use the mouse though), mark the field as invalid
instead
4) After going though the form once, using the TAB key on the last
field will move the focus to the first primary button of the page
5) When the focus is on a primary button (EDIT/SAVE), the user cannot
move the focus forward using the TAB key. Hitting TAB again will
display a tooltip telling to hit ENTER to activate the button.
The mouse is still available to move the focus.
6) When the user saves, the focus is placed on the first primary
button of the form renderer (like VALIDATE for a new invoice)
7) On dialogs, primary buttons should stop the users from moving out
of them, and showing a popup if the user tries
8) When closing a dialog, the focus will be moved back to the widget
that opened it.
This commit does not include the following features
1) Navigation with the keyboard on a selection one to man
2) Navigate between tabs in a form using the keyboard
3) Cancelling the adding of a new line in a many to many using the
ESC key do not set the focus correctly
4) Enhancing the focusses fields (like blue underline)
When a user click on an action button, we need to check if the record
match with the domain to remove it from the view if this action change
the record value.
Special case: we filter by active field equal true, if the active field
is available in the data (field present in the kanban view).
opw-1832879
Co-authored-by: Nicolas Martinelli <nim@odoo.com>
Before this commit, when some records were created from an `onchange`,
we have the following weird behaviour:
Suppose that this record has some required fields that are empty.
When we click on this record, then somewhere else, the record
disappears from the list.
This is because the records contains invalid fields, and it is wrongfully
assuming that the record to be discarded comes from "Add an item".
A previous commit [1] fixed a bit this issue with `default_get`, but since
it relied on a fragile heuristic, we decide to apply the correct fix with
this commit.
[1] https://github.com/odoo/odoo/commit/b09f0c99be2b13d33986414485556d87da186d65
The read_group method was recently modified to allow more flexibility.
With this commit, we add the possibility of aggregating many2one fields.
These fields can be aggregating by counting the number of distinct IDs,
directly in postgres.
Also, note that we had to modify the mock server to implement the
corresponding functionality.
For x2many relational fields(of type kanban), we shoud be able to set custom label for
'Create / Add' button by adding 'create_text' node option on particual field from xml.
Right now, 'create_text' is only handled for many2many fields, preventing users to set
custom label for one2many fields.
This commit allows users to set Create Button label for both m2m and o2m fields.
The read_group method (from the server) is implemented in the mock
server, to allow easy unit testing in javascript. However, the
behaviour was not exactly the same: a read_group call on a domain with
no records returns null for aggregates. But the mock implementation
returned a value of 0.
We fix this in this commit, to allow more precise testing of Odoo
javascript.
- Create a vendor bill, save and validate
- Duplicate the bill, save
- Click on "Create"
A customer invoice is created, while the user expects a vendor bill.
After duplication, the new record is loaded but the context is lost.
Since the default value for the invoice type is based on the context key
`type`, a loss of context leads to an incorrect invoice type.
opw-1826453
Co-authored-by: Géry Debongnie <ged@odoo.com>
Before this commit, some breaking spaces were present in the js code.
Such spaces are misinterpreted and worked by luck.
This has become a problem with exported js bunldes (e.g. the
external_lib bundle in im_livechat).
This commit replaces breaking spaces by regular spaces.
This rev. introduces an option to doAction (keepSearchView). If set
to true, the searchView of the current action will be kept and used
by the new action (this only works if there is already an action
with a searchView, and if the new action is stacked over that one).
This is necessary for the new dashboard view.
A better solution would have been to export the state of the
existing searchView, and import it to the new one, but the current
implementation of the searchView doesn't allow to do that easily.
This will be done as soon as the searchView will be rewrote.
Steps to reproduce the issue in 11.0 Enterprise:
- Go to the language English
- Remove from the time format the seconds
- Refresh the page
- Go to sales
- Create a sales order;
Bug:
- You get the warning message
closes#23596closes#22027
opw:1829577
Size attributes (e.g. `max-width`) are sometimes set in css (i.e. with classes,
see `oe_avatar`).
They must however be overriden if they are specified on the widget.
Example:
<field name="image" widget="image" class="oe_avatar" options="{'size': [180, 180]}"/>
The `max-width: 90px` set on oe_avatar must be overriden in this case.
Note that the attribute `img_width` and `img_height` have been depreciated as
`width` and `height` are fulfilling the exact same purpose.