Commit Graph

187 Commits

Author SHA1 Message Date
Christophe Simonis d73eeab5ba [MERGE] forward port of branch 7.0 up to 9fe040e 2015-02-11 16:39:11 +01:00
Géry Debongnie 2d524c947c [FIX] web: editable lists and read only fields bug
when the user press tab in editable list views, the focus is supposed to
go to the next cell unless it is at the last cell of the line.  in that
case, it is supposed to create a new record.

Sadly, when the last cell is readonly, this does not work.  This commit
make sure that read only fields are properly ignored when computing the
last_field state.
2015-02-11 12:46:13 +01:00
Denis Ledoux a692c6e934 [MERGE] forward port of branch 7.0 up to f406847 2015-01-15 11:49:28 +01:00
Denis Ledoux 38aa984f31 [FIX] web: avoid rendering fields on one2many list validation
This rev. reverts 91911159f5

The above rev. was a good idea, except that internal_set_value expects the raw value, while the records attributes can be tuples(for instance, many2one are tuple(id, name) or list of command(one2many, many2many).

set_value must be use here, as all fields (js) override set_value in order to handle their value repr (for instance, many2one fields handle the tuple (id,name).

Besides, avoiding the re-render provides a huge performance improvment, as rerendering fields can lead to xmlrpc calls (for instance, re-rendering a many2one field implies calling the name_get method)

opw-620111
opw-622108
2015-01-09 18:10:38 +01:00
Christophe Simonis 8f13e8320e [MERGE] forward port of branch 7.0 up to d0a0b7d 2014-08-20 17:45:05 +02:00
Denis Ledoux dcd26acccf [FIX] web: do not focus if the focus_field is not a field
Sometimes, focus_field could be a button, and in such cases, we should not focus on it

opw-612045
2014-08-14 17:33:59 +02:00
Christophe Simonis 75884c3e1a [MERGE] forward port of branch 7.0 up to 7e85786 2014-06-22 13:44:30 +02:00
Martin Trigaux bccd75796e [IMP] web: allow fields in list view to use the attrs readonly to dynamically show and hide the fields 2014-06-20 14:11:21 +02:00
Christophe Simonis bf53aeda94 [MERGE] forward port of branch 7.0 up to e5533d0 2014-06-19 15:32:32 +02:00
Denis Ledoux 893e4aae9f [FIX] web: focused field in view editable list
When adding an item to the editable list, the focused field was no longer the first visible field
This is related to revision 4a508885ac
visible_columns list is not ordered
2014-06-19 14:58:44 +02:00
Denis Ledoux 3c0292645f [MERGE] Forward-port of 7.0 bugfixes up to 63ea0df73f 2014-06-16 17:37:10 +02:00
Denis Ledoux 4a508885ac [FIX] web: view_list_editable, on add an item, focus on the first cell of new row
Before, the focus was set on the first row, and, thererefore, if the list was enough long, it jumped out and the actual new row was hidden
2014-06-12 20:03:50 +02:00
Denis Ledoux f6a6394980 [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 4171 revid:dle@openerp.com-20140409093422-imrg2hqozf46kj8d
bzr revid: dle@openerp.com-20140409093616-3060or02z8zmv8tm
2014-04-09 11:36:16 +02:00
Denis Ledoux a16b0c7907 [IMP] web: select input on add record in list editable
bzr revid: dle@openerp.com-20140408120141-f1fx2e9e8vqatccx
2014-04-08 14:01:41 +02:00
Denis Ledoux 5649e0bbf2 [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 9770 revid:chs@openerp.com-20140116154645-sy4zhdgqc48xaqbx
bzr revid: dle@openerp.com-20131224112612-5gjit5uu1aaaqstx
bzr revid: dle@openerp.com-20140103094532-mbczi9ssr3gc90o1
bzr revid: dle@openerp.com-20140108105833-gblxqdw3if1gt35k
bzr revid: dle@openerp.com-20140115121441-bskbyxxbc09ubavh
bzr revid: dle@openerp.com-20140115165506-yuux9km39gbv7k4n
bzr revid: dle@openerp.com-20140116161415-0y9m0kgavcytzj9z
2014-01-16 17:14:15 +01:00
Xavier Morel 1b76c66930 [MERGE] fixes for non-direct IME
bzr revid: xmo@openerp.com-20131218152626-kexq1wudvjwnh962
2013-12-18 16:26:26 +01:00
Martin Trigaux cfd24d9822 [FIX] view_list_editable: toggle visibility (using force_visibility attribute) for readonly changes, using effective_invisibility instead of invisibility attribute (opw 601970)
bzr revid: mat@openerp.com-20131217104111-u9bnqvz7rd5rzwnc
2013-12-17 11:41:11 +01:00
xmo 762774df37 [FIX] prevent field going to be misplaced when going from readonly to writable in editable list view
bzr revid: mat@openerp.com-20131210155703-2mzqa2mch46nxpcj
2013-12-10 16:57:03 +01:00
Xavier Morel 9322b677aa [FIX] weird behavior when drag&dropping a row during edition in editable listview
When dropping, would simultanously stop the edition and try a write
(so 2 writes on the same record) and generally screw up the state of
all the things, ending up with an empty row and a weird (and
incorrect) warning.

This can be fixed by preventing resequencing during the creation or
edition of a record (row) inline.

For simplicity, implemented by looking up .ui-sortable descendants —
there are no utility methods for handling that and, aside from the
class, there's no good way to know if sortability was enabled on a
list body or not (as far as I can see, jquery-ui's sortable has no API
to query that) — and using jquery-ui's sortable API for enabling and
disabling sortable on the fly.

lp bug: https://launchpad.net/bugs/1257753 fixed

bzr revid: xmo@openerp.com-20131210124755-ugr3ehf744qoh1o5
2013-12-10 13:47:55 +01:00
Xavier Morel 029c866b8c [FIX] issue when tabbing too much at end of editable list row
Tabbing is intercepted by keydown_TAB, which — if the current cell is
the last active field of the row — will then call _next:476. _next
then calls save_edition:300 which "takes a lock" (more precisely
serializes access to its body) and within its body checks if an
edition is active (:303) and returns immediately if not (:304).

The problem here is when a second tab event arrives during the
potentially extremely long save_edition body (since for toplevel lists
it needs to perform a complete RPC call): the overall state of the
list has not changed so the second event *also* goes into _next, then
into save_edition. There it's serialized with the ongoing call and
thus inactive until said ongoing call's termination, and reaches the
body after the current edition has been wound down. As a result, the
body of _next (:408) gets the resolution of ``$.when()``, which is
``null`` and the first condition blows up.

There are 3 possible ways to fix this:

* adding a check in keydown_TAB's handler to see whether a _next call
  is ongoing. This requires adding a state flag to the object and does
  not protect (or cooperate with) _next calls from outside this
  specific handler, unless they are modified in turn.

* alter save_edition to *fail* in case there's no ongoing edition:
  this part was originally in ensure_saved which does not care whether
  a save was necessary or not and does not propagate save information,
  so ``$.when()`` made sense. In save_edition, there are really 3
  different outcomes: the save succeeded, the save failed (or
  potentially part of save's postprocessing failed, for the current
  implementation) and the save was unnecessary. But deferred only
  provide 1 bit of state (success or failure), so the last state has
  to be merged into either success or failure.
 
  Both make sense, to an extent. Changing from one to the other (as
  necessary here) could break existing code and have more extensive
  effects than expected.

* the simplest and least far-raging change is to just alter the
  save_edition().then handler to ignore cases where save_edition()
  results in no saveinfo, this can be assumed to be a
  bailed-out/unnecessary save call.

For simplicity, the 3rd solution was picked here although with more
extensive tests &al I'd have preferred trying out 2nd.

lp bug: https://launchpad.net/bugs/1253899 fixed

bzr revid: xmo@openerp.com-20131210093055-207fevqc1npy7fwr
2013-12-10 10:30:55 +01:00
Xavier Morel b4c121db71 [FIX] bad interaction of editable list with IME
IME are ways to input language which can't trivially map to a keyboard
(e.g. CJK language) with a standard-ish keyboard. For japanese IME
this is done by entering text phonetically: text is entered in romaji
and automatically converted to hiragana (or katakana) when it matches
the transcription a japanese syllable (~phoneme?) e.g. to (と). The
text is then split and reprocessed with sequences of hiragana being
converted to kanji (or not), and the possibility to pick the right
kanji when multiple kanji match e.g. for "Tokyo" toukyou -> とうきょう
-> 東京.

But to do the edition, keyboard keys are used. For the japanese IMEs
(tested on Windows, OSX and Linux) [Space] will do the initial
conversion from kana to kanji (and allow selecting an other conversion
or a different kana split) and [Return] will validate the current
conversion (removing the underline marking "unvalidated" kana or kanji
groups).

And that's where the problem hit: IME + browser combinations may or
may not suppress part of all of the event. Firefox will trigger a
keydown of the key which "starts" IME input (e.g. "t") and will
trigger a keyup for the validation key (return), except on Linux where
the initial keydown is suppressed. Inbetween these, it will fire no
keydown, keyup or keypress event but will fire input events (at least
on an input element) every time the displayed text changes.

Meanwhile webkit browsers will, for each press on the keyboard during
IME,

* trigger a keydown with the keyCode 229
* trigger a keyup event with the keycode of the key which was actually
  hit
* trigger input events every time the displayed text changes

This include meta-operation uses of [Space] and [Return].

MSIE has the same behavior (including triggering the input event), but
the keydown event is augmented with ``key`` and ``char`` attributes
providing the character matching the key hit to trigger the change.

Although the triggering of the input even is useless for the purpose
of the editable list (especially here, the purpose of validating a
list row with [Return] one fact stands out: keypress is never
triggered during IME operations, hitting the [Return] key outside of
IME will trigger keydow, keypress, keyup but doing so during IME will
only trigger the first and last.

Thus by changing the binding from keyup (return) to keypress (return)
for a line validation, spurious validation during IME text entry
should be avoided. This seems to work correctly on MSIE (Windows),
Firefox (Windows, OSX, Linux), Chrome (Windows, OSX, Linux) and Safari
(OSX), after testing in IE9, IE10, Chrome 31, Firefox 25 and Safari 7,
and a quick test on a task's o2m did not reveal any regression.

note: not all differences between various browser/os combinations were
inspected in details, there may well be further differences which were
not noticed or not relevant to this precise issue.

bzr revid: xmo@openerp.com-20131206124431-q4a9l1gn9wjtmlvz
2013-12-06 13:44:31 +01:00
niv-openerp baef37aec6 [IMP] Removed old JavaScript module loading system in the 'web' addons. Still has some retro-compatibility for other addons.
bzr revid: nicolas.vanhoren@openerp.com-20130806125022-bzjbtn0nqk40ak4g
2013-08-06 14:50:22 +02:00
niv-openerp c767a0d34c Added semicolons
bzr revid: nicolas.vanhoren@openerp.com-20130725103301-65nld10p1if7k0zt
2013-07-25 12:33:01 +02:00
niv-openerp 42e493e73e Added Gruntfile with jshint and corrected most js errors
bzr revid: nicolas.vanhoren@openerp.com-20130725100749-0i82gf3k3nvt4r44
2013-07-25 12:07:49 +02:00
Xavier Morel 1ea609ba65 [FIX] bugs discovered by failing onwrite test case
Following xmo@openerp.com-20130607120355-x3poxy2ar2bpqqvw:

* add_ids should not add ids which are already in the dataset, this
  leads to duplicates which the web client does not overly like

* methods which add or remove records should not manipulate
  dataset.ids as well as that's now automatic (on_write feature)

* record add should only insert the id in the dataset on non-false ids
  (e.g. list edition uses "pending" record with false id during
  creation, then sets the id it got from create() call)

bzr revid: xmo@openerp.com-20130607152326-2pja1kuwo0ropfuw
2013-06-07 17:23:26 +02:00
Xavier Morel 2e0270783a []FIX] disable (broken) inline edition in grouped editable lists
Because the Add/Create button is global, it's not really possible to
know *where* to create the new record, and the current design can't
really deal with a record being edited outside of all groups.

An option might be to create a dedicated empty group for that, but the
cost/benefit is high and the UI would probably be odd.

lp bug: https://launchpad.net/bugs/1098205 fixed

bzr revid: xmo@openerp.com-20130306102136-2ms7llbt4swka92k
2013-03-06 11:21:36 +01:00
Xavier Morel a8d2327cda [FIX] Correctly stop embedded form when switching from editable to non-editable list
When using the ``set_editable`` feature (context key) from filters
(togglable on/off), the list view would not correctly clean up
(destroy) the form when switching from editable with a started editor
(and form) to non-editable, leading to form fields (in this case m2o
fields being in an incorrect state and trying to query a non-started
autocompletion widget on every click anywhere blowing it up).

lp bug: https://launchpad.net/bugs/1117320 fixed

bzr revid: xmo@openerp.com-20130225135629-8k338gw0arsi6m6j
2013-02-25 14:56:29 +01:00
Vijaykumar Baladaniya 5f23b55909 [FIX] passtrough_events name replace with passthrough_events.
bzr revid: vba@tinyerp.com-20130204084307-8qremz8qi1qcwhfe
2013-02-04 14:13:07 +05:30
Xavier Morel e972b6a5d4 [FIX] cancel list edition on search
Otherwise, if a search is performed while creating or editing a line
(e.g. in logged calls, create a line without saving then try to apply
a filter) the edition section (and new line) disappears but the list
remains in "edition" mode (e.g. save/discard button) even though
edition data is missing (trying to save or discard will error out).

bzr revid: xmo@openerp.com-20121210100914-delia5bhmtgrujpu
2012-12-10 11:09:14 +01:00
Xavier Morel 0b0cfff063 [MERGE] missing translation marks, courtesy of Csaba TOTH
lp bug: https://launchpad.net/bugs/1084306 fixed

bzr revid: xmo@openerp.com-20121129140109-bwx1njhyqfenc2d3
2012-11-29 15:01:09 +01:00
Xavier Morel 9f76458404 [FIX] groupby on editable list
Because of the "meta" columns (e.g. group name column),
ListView#columns would end up with a different number of elements than
ListView#fields_view.arch.children, and when zipping them together (to
build the form view for edition) things wouldn't match anymore.

It would seem simply filtering out meta columns (and only keep those
actually specified by the view) is sufficient to fix the issue and
have everything line up again. I'm midly impressed.

bzr revid: xmo@openerp.com-20121129131301-scc38i4l55ea7lis
2012-11-29 14:13:01 +01:00
tsabi 72109e7541 fix tab problem
bzr revid: csaba.toth@i3rendszerhaz.hu-20121129115306-ifncjymnmuk989eq
2012-11-29 12:53:06 +01:00
tsabi 92e87f7e6f Mark strings to be translated.
Maybe some missed, but most of them marked.

bzr revid: tsabi-20121129002200-20tppzvh0ap5tfwe
2012-11-29 01:22:00 +01:00
Xavier Morel ef5be74caa [FIX] disable sorting (column-click) in an editable listview being edited
To do so, extract sort handling to its own method (bound using the
events hash) and override-and-disable in editable.

bzr revid: xmo@openerp.com-20121127094109-mojnq50mzsrcj3q0
2012-11-27 10:41:09 +01:00
Denis Ledoux dle@openerp.com 08e0522ad6 [FIX]Add option 'disable_editable_mode' which disable editable widget when setted to true. This is because search popups should not be editable. 'search more...' was not clickable in fields with many2many_tags widget and default tree view with flag editable setted
lp bug: https://launchpad.net/bugs/1080997 fixed

bzr revid: dle@openerp.com-20121120153958-jopkpxmz38b78phj
2012-11-20 16:39:58 +01:00
Xavier Morel e0ec6783e5 [IMP] listview already checks non-empty ids array for deletion, so check not useful
bzr revid: xmo@openerp.com-20121119084533-6qnktzmh19kfwtoo
2012-11-19 09:45:33 +01:00
Xavier Morel 28cbfd22b7 [FIX] editable listview: do not attempt to delete falsy ids (from the dataset)
During the creation of a new record (in an editable list), the
prospective new record has a ``false`` id. In a non-o2m, the row under
creation can be selected (checkbox) and deleted (More > Delete),
leading to the request to ``DELETE false`` being sent to the ORM…
which said ORM does not wish to entertain.

Before actually performing the delete request (more precisely
forwarding said request to the listview itself), remove all false-ish
ids from the array.

Also, don't send a request to delete nothing.

bzr revid: xmo@openerp.com-20121119084203-0vz4v9myfizxz88u
2012-11-19 09:42:03 +01:00
Xavier Morel 86842fe9c8 [FIX] correctly handle case of deleting-an-o2m-line-being-edited
move special case in o2m listview to main editable and expand to
correctly fit edition cases, not just work in case of creation

issue: if a row being edited is deleted in an o2m, the form will be
blurred and try cancelling/saving the edition and reloading the row,
but this will only happen *after* the record/row/whatever has been
"deleted" and (amongst other things) removed from the buffered o2m
cache, leading to a tentative read on the server side (usually with a
local id which doesn't even make sense) and thus an error.

Intercept the deletion signal to cancel the edition immediately and
only let the deletion through after the edition has successfully been
canceled.

bzr revid: xmo@openerp.com-20121116164416-8kr39t6jtqy2s3jc
2012-11-16 17:44:16 +01:00
niv-openerp 729eb0ff4f [FIX] problem with list editable in o2m
bzr revid: nicolas.vanhoren@openerp.com-20121114103156-tzbz8sm4x54jgjvm
2012-11-14 11:31:56 +01:00
Xavier Morel a379a62d88 [REM] useless events binding
edition is triggered by row_clicked on the internal List

not even sure there's any td left which isn't an oe_list_field_cell

bzr revid: xmo@openerp.com-20121113124227-173ykkiwgv862oly
2012-11-13 13:42:27 +01:00
Xavier Morel 06bcfd27fc [FIX] editable listview @on_write handling in case of @colors
the onwrite handler created an "empty" record with no field value
whatsoever, which'd blow up in the py evaluator. As during creation
(edition of a record where all fields are empty) create a record where
all fields are set to ``false`` so rendering works correctly, and wait
for content refresh to get correct data.

Also added a test for @on_write

bzr revid: xmo@openerp.com-20121112150526-vrr66ms95qbuoped
2012-11-12 16:05:26 +01:00
Xavier Morel 788e8edf81 [FIX] don't resize & reposition invisible or readonly fields in editable listview
the datetime field doesn't setup its internal widget if the field is readonly, so accessing it blows up

bzr revid: xmo@openerp.com-20121108153544-o2uvpfeoofu2tx12
2012-11-08 16:35:44 +01:00
Fabien Meghazi 0b4b1cf52d [MERGE] trunk
bzr revid: fme@openerp.com-20121108111222-cetz6q6s47iwxnm2
bzr revid: fme@openerp.com-20121108111448-2rzx9moaqloc5lpc
2012-11-08 12:14:48 +01:00
niv-openerp fd2bb078fb Fixed problem with editable list
bzr revid: nicolas.vanhoren@openerp.com-20121106103828-uw6xv1ed7wueii71
2012-11-06 11:38:28 +01:00
Fabien Meghazi 2994db89ca [MERGE] trunk
bzr revid: fme@openerp.com-20121105093013-31veb91zkdeiuddh
2012-11-05 10:30:13 +01:00
Xavier Morel 62f4d999f4 [IMP] positioning of edition fields within a scrolled dialog
they still don't work every time, but should be slightly more reliable

bzr revid: xmo@openerp.com-20121031140718-j3e4r9djyq34rqu7
2012-10-31 15:07:18 +01:00
Xavier Morel b6af4f22cb [FIX] [ESC] key closing dialogs when editing a list
bzr revid: xmo@openerp.com-20121031140641-l1nf68jxiye8fyi8
2012-10-31 15:06:41 +01:00
Fabien Meghazi ca6c49becf [IMP] jQuery deferred API changes refactoring. Changed 'then's in 'done'/'fail' and 'pipe's in 'then'
bzr revid: fme@openerp.com-20121030140630-gf20ye8fou1ebxft
2012-10-30 15:06:30 +01:00
Xavier Morel 9bf9ca7a67 [FIX] list view to use View#load_view rather than its own implementation thereof
bzr revid: xmo@openerp.com-20121023085329-y01e1u77vfz2n7a9
2012-10-23 10:53:29 +02:00
Xavier Morel b5be361c55 [FIX] various listview issues
bzr revid: xmo@openerp.com-20121018150108-althdcxk3jc2bkun
2012-10-18 17:01:08 +02:00