Commit Graph
1383 Commits
Author SHA1 Message Date
Romain Estievenart 287136b85e [FIX] web: empty kanban view on mobile
Due to the recent refactoring in control panel 40dd12193,
some css rules have been broken in mobile.

To fix this, we need to set 'o_current' class inside the
displayed column because we need to know which one to
display in mobile.

This issue doesn't occur in desktop because all kanban columns
are displayed.

closes odoo/odoo#29457
2018-12-13 09:03:23 +00:00
svs-odoo 4abdfc35d3 [FIX] web: wait many2many tags' fetches for rendering
Before this commit, we don't assure fetch's deferreds were resolved to
return _readGroup. Thus, in some conditions, kanban was rendered before
records data was updated so many2many tags could be missing.
Now, we return _readGroup when fetch's deferreds were resolved.

Task #1910805

closes odoo/odoo#29508
2018-12-13 10:44:32 +00:00
svs-odoo 1fef5c6b6e [FIX] web: delete duplicated search_filter_menu_tests.js
closes odoo/odoo#29500
2018-12-12 16:36:06 +00:00
Swapnesh Shah d67658c043 [FIX] mail,web: link attachments & messages
The information of the active model and record was not given in the context
Records created from the Manage Messages and Manage Attachements in the debug
menu were not linked to the current records
Add context in test too

closes odoo/odoo#27766
2018-12-28 10:33:05 +00:00
Christophe Simonis 47dee16d65 [FIX] web: correct (another) forward-ported test 2018-12-12 14:35:12 +01:00
Christophe Simonis 151414f27b [FIX] web: correct forward-ported test 2018-12-12 12:21:33 +01:00
Christophe Simonis f351dd8cab [MERGE] forward port branch 12.0 up to 047e2b28de 2018-12-12 11:38:25 +01:00
Géry Debongnie 13aae100e2 [FIX] web: do not render invisible filters in search view
In some cases, the web client may receive a search view with invisible
filters.  This is due to the way field_view_get works.  For
example, if there is a group on a filter, then this will be transformed
into an invisible attribute.

In that case, the search view should simply ignore the filter and not
display it.  This was broken in the recent control panel refactoring
(note that the search view lacked the possibility of testing that kind
of situation).

closes odoo/odoo#29430
2018-12-11 13:54:26 +00:00
Christophe Simonis 069278b652 [MERGE] forward port branch saas-11.3 up to 55dafc20f6 2018-12-11 18:51:05 +01:00
Géry Debongnie c1752b8347 [FIX] web: display action menu in form/list view
The recent refactoring of the control panel moved the sidebar management
from the action manager to the view itself.  However, the sidebar
parameter was forgotten, which resulted in the fact that it was no
longer created.

This fix was a little tricky, because the sidebar needs to be
instantiated in some tests, but not in most of them (in particular, the
document application changes its behaviour, which is annoying).

closes odoo/odoo#29389
2018-12-11 12:58:49 +00:00
Martin Geubelle c70a36961f [FIX] web: correct load act_window with empty id
There was a traceback when reloading the webclient with an act_window and an
empty id in the URL (ex: after saving Settings). A `read` without id was
peformed when loading data instead of a `default_get`.

Before rev. odoo/odoo@40dd121 the action environment was generated by the
ActionManagerActWindow, which was currently defaulting the `currentId`.

Now that this is not the case anymore, the `loadState` should have this responsability.

Task 1902826

closes odoo/odoo#29411
2018-12-11 10:02:03 +00:00
40dd121938 [REF] web: move ControlPanel inside controllers/actions
This branch introduces a large-scale reorganization of the
component tree generated by the web client.  The short version is
that now, the control panel is a child of the view controller and
no longer a sibling. Graphically (and simplified), we go from
this:

                  webClient
                 /    |    \
               ...   ...  actionManager
                           /         \
                   controlPanel   viewController
                                    /       \

to this:

           	  webClient
                 /    |    \
               ...   ...  actionManager
                               |
                          viewController
                            /   |   \
          ControlPanelController
              /           \
         CPRenderer     CPModel

The motivation is that this work moves the code where it should be.
Before this commit, it was kind of weird to have code in the
controllers to render buttons outside of their root node (in
renderButtons).  Also, the action manager had to take care of
coordinating search view states between view transitions.

