Commit Graph
115 Commits
Author SHA1 Message Date
Christophe Simonis 7717f082c0 [MERGE] forward port branch saas-11.3 up to af35aea6b0 2018-08-09 19:33:32 +02:00
Christophe Simonis 4c2bdafe69 [MERGE] forward port branch saas-15 up to e7ccf38c48 2018-08-08 18:42:27 +02:00
Nicolas Lempereur 8ff138a0da [FIX] barcodes: ok PageUp/Down/Home/End in firefox
Same reason as 8d948d92.

In firefox if barcode is installed, for example on a form view the keys
to navigate the possible scrolling PageUp/PageDown/Home/End don't work
at all.

This is caused by the interface barcode catching and differences of the
key event handling between firefox and other browser.

So in this change, we add these keys so they are not catched by barcode.

note: aso backport 5bc29744c so the code is the same between 10 and 11.

related to opw-706352
closes #26219
2018-08-08 09:11:06 +02:00
Christophe Simonis c8bb02141d [MERGE] forward port branch saas-11.3 up to 3cdcbce93c 2018-06-28 19:01:52 +02:00
Nicolas Martinelli 1fe119da3b [FIX] barcodes: nomenclature
Loads the barcode nomenclature only if one has been is defined. Indeed,
from commit 80e89c7a11, the POS config unset the
`barcode_nomenclature_id` field if the barcode support is not activated.

opw-1859928
2018-06-21 10:40:59 +02:00
Simon Lejeune 5dc9230c6e [FIX] barcodes: barcode input
If the barcode input is hidden, it isn't possible to focus it and thus
it isn't possible to actually use it.

related to rev b4a8338959
2018-06-20 14:46:30 +02:00
Julien Machiels e9901d1422 [FIX] barcodes: barcodes working in button in dropdown
On mobile, some barcodes didn't trigger in the picking screens, notably
O-BTN.validate. This is due to the use of parent() to check if the
button is in a dropdown, as parent() only checks one DOM-level upwards.
The button being inside a <ul><li>, we need to check more levels than
one to pass the condition and trigger the button press.

By changing parent() to parents(), the entire chain will be checked, not
just one level, and the button press is correctly triggered.

opw-1860964
closes #25941
2018-07-24 14:45:57 +02:00
Adrien Dieudonne b4a8338959 [FIX] barcodes: hide barcode input 2018-06-11 17:01:33 +02:00
Simon Lejeune 17984be82c [REF] barcodes: form view: better error messages 2018-06-11 16:18:18 +02:00
MOENS Alexandre d13fb14f1e [REF] barcodes: pager: warn if a pager isn't present
If a barcode triggering an action on the pager was scanned while a pager
wasn't present in the page (see the workorder tablet view), a traceback
happened.

We display a warning instead.

Task: 1831245
2018-06-11 16:18:18 +02:00
MOENS Alexandre defff5f191 [REF] barcodes: form view: multiples button for a single trigger
This commit allows multiple button to share the same `barcode_trigger`
attribute. Note that it only makes sense if a single button is displayed
at a time.

Task: 1831245
2018-06-11 16:18:18 +02:00
Christophe Simonis 2ab7ad8361 [MERGE] forward port branch saas-11.3 up to c00df14654 2018-06-07 11:43:07 +02:00
Adrien Dieudonne a30d9aa560 [FIX] barcodes: avoid virtual keyboard to show up while scanning barcode
(1) Before this commit, the input barcode was removed from the dom
after each scan but now we want to keep it focused to avoid to
automatically open the virtual keyboard in mobile.
This behavior will be useful in enterprise only.
Another commit will follow in this repository.

As the input is not removed anymore, we had to disable autocomplete
to hide previous entries as suggestions.

(2) We also add z-index property to avoid to click on the hidden input
located in the middle of the page.
2018-05-30 14:13:28 +02:00
Christophe Simonis f36e6917bd [MERGE] forward port branch saas-11.3 up to 37eed7c509 2018-05-29 17:34:43 +02:00
Adrien Dieudonne fa2ea4683e [FIX] barcodes: Android Odoo app webview not detected as chrome
Before this commit, it wasn't possible to use a barcode scanner
with the Odoo mobile app.
However it works fine for mobile Chrome browsers.

