Commit Graph
8581 Commits
Author SHA1 Message Date
Géry Debongnie aaea6fd088 [FIX] web: small performance fix in calendar view
In some cases, the calendar view sends a trivial domain, such as
["partner_id", "not in", []]

This is clearly not really useful, and it could hurt performances in
some cases (for example, if the partner_id field is a related on a large
table, and non stored).

This is clearly not a complete fix, but it is easy, safe and does not
hurt.
2018-05-30 11:47:06 +02:00
Christophe Simonis a2f275dfc4 [MERGE] forward port branch 11.0 up to 4ea3838d89 2018-05-29 20:00:31 +02:00
Lucas Perais (lpe) 94a7bef5db [FIX] web: domain evaluation in parented m2o in o2m list
Model A has a o2m to model B
Model B has a m2o parent_id on B

In A's form, add a B item,
then in the m2o, create record
Save and New
Click on the m2o

Before this commit, the python crashed on name_search.
This was because we sent the virtual ids to it

After this commit, there is no crash

OPW 1850212
closes #24948
2018-05-29 13:44:23 +02:00
Lucas Perais (lpe) 9654f6b8e0 [FIX] web: o2m editable decorated, paged, ordered supports adds/cancel
Have a decorated (conditional on field) editable list, with a default_order.
Have more records than the pager allows.

Add an item, and hit escape to cancel addition.

Before this commit, the cancellation crashed because the first record on the other page
was trying to evaluate the decoration for its row, which is wrong in the first place.
This was because creating a record increases the limit of the list, to be able to see the record
being created.
At cancellation though, that limit was never decreased.

After this commit, the whole flow happens without problem.

OPW 1844495
closes #24682
2018-05-28 17:25:51 +02:00
Aaron Bohy 5aa0e0bc24 [FIX] web: Controller: concurrent control panel updates
Let's assume the following scenario: in a kanban view with a
domain, remove that domain and quickly click on a record to open it
in form view. On a slow network, it may happen that the reload of
the kanban view (triggered by the domain change) returns after the
load of the form view.

Before this rev., when this happened, the form view was correctly
displayed but the control panel contained the buttons, searchview,
pager... of the kanban view.

Note that this fix is quite ugly, but it won't be necessary anymore
as soon as the control panel won't be shared between actions and
controllers, i.e. as soon as each controller will have its own
control panel.
2018-05-28 07:24:16 +02:00
Christophe Simonis 58e3552246 [MERGE] forward port branch 11.0 up to 2ca7296000 2018-05-25 11:50:02 +02:00
Aaron Bohy 04ba755f82 [FIX] web: AbstractController: handle concurrent reloads
Let's assume the following scenario in a Kanban view with a default
filter. The user removes the filter, and quickly adds a new one.
On a slow network, it may happen that the second reload request
returns before the first one. On odoo.com, this is easy to
reproduce on the tasks Kanban view.

Before this rev., when this occured, the result of the first
request was displayed, whereas it should have been ignored as
another request was done later on.
2018-05-25 08:11:49 +02:00
Christophe Simonis 2bc6ea1b37 [MERGE] forward port branch 11.0 up to 02ee3fd88e 2018-05-23 19:33:40 +02:00
Alexandre Kühn 8dbebe0242 [FIX] web: fetch name_gets on list only when there are data
Revision on 8ac98fc78a

The commit above does not check whether the list contains data or not.
As a result, if there are no data in the list, there is no reason to
fetch `name_gets`.

In fact, there could be a traceback because some parameters of this rpc
are computed from data in the list. So if there are no data in the list,
the parameters of the rpc are undefined. This was the case for a test
in enterprise.
2018-05-23 09:43:12 +02:00
Alexandre Kühn c587c0029b [FIX] web: only abandon records on discard without savepoint
Revision on https://github.com/odoo/odoo/commit/9a9da5763b38a3bce54e9c4870af0032e38cacc3

The intent of the commit above was to no abandon records in a list on
discard when these records have been created from a `default_get`.

Also, the `default_get` may also perform an `onchange` that could create
more records. The records from this `onchange` must also be included in
the "do not abandon" rule.

However, the rule was too relax, so that any following `onchanges` from
a user interaction was also considered into this rule. As a result, it was
not possible to abandon such records.

With this fix, we restrict the rule to `default_get` (already the case) and
only the `onchange` right after a `default_get`. Any record created on an
`onchange` from a user interaction after a `default_get` should be abandoned
on discard.

Representation of creating the list:

                               savepoint
   |----------|-----------|-------||--------|------->
 create   default_get  onchange1         onchange2

record in the list is created by default_get or onchange1
    => do not abandon on discard
record in the list is created by onchange2
    => abandon on discard
