Commit Graph
697 Commits
Author SHA1 Message Date
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
Lucas Perais (lpe) 23313583b2 [FIX] web: progressbar updates on field reset
Have a form record with a progress bar
Modify the max_value of the progress, as well as the current_value bar through an onchange

Before this commit, the new max_value was not taken into account

After this commit, it is.

closes odoo/odoo#29056
2018-11-27 08:53:17 +00:00
Lucas Perais (lpe) ac5a1662f2 [FIX] web: propagate can_create into the search popup
When creating a SO line and clicking on search more for product_id

Before this commit, every user had the button "Create" to create a product.product

After this commit, only user in groups that actually can create a product have the button

OPW 1910371

closes odoo/odoo#28924
2018-11-26 14:54:21 +00:00
Lucas Perais (lpe) c9e32872c0 [FIX] web: list default_sort with multiple fields
Define a x2m tree view with a default_sort including more than 1 field to order the list against

Before this commit, the second field was never used

After this commit, it is used

OPW 1909785

closes odoo/odoo#28840
2018-11-26 09:28:55 +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
Lucas Perais (lpe) 3a0f9da0eb [FIX] web: load SubViews without previous' view _view_ref context keys
On a form view (of model A), define a many2one (model B) with a [form|tree]_view_ref context key
In that view, have a x2m field (model C) with a different [form|tree]_view_ref context key

Before this commit, the second load_views (i.e. on the model C) crashed because
the wrong context key was sent to the server, which returned the view to which the _view_ref points
i.e. the view of the model B

After this commit, we clean the context of subviews loading, because those keys are only useful for the python
and one shot. Hence, there is no crash

OPW 1903780

closes odoo/odoo#28260
2018-11-13 09:02:24 +00:00
len-odoo 180f528528 [FIX] web: reload many2one data if the context has changed
When a view is loaded, it checks which fields it has to load.
In the case of a many2one, it could be the case that a context key is present in
one view and not in the other; if it happens, we should reload the data, as a
name_get result could vary.

opw 1891295

closes odoo/odoo#28298
2018-10-31 12:52:36 +00:00
Rémi Rahir a219bdb85e [FIX] web: consider correct viewtype when loading data
Before this commit, when loading the data and calling the prostprocess,
the viewType was not correctly passed which could lead to broken
behaviour. For example, if one was to load a record from a list view
embedded in a form view, the viewtype passed was the list which
prevented to load the data from the form view.

OPW 1891295

closes odoo/odoo#28279
2018-10-30 09:24:39 +00:00
Julien (juc) Castiaux 854208370c [FIX] web: creating a record in a grouped empty kanban view crash
When creating a record in a grouped kanban view, it tries to add
the record to the first column but if no column exist, it fails
to find the first one and raise an exception.

This PR correct that bevahior by checking it exists a column and
fallback to the view form when it does not.

opw-1902851

closes odoo/odoo#28262
2018-10-30 07:17:40 +00:00
Christophe Simonis e744241d83 [FIX] web: trim tooltip text before comparison
The error is triggered at least on Chrome 69 on macOS.
2018-10-22 16:53:21 +02:00
Aaron Bohy 22a13073f0 [FIX] web: kanban quick create properly disabled
when grouped on field types for which it isn't supported.

Rev. 42e1efd disabled the quick create feature when the view is
grouped by date(time) fields. However, it hasn't been correctly
forwardported to 11.0 (with the new views). Indeed, the check was
done only once, at the initilization of the view. So if the user
selected another field to group by afterwards, the quick create
feature wasn't enabled/disabled accordingly.

Moreover, we didn't check if it was available when the user clicked
on CREATE in the control panel. So even if it wasn't (and thus if
there were no '+' icon in the columns), when the user clicked on
CREATE, the quick create widget was inserted in the first column.

This rev. fixes both issues.

Task 1878254

closes odoo/odoo#27867
2018-10-19 06:56:40 +00:00
Alexandre Kühn 5c12a664d5 [FIX] web: click on href inside kanban record
Before this commit, when clicking on a link in a kanban
record having `href` that is set, it was opening the record
and accessing the `href`.

The intended behaviour is to not open a record if any children
component of the record contains either a click event or is
a link with `href`. The former was correctly handled, but not
the latter.

This commit fixes the issue by preventing opening the record
when clicking on a inner link with href from a kanban record.

Closes #24664

closes odoo/odoo#27529
2018-10-09 08:39:50 +00:00
Lucas Perais (lpe) 62cbc5f240 [FIX] board: translate custom views according to current user
Have a user in English, put a sale report as "favorite" (pinned to dashboard app)
Change the user's language