We now know that 'keypress' event doesn't work as expected in
Chrome for mobile. See @3a74afd21
It's why 'keydown' detection has been implemented.

We also want to use this detection in our Android app.
Unfortunately, 'window.chrome' doesn't seem to exist anymore
in the Android webview.

In this commit, we change the way Chrome is detected.
2018-04-30 16:14:46 +02:00
Adrien Dieudonne 9e14d93c05 [FIX] barcodes: keep vertical position while scanning
Before this commit, you were automatically redirected to the top of
the page when you scanned a product.
It was, therefore, difficult to find the product that had just been
scanned and to check its quantity.

Because of @3a74afd21 we need to put the focus in an invisible input
at the top of the page.

This input is now always vertically centered in the middle of the page.
2018-04-30 16:14:38 +02:00
Géry Debongnie 6d4eb69ef3 [FIX] barcodes: update tests to new notification service
The notification manager was removed and replaced by a notification
service.  Some tests were forward ported after this change, so they need
to be updated to the new system.
2018-04-20 10:36:18 +02:00
Arnold Moyaux a6e2830631 [FIX] barcode: do not trigger barcode on pending views
The check on the event target and the barcode target is done outside
the check on barcode found. That result in a warning for each modal/form
view that is pending.

This commit do the check before doing any operations in order
to directly stop if the event target is not similiar to listening
barcode target
2018-04-18 11:50:48 +02:00
Arnold Moyaux e5305ca8b7 [FIX] barcode: use the same process for quantity listener
The barcode scanner and the quantity listener do not use
the same proccess although they act for the same operation.
(For example the quantity listener trigger onchange server side
while the barcode scanner not if 'notifychange' key on the
active_barcode is set to False)

Since quantity listener is based on candidate we could directly
call the _barcodeSelectedCandidate method in order to have a common
behavior and code.
2018-04-18 11:50:48 +02:00
Adrien Dieudonne 3a74afd21e [FIX] barcodes: barcode scanning on Chrome mobile
Before this commit, the barcode value wasn't triggered on
some Android devices with Google Chrome and using the Odoo app.

In fact, the keypress event may not trigger with some devices.
This is probably due to the fact that this event is marked as
'Legacy'.
See: https://www.w3.org/TR/uievents/#legacy-keyboardevent-event-types

To fix this, we can use 'keydown' event but we have to handle an
other issue: there is no way to know which key is typed.
The auto-suggest feature on Android invalidate all the following
properties: Keycode, charCode, key, which, keyIdentifier, code.
This is a well-known issue:
https://bugs.chromium.org/p/chromium/issues/detail?id=118639

For more infos, please read this blog:
https://www.outsystems.com/blog/javascript-events-unmasked-how-to-create-input-mask-for-mobile.html

As a work around, we create a temporary input field that stores
the barcode value.
The focus is set on this input when a keydown is detected.
Note that when an input has the focus, the android virtual keyboard
will be opened. We can't avoid this behavior.
The only thing we can do is to automatically close it after 800 ms.
See: https://bugs.chromium.org/p/chromium/issues/detail?id=662386

As this fix is specific for Chrome only, it's not possible
to test it easily. Some tests will be added in master.
2018-03-20 16:21:20 +01:00
Adrien Dieudonne 5bc29744c9 [FIX] barcodes: skip undefined keys in barcode value
This fixes an issue occurring with Firefox.
Some events was buffered with an undefined value and it wasn't
possible to build the barcode value from these events.
See 'handle_buffered_keys' function.

So now, we simply skip this kind of event.
We consider this as 'special keys'.
2018-03-20 16:21:12 +01:00
Arnold Moyaux 98547bf0cd [FIX] barcodes: Do not trigger useless onchange server side.
This commit improve perf by not trigger onchange server
side on one2many field if the js could find a candidate.