2018-05-23 09:43:12 +02:00
Christophe Simonis 8383181b8f [MERGE] forward port branch saas-15 up to 021d0e6a98 2018-05-18 18:59:06 +02:00
Christophe Simonis 021d0e6a98 [MERGE] forward port branch saas-14 up to cabe0951af 2018-05-18 18:54:26 +02:00
Christophe Simonis cabe0951af [MERGE] forward port branch 10.0 up to 9001a75f23 2018-05-18 18:53:56 +02:00
Alexandre Kühn 8ac98fc78a [FIX] web: show names of many2one on default_get
Before this commit, some records in a list did not show the name of their
many2one fields.

This case occurs when the records in the list are created from a default_get,
and the records do not fit in a single page. In that case, the records in the
first page correctly display the names of their many2one fields, but not the
records in the other pages.

Fixes #24547
2018-05-18 17:30:34 +02:00
Alexandre Kühn 6f7031e9fb [FIX] web: pass unique ids on name_get rpc
Before this commit, when a list contains records with many2one fields that
contain the same values, duplicate ids were passed to the server on rpc
`name_get`.

For instance, if 40 records in a list refer to a Unit of Measure with id "1"
whose displayed_name is "unit(s)", the server receives a long list of ids with
simply the value "1". Also, the server responds with a list of displayed_name,
in this case a list of 40 strings "unit(s)".

With this commit, we always pass unique ids to the server on rpc `name_get`.
2018-05-18 17:30:34 +02:00
Lucas Perais (lpe) abda3464ed [FIX] web: get_file handles arbitrary AND serialized exceptions
Commit bcd4c90 was intendend to make get_file handle uncaught/unserialized exceptions
in the context of a http request

The drawback is that when get_file received a serialized exception (route: /report/download)
the JS modal was empty in that case

This commit handles both the cases

OPW 1848606
closes #24794
2018-05-18 13:03:31 +02:00
Christophe Simonis 1655202924 [MERGE] forward port branch 11.0 up to 59a8a1cd8e 2018-05-17 13:19:49 +02:00
Xavier ALT c22d3f6732 [FIX] web: widget char_domain should pass context to selection dialog
In case we define a field like,

<field name="my_domain" widget="char_domain" context="{'active_test': False}"/>

when selecting records the dialog should display all records (as asked by the
context), but it's not the case.

This commit ensure the field context is passed to the selection dialog.

opw-1831902
2018-05-16 14:18:17 +02:00
len-odoo 25548eb7e9 [FIX] web: sort relational fields by their names
When sorting records according to a many2one field in a list view
embedded in a form view, the js would sort according to their ids,
in a seemingly arbitrary order.
Thus sorting records according to a field with values in ("a", "b", "c")
could be sorted as "a", "a", "c", "b" instead of "a", "a", "b", "c".
We make the comparison on the name of the field instead.

opw 1838860
2018-05-16 08:04:53 +02:00
Christophe Simonis 013ce7f889 [MERGE] forward port branch 11.0 up to f2e105eeca 2018-05-08 19:08:18 +02:00
Mohammed Shekha 2bd92cc581 [FIX] web: use correct href in link for m2o
With a better href, many2one in readonly mode  can be opened in new tab.

Related to task: #32919
2018-05-08 14:46:17 +02:00
Aaron Bohy 013baed413 [FIX] web: navigate through records in Kanban with progressbar
Recently, rev. c0809dd41 removed a protection in the reload of
Kanban views with progressbars. This protection ensured that the
manual reload of the progressbars was only done when one of the
records of the Kanban view was updated (and not when a column, or
the whole view was).

However, removing it highlighted a bug linked to the manual reload
of progressbars, which messed up the list of ids in the
environment. As a consequence, for instance, if the user archived
the records of a column, and then opendc a record in form view,
it couldn't use the pager anymore.

Besides fixing this bug, this rev. re-introduces the protection,
and refines it to prevent 2 useless RPCs when the whole Kanban
view was reloaded.

opw~1841276
opw~1841342
2018-05-08 08:39:23 +02:00
Christophe Simonis 89819c6f42 [MERGE] forward port branch saas-14 up to 1f74b878f4 2018-05-07 12:21:05 +02:00
Christophe Simonis 1f74b878f4 [MERGE] forward port branch 10.0 up to 0aeb92ccbc 2018-05-07 11:54:15 +02:00
Alexandre KühnandNick Booker c3ce712359 [FIX] web: correctly display filename when uploading a file
Before this commit, we had the following issue with binary widget in a form:

Suppose we have a binary field with filename attribute set. When uploading a
new file 'temp.txt' with content 'Cg==', the displayed value is 'Cg=='. When
the changes are saved, the displayed value becomes 'temp.txt'.

It should always display 'temp.txt', which is what is fixed by this commit.

In addition to fixing this issue, we describe what is the expected displayed
value of a binary field. This is based on whether the attribute filename is
provided, and whether the record is in edit or read-only mode.