Before this commit, the pinned view was in English (because it was recorded that way)

After this commit, the pinned view is in the user's language.

OPW 1890664

closes odoo/odoo#27574
2018-10-12 08:36:19 +00:00
Sébastien Theys 57ae9428b4 [FIX] web: prevent URL click from opening a record
If we click on a link, we only want to open the URL,
and not the record when the button is on a list.

PR: #27230
2018-10-12 12:45:38 +00:00
len-odoo 52d779007d [FIX] web: use read to update record values after resequence
Commit:
https://github.com/odoo/odoo/commit/818c18e55d0718286ff5bf332186a10f4d7a58ef
Updated the resequence logic in a way that was almost falser than before.
The added test however did work by coincidence, as index values were equal to
the sequence field values.
To be sure that we synchronize with what happens on the server, we do a read
after the resequence.
Additionnally, we take into account the result of the server resequence return;
if it is false, it means no resequencing happened, so we should not do a read.

opw 1867049

closes odoo/odoo#27184
2018-10-12 07:51:12 +00:00
Martin Geubelle f249c5ef2a [FIX] web: restore broken datepicker input behavior
In Firefox, the input behavior and visual representation (navigation, caret
placement, value selection, etc.) was broken when using a datepicker (easily
reproductible on date and datetime widgets).

This was due to the `focus` event being stopped on the input, which doesn't
seem to be correctly supported by Firefox.

The deleted code was supposed to toggle the picker when the field was clicked
(see odoo/odoo@89093a1) (toggle on click and disable focus) but the lib
correctly supports on focus without extra code.

This also fixes the fact that the datepicker was not open on focus (only on
clicked). In some tests where the field was the first in the form view, it is
now correctly autofocused.

Forward-port: not useful from 12.0 because the code has changed with BS4 and
this has already been applied in odoo/odoo@6692919 and odoo/odoo@c63630d.

Closes #23438

closes odoo/odoo#27657
2018-10-11 08:41:48 +00:00
svs-odoo 078b31dc7f [FIX] web: Make datetimepicker configurable in datetime fields
The datetimepicker option was introduced to be able to customize the
datetime picker widget in date/datetime fields. However, due to the way
the _makeDatePicker function was coded, it did not work in datetime
fields.

Thank to Yajo for the initial fix

closes odoo/odoo#27541
2018-10-09 12:34:23 +00:00
MOENS Alexandre b83db27135 [FIX] web: JournalDashboardGraph widget crash Mk.II
Hardening of commit:995610c065bf0242cb5023cfad2940234395739e

The JournalDashboardGraph requires nv, which is lazyloaded.
However it requires nvd3.js which is loaded after nv.d3.js.
A function called in destroy is defined by nv.d3.js,
which can make the crashhappen with the right (wrong) timing.

opw 1873749
2018-09-14 16:13:35 +02:00
len-odoo 8179960172 [FIX] web: lock handle when sorting on a different field
The resequence mechanism works if the sequence is sorted by its handle field.
Therefore sorting on another field should lock the handle, while sorting on the
handle field should unlock the handle.

opw 1867049
2018-09-14 14:00:52 +02:00
Géry Debongnie cd62900878 [IMP] web: add fail fast feature to qunit test suite
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!

Backport of 611c836a46
2018-09-13 08:56:08 +02:00
Nicolas Lempereur db0e84f3e3 [FIX] web: revert ignore default_* on group creation
This reverts commit 4cb585ab4f.

When creating from the kanban view:
- crm.stage
- hr.recruitment.stage
- project.task.type
- helpdesk.type
- mrp.eco.stage

We go from a dashboard of eg. "GroupRecord" named "group_id" in the
record. And when a stage is created, "default_group_id" is used. With
the change the stage was not linked to the current "grouping".

We could probably use "search_default_group_id" instead but the behavior
may be present in existing customization.

opw-1884217
closes #26943
2018-09-12 17:43:39 +02:00
Nicolas Martinelli d3d3455e17 [FIX] web: lock handle when sorting on a different field
This makes runbot Enterprise fail. Reverts until a proper solution is
found.

This reverts commit f4f1480a3e.
2018-09-11 21:48:03 +02:00
Aaron Bohy a51a5b70d3 [FIX] web: FieldDomain: reset field with a new domain
Before this rev., there was a crash when a FieldDomain was reset
with a new domain (e.g. coming from an onchange). For instance, it
crashed in Email Marketing > create new Mass Mailing > select
mailing lists. Introduced by 68332a01.