So, this work simplifies the code.  It also makes it easier to
extend. We see day after day that Odoo needs to take care of more
complex UI needs, and in many cases, these needs were quite
difficult to implement (we prefer spaghettis in our plates, not in
our code).  The changes in this branch should open the way to
implement these features.

For example,
- it will now be easy to add the possibility of views (for example,
  the search view or a new ControlPanel view) to add custom buttons
  (of type action or object) in the control panel.
- Another need will be to serialize/ restore the state of the
  search view across action boundaries (needed by the dashboard).
- Another example is the possibility for views to customize easily
  the presence/absence of sub menus (filters/groupbys/favorites/
  time range/...)
- Another need is an easier way for views/client action to customize
  their control panel.

This commit also contains a large rewrite of the search view (so it
is more inline with our architecture and easier to maintain).

Part of task 1893568

Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
2018-12-07 13:16:06 +00:00
ThanhDodeurOdoo 4345394e08 [REF] attachment_indexation, *: replace old references to document
*: hr_recruitment, web, website_sale_digital

This commit replaces the references to 'document' by 'attachment_indexation'
following the rename of the module.

Task #1908896
2018-12-06 19:09:34 +00:00
ThanhDodeurOdoo 20cbb6dc0b Revert "[FIX] document: JS feature disabled"
This reverts commit 1dbb555a

Bring the sidebar attachment dropdown feature back.

This feature was removed due to be considered as useless,
but since some models can have attachement without a mail_thread,
this feature is still necessary.

task: #1908896
2018-12-06 19:09:34 +00:00
Lucas Perais (lpe) f32cdb5ccf [FIX] web: exclude orderedBy when changing action
When activating a filter on a list view,
the environment of the action contained a context with an orderedBy key
which was then used by every controller and model in the various
parallel flows, i.e. changing actions

After this commit, we prevent it by excluding the key when executing an action

OPW 1913190, 1914019

closes #29190
2018-12-05 14:21:44 +01:00
Christophe Simonis d4c65a7ede [MERGE] forward port branch 11.0 up to 2156af480f 2018-12-04 17:11:57 +01:00
Christophe Monniez d9b49c8870 [FIX] web: allow string attribute on non stored fields in pivot view
Support for string attribute on fields in pivot view was added in 24f7c7ce7f
In some cases, the field is not stored and read_group method is
overridden to allow its use in a pivot view. Such a field does not
appear in the measures dict trying to set the string attribute, leading
to a client crash.

With this commit, the string attribute is set after the non stored
fields were added to the dict.

closes odoo/odoo#29393
2018-12-10 15:03:47 +00:00
Géry Debongnie 6d3ada178f [FIX] web: prevent crash when searching for escaped strings
Recent works in the search view (in 12.0) on dynamic filters had an
unfortunate effect: when the user tries to input escaped strings (for
example "test" in custom filters, there was a crash.

The reason is that the JS python parser (or more specifically, the
tokenizer) was unable to parse that as a string.  It worked before
because the web client sent the raw string to the server.  However, with
dynamic filters, this is no longer the case, and we need to parse
domains to be able to combine them.

In this commit, we modify the tokenizer to be able to work with escaped
strings.

closes odoo/odoo#29324
2018-12-06 15:16:32 +00:00
Tejas Shahu 2a4c44bb4f [FIX] web: prevent crash in line chart
Before this commit:
While user was opening first time line chart graph, at that time undefined
label values were not being converted into undefined string due to misplace
code. So it was giving traceback error

After this commit:
Code has been moved to proper place.

Joint work with msh-odoo

Issue-ID: 1882328

closes odoo/odoo#29306
2018-12-06 10:38:44 +00:00
len-odoo 24f7c7ce7f [FIX] web: add support for string and invisible attributes in pivot view
The pivot view may sum fields that are not really summable:
    unsigned values (e.g. in the case of refunds)
    values in different UOM, currencies (any different units really)
Which causes confusion when these fields are displayed.

We add support for the string and invisible attributes in the pivot view,
so that a field can be given a more informative name or hidden altogether.

opw 1909046

closes odoo/odoo#29144
2018-12-03 15:03:58 +00:00
Nans Lefebvre ddc5cc186f [FIX] web: call _applyX2ManyChange with the correct viewtype
Have a one2many display records in a kanban subview,
which opens a form view when edited.
Edit a field displayed only on the form view.
A call to _applyX2ManyChange is done without giving it the viewtype argument,
therefore the fieldinfo is taken from the wrong view, traceback ensues.

opw 1914163

closes odoo/odoo#29607
2018-12-18 14:28:55 +00:00
lul-odoo 9b6073c3ea [FIX] web: Load form subviews without previous '*_view_ref' in context
On a form view of model A, if a many2one field (model B) has a [tree|form]_view_ref in the context
(to display a custom 'Search More...' tree view dialog for example),
when clicking on this field to display the model B form view, the context key *_view_ref is passed
when loading subviews (model C) making them crash because the view ref corresponds to the model B.

After this commit, '*_view_ref' keys in the context are dropped when loading subviews

closes odoo/odoo#29022
2018-12-03 08:03:09 +00:00
mgh-odoo 6be0cdef98 [FIX] web: remove extra space in kanban dragging images
While dragging kanban record which have a cover image set, the kanban view
creates extra space, which makes it difficult to properly target a
position.

This is because of a jquery.ui issue for sortable when helper=clone is used.
In that case, then jquery.ui sortable will create a clone of current element
after hiding it. Note that jquery.ui tries to get height to current dragged
element after making it hidden(display: none) and display: none, so the element
does not return actual height and hence it gives innerHeight which considers
height of the image also and extra space is generated.

An alternative solution is to add start event in sortable option and
1) show ui.item
2) get height of the element and
3) hide ui.item, which gives proper height of the current dragged element