opw-785425
2018-03-07 14:55:31 +01:00
Arnold Moyaux f95566f08a [FIX] barcode: set quantity with key press
Allow the user to set the quantity with barcode
scanning. This functionality was present in v9 but
didn't work in v11.

The code in order to make it work was already present in
_quantityListener however it makes a check on setQuantityWithKeypress
key on the obejct activeBarcode. Howver the key was never set during the
activeBarcode event.

This commit set the key on the activeBarcode if passed in the event data.
It also allow to trigger a barcode if the user is inside a modal.
2018-03-07 13:20:52 +01:00
Christophe Simonis f5e7b86686 [MERGE] forward port branch saas-16 up to 920aa6174c 2018-02-01 17:02:19 +01:00
Christophe Simonis 920aa6174c [MERGE] forward port branch saas-15 up to e0422bfd6c 2018-02-01 16:40:13 +01:00
Nicolas Martinelli 513fad42a0 [FIX] barcodes: delay between keys
In order to detect if a barcode scanner is being used, we detect the
delay between keypresses. The value is hardcoded to 55 ms. However, in
the case of a bluetooth scanner, this delay is often not enough,
resulting in an incorrect capture of the barcode.

We add the config parameter `barcode.max_time_between_keys_in_ms` which
allows the user to fine tune this delay for his hardware.

opw-806398
2018-01-31 13:47:17 +01:00
Géry Debongnie 0c98951f1c [FIX] barcodes: use patch to prevent interactions between tests
There is a subtle issue happening in tests when we override a widget
property for the duration of the test and try to restore the initial state at
the end by rewriting on the property.  It actually changes the widget, by
having a function bound to the sub widget prototype instead of its ancestor.
This in turns can cause weird interactions with the class system.

We introduced a proper way to temporarily patch a class/widget by adding
a method in testUtils to do exactly that.  This commit simply uses that
method to prevent unwanted interactions in barcode tests
2017-12-18 17:29:14 +01:00
Simon Lejeune 8fb25e185b [FIX] barcodes: manage several barcode widgets
related to rev 0d19ee989d

It was broken following the refactoring done in saas16, resulting in
barcodes being handled on all the displayed forms and it was problematic
in the case of a form dialog openned over a "fullscreen" form view.

This was particularily problematic for the scrap dialog in the
stock_barcode module.
2017-11-28 15:17:59 +01:00
Vandan Shah 4524d93be0 [IMP] barcodes: corrected barcode commands of CMD-PREV and CMD-NEXT as well as changed qunit test case accordingly 2017-09-29 16:42:30 +02:00
Pierre Masereel c493569866 [FIX] stock, barcodes: allow force detailed view of picking and rename barcode 'CANCEL' to 'DISCARD' 2017-09-27 09:21:17 +02:00
Xavier Morel f1a85ba70a [FIX] *: fix a bunch of incorrectly documented docstring
Fix a bunch of ill-documented/incomplete/incorrect method docs
Without this, the automatic doc generation does not work.
2017-09-18 11:54:39 +02:00
Christophe Simonis 4879ce0407 [MERGE] forward port branch saas-17 up to fe77df3ba4 2017-08-31 12:55:41 +02:00
Aaron Bohy dc07fc8bac [FIX] barcodes: tests: don't add undefined widget to registry
Resetting the key 'test_barcode_handler' to its value before the
test was technically the best solution, as a test should leave the
environment unchanged. However, in this case, the widget is
undefined (there is obviously no 'test_barcode_handler').
Whereas this should not be a problem (the fields in the registry
are supposed to be accessed using get(), and the presence of a
key mapping undefined is equivalent to the absence of the key in
this case), this breaks a test in Studio if the latter one is
executed after the barcode test. This is because Studio browses the
map of the field registry to access each field's prototype. When it
encounters an undefined value, it crashes.
2017-08-25 18:55:50 +02:00
Aaron Bohy 6df482eb99 [FIX] barcodes: barcode handlers should return a deferred
This was the case about 15minutes ago. But before pushing we
decided to change the Barcode override of FormController to
directly use handlers of the FormController when it could (e.g.
to handle 'Edit', 'Discard' actions). This wasn't a good idea as
those handlers don't return anything, and the barcode mechanism
requires its handlers to return a deferred. So basically, it
crashed when such a barcode was scanned. Having a test suite is
nice, but you should not forget to relaunch it before pushing...
2017-08-25 16:13:57 +02:00
Aaron Bohy 802dde31f3 [FIX] web,barcodes: pager: FIRST and LAST actions
The barcode mechanism is supposed to handle commands PAGER-FIRST
(go to first record referenced in the pager) and PAGER-LAST (go
to last record). Before this rev., it wasn't the case.