opw-1882850
2018-09-07 08:37:45 +02:00
Christophe Simonis 737ca0eb42 [FIX] web: adapt newly added test (2) 2018-09-06 17:27:50 +02:00
Christophe Simonis 63f95760ef [FIX] web: adapt newly added test
Oversight of previous forward-port
2018-09-06 17:23:27 +02:00
Christophe Simonis 505e42b78b [MERGE] forward port branch saas-15 up to 5a5d6d1e8e 2018-09-06 17:00:26 +02:00
len-odoo f4f1480a3e [FIX] web: lock handle when sorting on a different field
The resequence mechanism works if the sequence is sorted by its handle field.
Therefore sorting on another field should lock the handle, while sorting on the
handle field should unlock the handle.

opw 1867049
2018-09-05 13:09:36 +02:00
Nicolas Martinelli 31981731ea [FIX] web: time display
The calendar should use the time format of the language parameters.

Partial backport of d4b5668c1a

opw-1881335
2018-09-05 08:53:35 +02:00
Nicolas Lempereur 4cb585ab4f [FIX] web: ignore default_* on group creation
When a column is created in the kanban view, the context of the window
action is fully given but it may contain default_{field_name} context
keys that are intended for the action model.

eg. on a product.product view we could have {default_type:'product'} in
the context, if we grouped by company_id and created a new company, we
would the context is propagated and we would try to set type='product'
on the company (which causes an error).

Without the change, the added test fails with:

  default_* should be removed from context, actual: "true", expected: "false"

opw-1879064
closes #26676
2018-09-04 11:03:15 +02:00
Nicolas Lempereur 388eff5b58 [FIX] web: load more with progressbar load more
Be in a grouped kanban view with progressbar with limit 10:

- records 1 to 10 are loaded on a column
- do "Load more..." on a column => records 11 up to 20 are loaded
- do "Load more..." 2nd time => records 11 up to 20 are loaded
- do "Load more..." 3rd time => records 11 up to 20 are loaded
- ...

While in reality it should be:
- do "Load more..." 2nd time => records 21 up to 30 are loaded
- do "Load more..." 3rd time => records 31 up to 40 are loaded
- ...

This was caused by the progressbar reloading the column's group. This
set the loadMoreOffset to 0 thus forgetting the current state.

Without the change, added tests failed with:

 records of column are loaded => actual: "1,2,2", expected: "1,2,3"

opw-1878359
closes #26628
2018-09-03 15:58:52 +02:00
len-odoo b95b4035e4 [FIX] web: tab selects first many2one entry without triggering spurious create
Suppose you select a customer for a sale order.
You type the beginning of his name "think", and a name_search is triggered
which finds matching results, with first result "Think Big Systems".
There are three ways to select it: click, enter or tab.
Now there can be a warning set on this customer
("Bad client, only accept cash", or "good client, offer discount").
In that case, clicking on tab would trigger the onchange displaying the warning,
but it would also set floating to true, which means a dialog to create client
"think" would appear.
This happens if the onchange is delayed, and thus the call to reset the floating
state is triggered only after the focusout completed, instead of before.

Coauthored with @aab-odoo

opw 1866619
opw 1874475
2018-09-03 12:09:56 +02:00
len-odoo 8c1204954e [FIX] web: display values according to widgets in pivot view
The pivot view didn't take into account the widget set on the fields.
In particular this was a problem for float fields that store time values.
They are now displayed with float_time if declared as such in the view.

opw 1876445
2018-08-31 15:23:31 +02:00
Aaron Bohy 68332a0177 [FIX] web: fix evaluation context of the domain selector
The domain was instantiated without being given any evaluation context.
As a result, the uid variable was not defined,
crashing the js if present in a user-defined filter.

opw 1866852
2018-08-30 14:55:06 +02:00
len-odoo 683ecab8dd [FIX] web: use an unused variable in mock server
Fine-tuning of commit:
https://github.com/odoo/odoo/commit/818c18e55d0718286ff5bf332186a10f4d7a58ef
which introduced a variable that it didn't use.

opw 1867049
2018-08-29 11:04:46 +02:00
Dipalee Bhalodia 3c9aa50449 [FIX] web: Graph: group by two fields on line chart
Before this commit, when we applied two or more groupbys in line
graph, the groups displayed on the X axis where shifted to the left,
and the first one wasn't displayed at all.