Fixes #21630
Closes #24275

Co-authored-by: Nick Booker <nick.booker@opusvl.com>
2018-05-04 17:10:29 +02:00
Christophe Simonis ac63dfc8f4 [MERGE] forward port branch 11.0 up to 8dade01e2c 2018-05-04 16:10:50 +02:00
Christophe Simonis 333a58e4ef [MERGE] forward port branch saas-14 up to 4e90a676da 2018-05-04 14:19:53 +02:00
Christophe Simonis 4e90a676da [MERGE] forward port branch 10.0 up to 4b7f4f32ea 2018-05-04 13:19:12 +02:00
Aaron Bohy 6e15a9cd24 [FIX] web: one2many form view with action button
Assume a one2many field inside a form, displaying field A in its
list view, and a field B in its (dialog) form view. Moreover, there
is an action button in the dialog, which updates the value of B.

Before this rev., B wasn't correctly reloaded when the button was
clicked, because the BasicModel reloaded the fields on the list
view (i.e. field A), whereas it should reload the fields in both
views.

This fix is twofold. First, we force the viewType to 'form' when
the record is reloaded, instead of the default ('list'), so that
fields in the form view are correctly reloaded. Second, when we
open the form view in the dialog, we add the fields of the list
view to the dict of fields of the form view, so that the form
is aware of those fields and can ask the model to reload them
(still without displaying them).

Fixes #24189
2018-05-04 10:42:05 +02:00
Christophe Simonis 4b7f4f32ea [MERGE] forward port branch 9.0 up to f12daec1a1 2018-05-03 16:25:17 +02:00
Christophe Simonis ad802d0d55 [MERGE] forward port branch 11.0 up to c591e0de7d 2018-05-03 11:21:42 +02:00
Nicolas Lempereur f12daec1a1 [FIX] web: don't change page before saving
When we edit a list view and change page before the change has been
savec, the saving and page changing will be done concurrently thus
possibly causing an error if the page is changed before the saved is
finished: the save will try to modify the page that is no more
displayed.

In this change, the list view editable wait for the saving to be
finished before reloading its content.

note: for 9.0 up to saas-15

opw-1839149
closes #24471
2018-05-03 09:11:44 +02:00
Nicolas Martinelli f536592691 [FIX] web: inline views should share their fields
This causes issues (already 3, and counting...)

This reverts commit 27c9f838d3.

opw-1840984
opw-1841041
opw-1841000
2018-05-03 08:30:55 +02:00
Christophe Simonis 87e21ccdc5 [MERGE] forward port branch 11.0 up to 521414b1c1 2018-05-02 19:36:16 +02:00
Christophe Simonis 320b631c81 [MERGE] forward port branch saas-15 up to 810603f4ef 2018-05-02 15:34:42 +02:00
Christophe Simonis 810603f4ef [MERGE] forward port branch saas-14 up to 55ce6aff10 2018-05-02 14:49:58 +02:00
Christophe Simonis 55ce6aff10 [MERGE] forward port branch 10.0 up to 79bbd1dcb8 2018-05-02 13:52:12 +02:00
Lucas Perais (lpe) 27c9f838d3 [FIX] web: inline views should share their fields
Have a One2Many
The views of that o2m define two inline views: the list and the form

in the list view, put a field that isn't in the form and used in a domain
Try to add an item to the list
The form pops up

Fill in the data and save & close

Before this commit:
It crashed when evaluating the domain on a field using the field that is not in the form

After this commit:
Subviews share their fields in a special object on the parent record
In our case, the form view checks in that shared resource if the fields it is supposed to initialize
are there.
Hence, this flow doesn't crash anymore

OPW 1837511
closes #24350
2018-05-02 11:09:50 +02:00
Géry Debongnie e0424b9603 [FIX] web: fix form_view_id attribute in calendar view.
The way the calendar view selected its form view was broken for two
reasons:

- any value given in the form_view_id attribute was kept as string,
  which means that the string value would be sent to the server, and
  this is not good.
- if no value was set, the calendar view then simply did a do_action
  with the form view id set to false, which means that the default form
  view is used.  This is mostly ok, except when we are in the context of
  an action with a form view which is not the default one.  In that
  case, we clearly prefer the form view from the action.

For example, before this commit, the form view in the timesheet
application (community) is not the same as the default form view on
account.analytic.line.

Note that this commit also adds a small tweak to the mock server to
better simulate errors like the web client does (in session.js).
2018-05-02 10:51:45 +02:00
Lucas Perais (lpe) 2f5e44d40b [FIX] web: checkbox in editable list are clickable
Having boolean checkbox in an editable list

Before this commit, the checkbox was disabled, thus not clickable
The user, who probably expects to click on it to tick/untick
was thus misled, and needed to click *outside* the checkbox in order to activate the row
and only then tick the checkbox