We needed to add an option 'notifyChange' to the updateState
function of the pager, to ensure that the form is correctly
reloaded when the pager cursor is manually set (by the barcode
handler) on the first or last element.
2017-08-25 15:54:56 +02:00
Aaron Bohy 8019eacb47 [FIX] barcodes: generate correct update command
The barcode mechanism is optimized to (in certain conditions),
directly increment the quantity of a numerical field inside an
x2many, without performing any RPC, and then re-rendering the
x2many to display the new value.

Before this rev., it seemed to work fine, but when the view was
saved, those changes of quantity were lost. This was because the
changes weren't correctly notified to the model (the quantity
field being inside an x2many, the correct update command for the
x2many should be generated).
2017-08-25 15:54:56 +02:00
Aaron Bohy 5f40f21adc [FIX] barcodes: barcode_handler widget should be generic
When a barcode field with widget="barcode_handler" is in a form
view, an onchange RPC should be done each time a barcode is
scanned.

Before this rev., it worked by chance because the views using it
don't define a 'pack_operation_product_ids' field.

Anyway, this widget is meant to be generic, so it shouldn't
hardcode a fieldname.
2017-08-25 15:54:56 +02:00
Aaron Bohy c73233d248 [FIX] barcodes: don't warn if action unavailable
Before this rev. a warning was displayed when a barcode mapping an
invisible button was scanned. It shouldn't, for the following
reason. In the stock.picking form view, two buttons with
barcode_trigger='validate' are in the page ('Start Inventory' and
'Validate'), and there is always at least one of them that is
invisible. So when scanning the 'validate' barcode, we don't want
a warning to be displayed, as there is potentially another button
that is able to handle the request.
2017-08-25 15:54:56 +02:00
Aaron Bohy dec1bdb44d [FIX] barcodes: don't redraw form twice
When scanning a command barcode, the view shouldn't be redrawn
after the operation corresponding to the command is executed,
for two reasons: first, it is useless as the view has already
been reloaded, and second, it may cause issues if it has been
destroyed meanwhile.

For example, when scanning barcode O-CMD.MAIN-MENU from a
picking form view: a do_action is performed to go back to the
main barcode client action (so the current form view is destroyed),
but an handler tried to redrawn the destroyed form view, which
produced a crash because the session was required by Date fields,
and it couldn't be provided (there were no more parent listening
to provide it).
2017-08-25 15:54:56 +02:00
Aaron Bohy 3d5b283675 [FIX] barcodes: don't trigger onchange at each keypress
When a keypress event is triggered in a 'field_float_scannable'
widget, the event is first catched by the barcodes mechanism, and
then manually re-triggered. However, the way it was done implied
that the environment was notified of each keypress event, so if
there was an onchange on that particular field, an onchange RPC
was done at each keypress.

Moreover, the focus was lost at each keypress as well.
2017-08-25 15:54:56 +02:00
Martin Geubelle 5b968ad371 [FIX] web, barcodes: restore disableAutofocus option
This option has been removed with the new views but was used in barcode.

The form renderer was also dealing with some part of the autofocus
but this should only be handled by the controller.