related task: #1848289
Closes: #25037
2018-08-27 08:21:40 +02:00
len-odoo 818c18e55d [FIX] web: fix js data during consecutive sequence of resequence moves
Let x_1, ..., x_a, x_{a+1}, ..., x_{a+k}, x_{a+k+1}, ..., x_{n} be a record
sequence ordered by its 'sequence' field.
Suppose the reordering occurs between elements x_{a+k} and x_{a+1}.
If the subsequence x_1, ..., x_a is ordered, then it does not change.
This is also true of the subsequence x_{a+k+1}, ..., x_{n}.
The resquence function makes exactly this assumption, and only sends the server
the subsequence x_{a+1}, ..., x_{a+k} to update its 'sequence' field.
The update of x is done as follows: it is index + offset, where index is the
position of x in the subsequence, and offset is the 'sequence' of the first
element of the sequence (i.e. x_{a+1}.sequence).

It is easy to see that we need another hypothesis: that the sequence numbers are
unique. To show it, suppose that the sequence of x_1, ..., x_a is 0, then all
x_{a+1}, ..., x_{a+k} have sequence 1, and lastly all x_{a+k}, x_{a+k+1}, ...,
x_{n} have sequence 2. Then after the call to the server resequence, the
subsequence x_{a+1}, ..., x_{a+k} would have sequence numbers 1, 2,..., k.
Since the x_{a+k+1}, ..., x_{n} subsequence have 'sequence' value 1, this would
obviously be incorrect.

We fix the reordering of the data in the js frontend to be consistent with
what is done by the server.
Note that this is only pertinent for sequences of reordering moves, since
otherwise the data comes directly from the server.

opw 1867049
2018-08-24 17:25:54 +02:00
David Monjoie a66650a7fa [FIX] web: esc cancels kanban column quick create
The feature was already declared in AbstractQuickCreate, but the
ColumnQuickCreate object did not define a _cancel function.
2018-08-22 15:54:21 +02:00
Nicolas Lempereur d409ab6f32 [FIX] web: open group in list => keep line selection
You:

- open a grouping in a list view
- check a line of this grouping
- open another grouping

=> all checkbox are unchecked

With this commit, 0982ceaa is improved so the selection is only reset
when the list has been reloaded.

opw-1865736
closes #26213
2018-08-17 15:33:40 +02:00
Andreas PerhabandNicolas Martinelli 52fef21d81 [FIX] web: re-add title attribute for many2many tags that got lost
Co-authored-by: Nicolas Martinelli <nim@odoo.com>

Closes #25693
2018-08-07 09:21:22 +02:00
len-odoo e57a1a8e6f [FIX] web: fix 'drag and drop' test function to work in both directions
The 'drag and drop' function defined in test_utils should be aware of four
different cases, moving up or down, above or below another row.
We need an offset of one pixel for the function to work when moving down
(this is a case of broken symmetry because of <=)

Related to opw 1867049 regarding sequences of resequence moves.
2018-07-31 16:18:26 +02:00
len-odoo bc12428e17 [FIX] web: format value of statinfo widget
The value of the statinfo widget is rendered by the qweb after a t-esc.
Say if the python rounding returned 14.0000000001
(supposed to be a two digits precision number through the magic of floats)
then the statinfo widget would print it as-is.

We now format the value at assignation.

opw 1865426
2018-07-19 13:19:09 +02:00
len-odoo c8474c8ab4 [FIX] web: trigger a warning modal when deleting a line while editing in a one2many
In a one2many, if the user clicked the trash button while editing another line,
the row was not unselected.
Thus the modal was not triggered, which entailed that the currently edited line
was always saved.
In particular, it allowed to give empty values to required fields.

opw 1834346
2018-07-06 07:52:52 +02:00
len-odoo 7764db7a34 [FIX] web: handle onchange on a on2many with an embedded one2many on multiple pages
Suppose there is a one2many field embedded in a one2many,
(say we are viewing record A with one2many field B itself with a one2many C).
Furthermore, there is a second page of the one2many field B.
If an onchange is applied on B, then the server replies with a 1 command for all
B records attached to the currently viewed object A.
This includes a list of commands [[5], [4, C_id]*] for each B record,
in particular B records that are on the second page.
Since they are on the second page, they might not have been fetched by the
frontend; in that case the corresponding C_ids are thus unknown.
As a consequence, on save the frontend sends a command 0 to create the records
for all unknown C_ids.
Since it doesn't have any value to give to the 0 command, the row creation
usually crash in the backend.

Another wrong behaviour is fixed at the same time: if the server sends an update
on the list of C ids with 4 commands.
In that case, if the record has not been prefetched, we have no way to know
if the list changed or not.