But removing helper=clone will also fix the issue and is not actually required.
Note that some special care had to be done to prevent the click from the
drag and drop operation to actually open the record.

Related to task: #1865788
Closes: #25734

closes odoo/odoo#29642
2018-12-19 10:28:17 +00:00
Mathieu Duckerts-Antoine 7618f84beb [FIX] web: sort pivot rows in comparison mode
Before this commit, it was not possible to sort
the rows of a pivot view while in comparison
mode. This fix makes it now possible. Note that
in comparison mode, a click on a header of type
"measure" will sort the rows according to the
column values coming from the data of interest.

closes odoo/odoo#28411
2018-12-18 12:56:06 +00:00
Géry Debongnie e062f89ed5 [FIX] web: prevent crash in some cases (o2m)
Recent works in the orm (see [1] for example) changed the behaviour of
the server in the case of onchanges: it tries to optimize Odoo by
sending a minimal diff to the web client in onchanges.

Concretely, this means that the web client receives commands 4 (link to)
instead of command 1 (update + record data). It also sends a minimal
diff in that case. This is a big issue for the web client, because it relied
on the knowledge of the data from the command 1 to be able to evaluate some
modifiers.

The good news is that we can mitigate the issue in one case: we do not
actually need to evaluate the modifiers in the case of a command 4
(comming from the server), because we can assume that the record is
valid. So, we simply bypass the check in that case.

Note that this should fix most of the problem, but a deeper problem
still remains: a crash can still happen when an onchange modifies a
record in a one2many (but in a different page), and we also have a
modifier which needs to be evaluated.

opw: #1904514

[1] https://github.com/odoo/odoo/pull/29086

closes odoo/odoo#29172

closes odoo/odoo#29086
2018-11-30 13:34:54 +00:00
Christophe Simonis efe7ca16b7 [MERGE] forward port branch 11.0 up to bb6f6c57f9 2018-11-28 17:44:46 +01:00
Géry Debongnie 25d63eee7c [FIX] web: prevent crash in some cases (o2m)
Recent works in the orm (see [1] for example) changed the behaviour of
the server in the case of onchanges: it tries to optimize Odoo by
sending a minimal diff to the web client in onchanges.

Concretely, this means that the web client receives commands 4 (link to)
instead of command 1 (update + record data). It also sends a minimal
diff in that case. This is a big issue for the web client, because it relied
on the knowledge of the data from the command 1 to be able to evaluate some
modifiers.

The good news is that we can mitigate the issue in one case: we do not
actually need to evaluate the modifiers in the case of a command 4
(comming from the server), because we can assume that the record is
valid. So, we simply bypass the check in that case.

Note that this should fix most of the problem, but a deeper problem
still remains: a crash can still happen when an onchange modifies a
record in a one2many (but in a different page), and we also have a
modifier which needs to be evaluated.

opw: #1904514

[1] https://github.com/odoo/odoo/pull/29086