The logic is now only in the controller and a test case has been added.
2017-08-25 15:54:56 +02:00
Akash Bhavsar b131e9b0ef [FIX] barcodes: fix several issues when scanning barcodes
Since the new views, most of the barcodes feature was
broken. This commit re-enables the support of commands like
'edit', 'save', 'cancel', 'previous' and 'next'.

Also changed javascript event handler to jquery event handler to
make barcodes testable in phantomjs.
2017-08-25 15:54:56 +02:00
qsm-odoo 5f1ef0910b [IMP] web, *: lazy load dialog xml template
* web_editor, web_planner, website

The 'Dialog' class is used in both backend and frontend. Also, lots of
actions can be done without the use of any modal. It thus makes sense
to lazy load its related xml only when a first modal is opened.

This change also allows to get rid of the "base_common.xml" file as the
dialog template is the only remaining one in there and, in the future
website update, it will allow to not load any static XML file on website
page loadings.
2017-07-24 14:28:35 +02:00
Christophe Simonis 34b432d528 [MERGE] forward port branch saas-15 up to 4d79a1ff58 2017-06-26 19:19:39 +02:00
Christophe Simonis 04d5da90e1 [MERGE] forward port branch saas-11 up to 1f73105ddd 2017-06-19 17:08:57 +02:00
Christophe Simonis 1f73105ddd [MERGE] forward port branch 9.0 up to 7606b60420 2017-06-19 15:44:49 +02:00
Lucas Perais (lpe) bf5312428f [FIX] barcodes: comply the ean parser with reportlab.graphics.barcode
Before this commit, the JS parser would add 0 after the input, then add the ean key.
Whereas reportlab.graphics.barcode fills the input with 0's on the left, then add the key

http://pydoc.net/Python/reportlab/2.5/reportlab.graphics.barcode.eanbc/
At: Ean13BarcodeWidget.__init__()

This commit makes the ean parser coherent with the lib the python uses
2017-06-16 08:41:58 +02:00
Christophe Matthieu cc141dcce1 [FIX] barcode: Avoid making requests to onchange method on each scan
Usecase: A person scans various products in a warehouse or the network is slow.
Only one request per product must be made, the rest is changing the number locally
and all performed scans (products or actions) must not be lost.
The mutex ensures that the scan is performed in the correct order.
2017-05-11 12:57:44 +02:00
qsm-odoo 250e716c3a [REF] web, *: restore views design
Since the new views merge, a lot of design elements were broken. This
was particularly impacting the fields in the editable list view; indeed
the editable list view is not using an inline form view anymore so the
fields in the list were not properly styled as the LESS was still
defined assuming the form view environment (for example the invalid
fields were red for o2m fields in form view but not in editable list
view even though they got the right CSS class).

This commit refactor the LESS following these rules:
- No more division of non-layout and layout rules. Dividing LESS rules
  in x_layout.less and x.less was a mistake. Many rules can be
  considered to be layout and not layout at the same time, developers
  always have to switch from one file part to the other, many CSS
  selectors (and rules!) are duplicated for nothing, ...
- Field style is extracted from x_view.less and put in the new
  fields.less file. As before, the fields_extra.less will contain the
  rules specific to community so that the enterprise repo can override
  those by replacing the whole file.
- Many classes have been renamed so that o_form_x_y becomes o_x_y as
  many classes can now be applied outside of form view. These classes
  should not be used in templates anyway.

The commit also changes the DOM of fields so that it is more minimalist
(no useless parent div, etc).

Input elements are not automatically styled anymore, they have to get
the o_input class explicitely. This allows to fix lots of small style
bugs of previous versions (required monetary field had not the proper
style, readonly m2m tags appeared as editable, ...). This also improves
the LESS code.

The editable list view should also completely stop flickering on chrome
and firefox.

The commit also removes the orange outline on list view dirty cells.

The commit also removes deprecated static xml, LESS and other code.

Notice there are still styles to restore/fix and LESS to improve.
2017-05-04 12:07:30 +02:00
Christophe Matthieu 0c4e69e803 [IMP] barcode: add some javascript docstring 2017-04-25 16:36:20 +02:00