To solve this, when we receive the 4 commands by the server, we send back 4
commands.

coauthored by @aab-odoo

opw 1835936
2018-07-05 15:03:37 +02:00
Alexandre Kühn 7af09db878 [FIX] web: no concurrent reload on basic model
Before this commit, there was a traceback in the following scenario:

Let's have a kanban view with groupby and a domain.
If we clear the domain then clear the groupby, there could be a crash.

This crash occurs because when we clear the groupby, it performs a `reload`,
and assumes that the datapoint contains grouped data. However, if this
computation takes some time, it is possible to overwrite the datapoint so that
there is no longer grouped data.

This commit fixes the issue by enforcing at most 1 execution of the method
`reload` active at any time. Consequently, successive reloads operations are
now much slower.

Note that it uses the single non-reentrant mutex on the basic_model to enforce
this rule, which means:

  - No more concurrent `reload` and `save`.
  - If an execution having the mutex in `reload` come accross the same mutex,
    it is blocked forever. This is hopefully not the case at the moment,
    however a reentrant mutex should be considered in the future.
2018-07-05 14:04:33 +02:00
Lucas Perais (lpe) daedcd92e3 [FIX] web: mock fieldsViewGet don't delete raw attrs
Have a view with a field as:
<field name="stuck_in_the_middle" attrs="{'readonly': [('with_you', '=', False)]}"/>

Before this commit, the contents of attrs were parsed and merged into the modifiers
and the attrs attribute of the node was deleted
which might cause divergence between reality and tests

After this commit, the mock server does what the server does in this case

closes #25583
2018-07-04 09:28:04 +02:00
Nicolas Lempereur 06d89a8440 [FIX] web: onchange on not loaded inline list view
Let's assume a one2many A inside a form view, such that the one2many
views (list, not editable, and form) are defined inline, and there is an
onchange on A. There is another inline one2many B editable list
displayed in the inner form view (and B isn't in the list). There are
two records on the one2many A, both of them having one record in their
one2many B. Edit the first record of A, and edit it's subrecord in B.
Click on save. This triggers an onchange on A and the onchange returns a
command 5 (DELETE_ALL), and two commands 1 (UPDATE). Now edit the second
record of A, and simply close the dialog (e.g. 'Discard'). Save the main
record: the record in one2many B of the second record of A has been duplicated.

This occured because the code in BasicModel messed up information coming
from the onchange (UPDATE command) and from the read (performed when
opening the second record), thus producing a CREATE command instead of
an UPDATE one.

This rev. ensures to properly mix the read data with the onchange
result, by transfering the changes over the list datapoint created after
the read.

opw-1836785
closes #25330
2018-06-22 10:19:51 +02:00
Alexandre Kühn c53b0ac188 [FIX] web: do no drop invalid record in list on discard
Revision on b09f0c99

The intent of the previous commit was to no drop records in a list
on discard in the following cases:

    - when they have been created from a `default_get`
    - when they have been created from an `onchange` that result
      from a `default_get`

Before the commit above, the kind of records that were abandoned
in those cases are stated as invalid, which happens when a record
has a required field that is empty.

The case of an `onchange` that is not involved in a `default_get`
was not considered in the fixes above. In fact, this is the intent
behaviour in most cases. However, if the items in the list are
created from such an `onchange`, we should not drop them.

This commit fixes the bug where records in a list that are created
from an `onchange` are wrongly abandoned. Here is the new logic to
abandon a record on discard in a list:

    - the record that is marked as "do not abandon" should not be
      abandoned;
    - a record that is registered as a "not new addition" in the
      list should not be dropped;
    - a record that is registered as a "new addition" in the list,
      and has been updated afterwards, should not be dropped;
    - a record that is not new should not be dropped;

opw-806650
2018-06-15 17:36:27 +02:00
Lucas Perais (lpe) 654ee788d9 [FIX] web: new record with o2m also with new records prevent name_get
Have a model A with a o2m to B.
In the list have a field  B > m2o > C

Also have a sequence field (widget handle) on B

Then Create a record A
Arrange yourself to have two new records B popping right away (through an onchange)
in the o2m. Their C field have to be empty

Resequence those two B lines with the handle

Before this commit, there was a traceback when trying to do an name_get on the C fields
Since both of them are empty, there is no record in the localData
Hence, no model. And also no records anyway, so no need to do a name_get

After this commit, there is no traceback, the name_get is avoided when no data is to be fetched

OPW 1853088
closes #24988
2018-06-06 09:51:56 +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