closes odoo/odoo#29172
2018-11-30 08:56:29 +00:00
Christophe Simonis f5c3dafb04 [MERGE] forward port branch saas-11.3 up to c0eef42711 2018-11-29 18:38:55 +01:00
qsm-odoo 4f3635b2b1 [IMP] website, *: add event handler possibilities
* web

This commit introduces helpers for async handlers, especially for button
clicks. Those helpers are now used automatically for website widgets
(animations) if the 'async' word is placed in front of a handler name
in the `events` key definition.
2018-11-28 15:00:42 +00:00
Lucas Perais (lpe) 15bcae2dc0 [FIX] web: action manager fullscreen toggle
From a standard view with the main menu (what is called a target=current action)
open a target=fullscreen action
Then, go back to the first action, with the breadcrumbs for example

Before this commit, the original view was displayed fullscreen,
which impaired business navigation because the main menu was not there anymore

After this commit, the original view has the main menu

OPW 1906373

closes odoo/odoo#29096
2018-11-28 12:23:41 +00:00
Christophe Simonis e1f9499d26 [MERGE] forward port branch 12.0 up to 053bb45706 2018-12-05 18:46:15 +01:00
Pierre Masereel b8c4b42250 [IMP] web: state_selection widget readonly if field readonly
The current implementation of the state_selection widget always makes it
editable even if the field is readonly.

We improved this behavior by removing the handle of click on the widget
when the field is readonly, but keeping it even if the view is not in
edit mode, because it used for example in project to change state even
when view is not editable.

closes odoo/odoo#29218
2018-12-05 07:38:30 +00:00
Lucas Perais (lpe) 2e109db01b [FIX] web: context orderedBy not propagated to x2m
Have:
- Model A with a x2m to model B
- Object A with multiple objects B in x2m (that will be sorted)
- On the list view of model A, click on a column to sort by a field
- this field shall not exist in B
- open a record A (towards form view)

Before this commit, the sorting of the x2m crashed, because the key orderedBy was propagated
Due to commit e713ed2a69

After this commit, it doesn't crash

OPW 1913133

closes odoo/odoo#29094
2018-11-28 09:35:39 +00:00
Christophe Simonis b09f624f20 [MERGE] forward port branch 11.0 up to 263b388c50 2018-11-22 17:52:57 +01:00
Christophe Simonis b6e94c3e4d [FIX] web: correct test definition
Oversight of previous forward-port
2018-11-29 20:55:58 +01:00
Christophe Simonis ce4cc24621 [MERGE] forward port branch 12.0 up to 82a1e1dcc3 2018-11-29 20:06:16 +01:00
Géry Debongnie 6eb217ef79 [FIX] web: properly cleanup after notification tests
The NotificationService has a side effect: it adds a div inside
document.body. We could implement a cleanup mechanism for services, but this
seems a little overkill since services are not supposed to be destroyed anyway.

closes odoo/odoo#29099
2018-11-28 13:38:21 +00:00
Alexandre Kühn fb895f9119 [ADD] web:tests: test utils for drag/drop files
This commit adds test helper functions to drag and drop
files:

- `createFile`: create a file that can be used for drag and
  drop in tests.
- `dragoverFile`: to drag a file created from `createFile`
  over a DOM element.
- `dropFile`: to drop a file created from `createFile` on
  a DOM element.

These utility functions are available from `testUtils.file`.

Example of usage:

```js
var testUtils = require('web.test_utils');
testUtils.file.createFile({
	name: 'text.txt',
	content: 'hello, world',
	contentType: 'text/plain',
}).then(function (file) {
	testUtils.file.dragoverFile($el, file);
	testUtils.file.dropFile($el, file);
});
```
2018-11-26 11:34:00 +00:00
Christophe Simonis 7a0243ec15 [MERGE] forward port branch 12.0 up to b3052b690f 2018-11-23 12:11:32 +01:00
Christophe Simonis b4e1be8ab0 [MERGE] forward port branch saas-11.3 up to b09f624f20 2018-11-22 20:06:48 +01:00
Lucas Perais (lpe) 462681723b [FIX] web: search input date in another timezone
Put the browser in timezone Sao Paulo (Or like West of UTC)

Trigger the autocomplete (and the subsequent search) on a date field
by writing a date (in the locale format) in the search view

Before this commit, the domain sent to the server contained the date as the day
**before** the one asked for in the input

This is because, the string input is parsed and gives:
input = 12/02/2018
When creating the moment object:
> since there is no explicit time, moment will interpret it as 12am (midnight)
> We force moment to consider the string as being UTC (function: moment.utc())
> the moment contains, as output the time ** 2018-02-12T00:00:00 UTC **