After this commit, the behavior is as expected from the editable list point of view
clicking anywhere in the row (inlcuding on the checkbox itself) activates it into editable mode

OPW 1836067
closes #24292
2018-05-02 09:52:50 +02:00
Nicolas Martinelli bcd4c90a71 [FIX] web: get_file and CPU time exceeded
- Create a binary field which takes some time for computation. For
example:
```
ding_dong = fields.Binary(compute='_compute_ding_dong')

def _compute_ding_dong(self):
    if not self.env.context.get('bin_size'):
        while True:
            3*3
    for x in self:
        x.ding_dong = x.product_id.image_medium
```
- Run the server with a limited CPU time, for example:
  `--workers=2 --limit-time-cpu=10`
- Download the file

A JS traceback occurs, without any information about the real crash.

The error management is simply not working: `JSON.parse` is called on a
string which is not JSON-parseable.

opw-1838832
2018-04-26 15:14:47 +02:00
Géry Debongnie f47c544977 [FIX] web: fix a race condition in web client
Here is an interesting scenario, involving the reconciliation tour again
(because it is our only tour that does async stuff before changing url):

- web client starts normally
- tour reconciliation starts, perform an rpc to find some id
- web client fetches users default action, it is empty, so clicks on
  first menu item to load initial action, which is discuss. this will
  make the web client load the action with datamanager (it should be the
  action manager's job!).
- reconciliation tour rpc completes, it changes the url, this will do a
  do_action
- the load_action rpc from the web client completes, it will then
  perform a do_action, which will drop the action initiated by the tour
- tour fails.

The issue here is that the on_menu_action method from the web client is
not really safe, from a concurrency point of view: it performs some
asynchronous work, and then unilateraly decides to do a doAction.  With
this commit, we simply add the do_action request to the action manager,
which uses internally a "dropprevious" system.  This means that it will
always use the last action, just as expected.
2018-04-26 09:43:41 +02:00
Martin Geubelle c0809dd41d [FIX] web: reload progressbar values after archiving records
Before this, the progressbar values were not updated (both count and progress)
after archiving all the records of a column.

Multiple things have been done here to update it.

Firstly, a optimization had been done to avoid reloading the progressbar when
updating a column ; this optimization was not correct due to this precise use
case. This will update the progressbar.

Secondly, the `aggregateValues` are reset when putting empty groups back in the
datapoint. This attribute is used to compute the counter if a `sum_field` is set
on the progressbar widget. It needs to be reset because the loop that computes
it won't iterate on empty groups.

Eventually, the mockRPC of the progressbar route was not taking the `group_by`
argument into account (probably a typo).
2018-04-25 16:54:43 +02:00
Nicolas Lempereur 7b6744ecb7 [FIX] web: pivot race condition load data
When doing several grouping quickly (or if the system is slow) on the
pivot view, we may try to display data that now doesn't corresponds to
the current selected groupBys.

This commit ensures that when we load data of the pivot view, we drop
the previous data loading that are currently being carried out.

Without the fix, the added test failed with:

  TypeError: Cannot read property 'length' of undefined

because the test does:

- select one level of group by
- select two levels of group by
- resolve the first level of group by
- resolve the second level of group by

Without the fix, we would try to display the data for one level of group
by when the pivot view had two levels selected.

With the fix, displaying the first level of group by was discarded once
a second one was being requested.

opw-1825892
closes #24396
2018-04-25 09:11:10 +02:00
Christophe Simonis 7fd9dbdd9f [MERGE] forward port branch 11.0 up to b9ce1affbf 2018-04-24 15:55:17 +02:00
Géry Debongnie fcc6e9e3be [FIX] web: correct docstring (was showing incorrect type)
This is my mistake, I added the docstring without properly checking the
type.
2018-04-24 10:22:24 +02:00
Mohammed Shekha c1bf1c6a54 [FIX] web: preserve new column order after creation
When a user creates a new column in a kanban view, leave the action and
comes back, the order is not preserved.  With this commit, we force a
call to resequence to ensure that the order does not change.
2018-04-24 10:18:33 +02:00
Christophe Simonis e8bf128318 [MERGE] forward port branch 11.0 up to 3ab25b60bc 2018-04-23 18:15:25 +02:00
Christopher Ormaza 30490cae89 [FIX] web: handle nested x2m default values
The initial rev. odoo/odoo@2d3ecf2 that was supposed to handle this use case
was in fact only dealing with one command as default value for nested x2m, not
more.

The basic model can now handle multiple commands.

Closes #24241
2018-04-23 17:35:03 +02:00
Christophe Simonis 0bf642cb27 [MERGE] forward port branch saas-14 up to 2bc3fd89f2 2018-04-23 14:47:23 +02:00