This commit refactors the JS and LESS of the new mobile version
of the grouped kanban views. It ensures that the touchSwipe
library is lazy-loaded (only in mobile, when entering a kanban
view).
This commit aims to improve the UX of grouped Kanban views on
mobile devices. Only one column is now displayed, full width. The
columns' records are lazy-loaded. The user can swipe horizontally
to navigate through columns (thanks to the touchSwipe library).
Before this commit, the label was into a display block that add a return line
between the cehckbox and the label.
It was not visible in backend, because label by defaut is displayed without
renderCheckbox. (no options.text provided)
Now renderCheckbox render correctly with the same code in frontend and backend
Before this commit, and since the combination of new views + datepicker
library update, the datepicker opened at the top left of the window
when using it in a domain selector. It also could not be used at all.
This was because the current scenario occured:
1) Click on the datepicker
2) The datepicker triggers that it has changed on opening
3) The whole domain selector is rerendered
4) The datepicker computes where it should open... on basis of the
old destroyed domain selector
As the main cause of the problem here was the (2), this commit changes
the datepicker odoo widget to only notifies that it has changed when it
has really changed.
Before this commit, the web client did not properly destroy field
widgets when updating a one2many after an onchange. This is rarely an
issue, because in general, there are no other field widgets besides the
row currently in edition. However, if we specify explicitely a widget,
or if we use a custom widget, it may be a problem.
- correctly update the pager when a record is added or removed
- destroy the widgets of the removed row when the user clicks on
'Cancel' when creating a new record
- ensure that the list always contains 4 rows (before this rev.,
in list views with less than 4 records, if the user created a
new record, then clicked on 'Discard', there were only 3 rows
left
- properly destroy field widgets when removed from the DOM
Note that the change of parent.parentID to parent.static is not a
bug fix, but it's better to use the key that indicates the type of
list element, instead of implying it from other attributes.
- correctly update the pager when a record is added or removed
- destroy the widgets of the removed row when the user clicks on
'Cancel' when creating a new record
- ensure that the list always contains 4 rows (before this rev.,
in list views with less than 4 records, if the user created a
new record, then clicked on 'Discard', there were only 3 rows
left
- properly destroy field widgets when removed from the DOM
Note that the change of parent.parentID to parent.static is not a
bug fix, but it's better to use the key that indicates the type of
list element, instead of implying it from other attributes.
Go to General Settings, click on 'Change Document Template', and
in the opened dialog, click on a template.
Before this rev., it automatically closed the dialog, which was
not really convenient.
This rev. introduces a new field widget (image_selection) for
this use case, and ensures that the dialog doesn't close when
a template is selected.
Test written by @mba-odoo
In this commit, we make sure that if an onchange in a x2many modifies
another line, then the new data is properly shown. This is quite
tricky, because the field x2many ignores the full extent of the changes.
Also, we obviously want to preserve the editing state (focused field,
...)
So, what we actually do is to rerender the full x2many (minus the new
line) to make sure that we preserve the correct row order.
Note: thanks to MGE for the test and some preliminary work.
Since the rev. https://github.com/odoo/odoo/commit/2728fe1ec1ac7e99819d0f30f29a1814b00c82a4 the onchange create
command (0) send the virtual id as second argument. This argument is sent
back from the server and can then be used by the client.
As the client knows the virtual id, it can easily reuse the datapoint created
for this record and thus avoid creating a new one.
Creating a new datapoint can potentially lead to problems if the record has
for example specialData, that won't be kept.
The FieldDomain allows to open a list in a dialog to display the
records matching the current domain. In this dialog, clicking on
a record should do nothing (this was the behavior before the new
views).
Before this rev., it actually tried to open the record and it
produced a crash.
When the mockserver handles an unimplemented route, it just log an
error. This is annoying because it does not break the QUnit suite, so
if the developer does not look at the console, it will look like the
test suite pass. However, the runbot will see that as an error.
With this commit, we throw an error to force the test suite to fail in
that case.
Before this commit, there was a crash when sorting a one2many in a form view.
This is due to the fact that the event from the one2many bubbled up to
the main form view, which basically assumed that it was supposed to sort
some sub one2many.
It could be seen for example when editing a 'attribute' in a product
form view (need to activate variants), then sorting the 'attribute
values' sub one2many.
With this commit, we simply stop the event propagation at the correct
level.
The `upgrade_boolean` widget should display an `Enterprise` label next to it.
There is however an issue when a `label` is specified for this field. In this case,
the `Enterprise` label should be placed next to the field label (and not the field
itself).
The easiest solution would have been to instantiate the field widget with its label,
but this can't work because the field widget is instantiated before its label.
We thus re-render the widget after its label creation.
KanbanColumn instances are saved in an array in the renderer. The quick
create widget is always put in the first column found in this array.
Unfortunately, the array elements' order was broken after some
operations where column(s) are rerendered (like moving records).
The server postproccess the view to add attributes on many2one fields, i.e.
`can_create` and `can_write`, according to access rights.
These attributes are parsed by the client as string but should also be parsed by
the many2one when evaluating them.
The mock server has also been adapted to set these attributes.
* crm, project
Add a new feature which allows to put a progressbar in the kanban
columns. The progressbar shows with the same color the amount of
records whose value of a given field are the same in the column.
It also indicate the sum of another given field or simply the total
number of records. It also allows to subgroup the column content.
To define a progressbar, add this as a direct child of the kanban
arch:
<progressbar field="<name of the field to use for subgroups>"
colors="{<one possible value for the above field>: <success, warning or danger>, ...}"
sum="<name of the field to sum or nothing to use total number of records>"/>
Also:
- Properly update record model data's parentID when moving a record
- ...
Previous kanban header was a div with `flex-flow: row nowrap`. So if
someone tried to add some stuff in it, it will be forced to stay on
the same row as the title and config buttons. This commit wraps these
row elements in a new div to allow kanban header customization (this
prepares for the kanban progressbars).
Move a record from one column to another in a kanban grouped by a selection field
leads to a traceback.
A selection field value is composed of a tuple ('value', 'String') and the write
command must send the `value` and not the `String` as it was done before this rev.
Clicking on a cell that contains a button (but not ON the button) leads to
a traceback (see "Scrap" button in Stock Operation for example).
This is due to the fact that a button is not registered as a widget so it can't
be activated.
This commit ensures that the next line is selected if the last column is a
buttton.
With the new views, we lost a (almost unused and undocumented) feature:
the ability to instantiate custom widgets in a form view, not linked to
a particular field. For example:
<widget type="weekly_timesheet" attrs="{'readonly': [['state', 'not in', ['new', 'draft']]]}"/>
We reintroduce this feature in this commit, with a nice twist: it also
works for the list view and the kanban view.
When selecting a partner in the reconciliation widget, using the SelectCreateDialog
(Search More), the partner wasn't correctly displayed.
This was due to a difference between the change format of the many2one ; when using
the dialog, only the `id` is sent (while the `id` and `display_name` are sent when
using the many2one dropdown).
These two behaviours are now standardized and both now send `id` and `display_name`.
It has the advantage of sparing some `name_get`s called by the model because the
`display_name` was missing.
This change implies some refactoring where the SelectCreateDialog was used.
Before this commit, the xml attributes defined with 'context.get(key)' in the
subviews not inline were not evaluated correctly. This was caused
by the loss of the one context in the '_loadSubviews' method.
This commit fixes this issue and modifies the mockserver in order to be able
to use the parameter 'viewOptions.context'.
Before this commit, when an event had only a date, the event
was set to midnight.
This commit sets the event as all day event if the field used as start date
is only a date and not a datetime.
Before this rev., a traceback was raised when the user clicked on a
many2many tag in a kanban view without color field.
For instance, it was the case in the kanban view opened by clicking
on the Lead/Opportunity section of the activities icon in the
systray.
Before this rev., it was not possible to move a record (in the same column)
at the top and then move another record above it.
There is special class `o_updating` added on record being edited to avoid
moving them. This class is normally removed afterwards when re-rendering the
record.
When resequencing, the record is re-rendered so the class won't be removed ;
this is why it shouldn't be added in the first place (same behaviour as saas-15).
The server response to an `onchange` on a one2many is a list of
commands. In case of one2many update (command 1), the server
returns all fields (and not only the modified ones).
When saving the record, this is the client responsability to
specify which fields really changed.
Before this commit, all fields were sent at `write` and not only
the changed ones. This was causing issues when the user couldn't
write on the field ; an error was triggered even though the user
didn't change anything.
To fix this, we only tag as changed (in the datapoint `_changes`
attribute) the fields that have a different value after the onchange.
- datepicker doesn't default to current date by default
- date string in the input is now selected when clicking the field
- adapted the existing tests to the new changes
When a x2m field is modified, the 'save' rpc doesn't send 'False' as second
argument of the special command that manipulate the set of records.
From now on, the virtual id of the record is sent to the server as second
argument. This commit fixes the tests making the assumption that 'False'
was sent.
In an embedded editable list view with the widget `handle`, resequencing a
record and try to edit it afterwards won't work. The selected record isn't the
correct one, as if the resequencing had no impact.
To make this work, the list datapoint needs to be ordered by the field with the
widget `handle` ; if it isn't, resequencing the records won't change the x2many
data order but the list view expects the same order.
In an editable list view with the widget `handle`, resequencing a record
and try to edit it afterwards won't work. The selected record isn't the
correct one, as if the resequencing had no impact.
A small refactoring has been done to fix this because the resequence logic
was placed in the ListController (but should logically be placed in the model).
Several views are using the resequencing ; the code is thus now placed in the
BasicModel.
The list renderer state is then updated after the resequence.
The resequencing and the line edition have been placed in a common mutex to
avoid problems when the user tries to edit a record while the resequence rpc
isn't finished yet.
Before this commit, we did not really handle gracefully editing a
one2many with many records. The main issue is that if the user was not
on the last page, creating a new record added it to the last page, which
is confusing and actually a bad idea for records with required fields.
This fix requires a way to track the current changes (because we do not
display the current state of the form view: the new record is displayed
in the first page, but is actually added at the end of the dataset).
Note that this probably does not solve all issues with pagination. This
is a quite delicate problem. We will add tests and fixes as needed.