When getting the facet value for making the domain
> we call toDate on the moment object, which, according to the browser is UTC and will
be converted to the locale timezone before formatting
> And the domain will use the date 2018-02-11T22:00:00 Brazil/SaoPaulo
which gives the day before the one we asked for

After this commit, this issue doesn't arise, because we don't convert the moment into a Date,
and we directly format that moment into a string

OPW 1903224

closes odoo/odoo#28689
2018-11-20 10:06:18 +00:00
Aaron Bohy 49e78f46ee [IMP] web: tests: backport of new helpers
This rev. is a partial backport of abf32b8b, so that the newly
introduced helpers are already available in 12.0.

closes odoo/odoo#28827
2018-11-20 10:17:37 +00:00
Lucas Perais (lpe) 596af12c21 [FIX] web: dateField datepicker don't propagate field options
In a form view (account.invoice), have a date field as:

    <field name="date" options="{\'datepicker\': {\'warn_future\': true}}"/>

Open a record with the field set to a value
Click Edit, click save
Click create

Before this commit, the value of the field of the new record
took the one of the previous record

On account invoices, it resulted on having the popup "The record has been modified etc...."
And it was not possible to create an invoice from another one

this was because we passed the same reference object for the datepicker

After this commit, there is no popup as the field do not take a value from the framework

OPW 1906085

closes odoo/odoo#28759
2018-11-19 15:38:22 +00:00
Lucas Perais (lpe) e713ed2a69 [FIX] web: implement filter orderedBy
related to: #28446

On a pure list view, click on a column to sort the records by that field.

Save the filter as favorite

Reload, now apply the filter

Before this commit, there were two issues:
1. The order of the list was never propagated to search view, which couldn't save
the filter with its attribute "sort"

2. There was no mechanism to load the attribute sort from a loading Filter

After this commit, those two issues are corrected
Unfortunately, complex search view flows are not testable in v11.0

OPW 1906968

closes odoo/odoo#28766
2018-11-20 13:53:52 +00:00
Nicolas Lempereur cac9173122 [FIX] web: m2o+o2m in o2m onchange no lose data
Steps:

- open a modal form view from tree view first line and make a change
- open a modal from the second line and make a change
- open the second line back: the change were lost

In a given number of conditions (a many2one inside the form view, there
is a one2many in the form view not inside the tree view, ....) this
happened because:

- when we save the first line, we get onchange data for the second one
- this onchange data can't be applied before second line is loaded, but
  it is saved so it can be applied if second line is ever opened
- when the second line is opened the saved change is applied => OK
- when the second line is opened a second time the saved change is
  applied again, possibly overwriting posterious change => BAD

With this changeset, when the record with unapplied onchange is loaded
for the first time, the unapplied onchange is applied only once.

Added test without the change failed with:

- only 1 turtle for second partner (result: 0 not 1)
- second partner turtle is Michelangelo (result: "" not "Michelangelo")

opw-1846820
closes #28644
2018-11-19 12:57:52 +00:00
Christophe Simonis 4b8bd36219 [MERGE] forward port branch saas-11.3 up to bab2a191d2 2018-11-16 15:39:02 +01:00
Aaron Bohy de924f41ee [IMP] web: testUtils: ensure backward compatibility
Rev. 7c3d5dc0 recently added new helpers to use in the tests, and
moved some existing helpers to testUtils sub groups (like .dom or
.mock).

This rev. adds a compatibility layer to ease forwardports.

closes odoo/odoo#28824
2018-11-20 10:44:24 +00:00
Christophe Simonis bab2a191d2 [FIX] web: correct forward-ported test 2018-11-16 10:21:32 +01:00
Christophe Simonis 15f686eef6 [MERGE] forward port branch 11.0 up to 468dab6748 2018-11-15 20:39:10 +01:00
Géry Debongnie 990dce6e2a [FIX] web: prevent crash in ungrouped kanban views with progressbar
The progressbar widget is not supposed to be displayed in non grouped
mode.  Before this commit, this situation resulted in a traceback. For
example, if the user has an activity on the subscription model, and
tries to open it, it will open an ungrouped kanban view.

With this commit, we check first that the kanban view is in grouped
mode, before loading the progress bar data.
2018-11-15 15:26:49 +00:00