diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-05-20 23:42:43 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-05-22 10:07:32 +0200 |
| commit | a60ae4383575d34d5bfa12b7dd9912d8290b9367 (patch) | |
| tree | 088e6335e489bc5f02edfac467424f26abac5135 /addons/web/static/src/js/fields | |
| parent | 8436150ae5820f1bde403c912ab1f9945e327d99 (diff) | |
[FIX] web: prevent navigation when line is invalid in o2m
The issue that we fix in this commit is the following: open a form view
with a o2m with one required field, and the o2m is editable. When
adding a new line, it is invalid (since the field with required), but
when pressing ENTER, the editable list tries to navigate away, which
will discard the current line (in the unselectRow method), before
completing the move_to_next_line. So, at this point, the list editable
create a new (empty) record, and we are back to square one, but with a
visible flicker and no information on what happened.
To fix this issue, we simply check that the renderer can be saved when
moving to next line. If it is not (the line is invalid), then we simply
abort the move.
Notes:
* this behaviour worked fine in list view, because the canBeSaved check
is made by the saveRecord method in listController
* it looks like the protection should be put into unselectRow, but this is
not true (at least, in the current state): in some cases, calling
unselectRow with invalid state should result in discarding the current row
(in a new line in a o2m, when the record is not dirty, for example), and
the list editable renderer does not know if this is the case or not.
However, if the unselect action comes from a navigation event, then we want
to avoid discarding the current row.
Diffstat (limited to 'addons/web/static/src/js/fields')
0 files changed, 0 insertions, 0 deletions
