Commit Graph
45 Commits
Author SHA1 Message Date
Christophe Simonis 784eaf28dc [MERGE] forward port branch 9.0 up to 6647e1f 2016-09-15 16:45:13 +02:00
Simon Lejeune 6647e1f8a9 [FIX] barcodes: correctly unbind quantity event listener
The quantity event handler is not correctly unbound when its action
is deleted, resulting in multiple window.prompt asking the quantity
of the products if you go mulitple times trough a view when a widget
implementing the barcode thing is used.

There seems to be a bug in the framework ("barcode_scanned" events
are registered the same way than the "keypress" one on core.bus
but they don't have suffer from the same issue).
2016-09-15 16:20:18 +02:00
Simon Lejeune dbe90c2661 [FIX] stock_barcode: correctly check when to execute "O-BTN"
It's possible to trigger click on form view's button with the help
of the "barcode_trigger" attributes. However, we don't want to be
able to execute clicks on items that aren't clickable by the user.
That's why we wrote the following condition: if the elem is visible
OR is a child of a .dropdown-menu, we trigger the click.

The second condition was always true since we used the jquery's
parent function which return an empty list when no result, and
an empty list is truthy.
2016-08-16 18:28:23 +02:00
Joren Van Onder c902437247 [FIX] barcodes: allow users to 'click' focused buttons with Return
Return key events don't get redispatched and even if they did, it
wouldn't work because 'fake' keypress events don't trigger native HTML
event handlers.

This should be safe because Return cannot start a valid barcode.
2016-07-13 13:58:50 +02:00
Nicolas Martinelli 0d19ee989d [FIX] barcodes: manage several barcode widgets
In some cases, several barcode widgets can be found on the same page.
This is for example the case of the stock picking: there is a widget on
the `stock.picking` model (main view) itself, and a widget on the
`stock.pack.operation` model (modal view).

In this case, when the focus is not set directly on the field which
needs to be filled in, both widgets will trigger a `barcode_scanned`
scanned event. This will call the `on_barcode_scanned` Python method
which can lead to errors/warning. For example, the `on_barcode_scanned`
method on the `stock.picking` model raises a warning in case the barcode
scanned does not match any product/package.

The fix is to make sure that the event target is located in the correct
DOM element.

opw-677506
2016-06-15 15:11:41 +02:00
Joren Van Onder 28a9336ac8 [FIX] barcodes: also allow barcodes triggering buttons in dropdowns
On smaller screens some buttons will be hidden. An example of this is
the 'Validate' button in the stock.picking form view. It is not :visible
but it should still be possible to trigger through scanning a
'O-BTN.validate' barcode.

opw-676741
2016-05-10 12:59:37 +02:00
Joren Van Onder fe76e6bc36 [FIX] barcodes: first qualify the quantity event before handling it
Introduced by 5bb64d40d0. Before doing
anything we should first ensure that the quantity keypress event targets
body (and that it is a number, but that's less important). Before this
we didn't do that and thus the _display_no_edit_mode_warning was given
when people where just typing in the associated thread of a picking.

opw-672350
2016-03-18 13:11:25 +01:00
Joren Van Onder 5bb64d40d0 [IMP] barcodes: allow immediate quantity input after scanning
When scanning items with a device like the Symbol MC3200 you are
presented with the Kanban view because of it's limited resolution.

In this view it is not possible to quickly set the quantity of scanned
products. Ideally users just want to scan the barcode, input the
quantity and repeat without having to click on virtual buttons on the
usually less than ideal touchscreen.

This implements a way for users to immediately start typing numbers
representing a quantity after scanning a barcode. The quantity will be
set on the specified m2x_field.quantity_field of the record associated
to the last scanned barcode. Because KanbanRecords are not editable
without opening a new view window.prompt is used. It will create an easy
to use native dialog of whatever device is being used. It also avoids us
having to implement a custom input field which would have to handle
keypress events like numbers, backspace, delete, etc.
2016-03-17 09:39:18 +01:00
Joren Van Onder c6fc91b318 [IMP] stock, barcodes: make barcode operations more mobile friendly
We want to properly support devices like the Symbol MC3200. This is a
handheld computer running a modern operating system like Android or
Windows with an integrated barcode scanner. After installation of a
modern web browser and configuration of the integrated barcode scanner
Odoo works as well as it does anywhere else.

The main issue with these types of devices is that the displays (and
their resolution) are very small (3" @ 320x320 for Symbol
MC3200). Because of this a lot of tree views become awkward to use
because they require vertical scrolling. A Kanban view however scales
nicely on these displays.

This implements Kanban views for both the picking.form view and the
stock.inventory form view because those are the views typically used
when using a barcode scanner.

Doing this alone is not enough, because the barcodes module does not
work with Kanban views. Small changes where made to
barcodes.FormViewBarcodeHandler to make it work with both List views and
Kanban views.
2016-03-17 09:39:18 +01:00
Arthur Maniet 1b9baf1ac2 [FIX] barcode: value representation for scannable field float
The value was stored as a string when it should have been a float.

opw-665376
2016-01-04 13:58:13 +01:00
Arthur Maniet 769e58d186 [FIX] barcodes: don't require suffix for scans
Users don't have to configure their scanner. As stated in the docs/planner,
either wait 50ms between 2 scans or use a suffix.
2015-09-15 13:22:16 +02:00
Arthur Maniet c4f8deecc0 [FIX] barcodes: dumb typo 2015-09-11 13:14:45 +02:00
Arthur Maniet d0423b5e5c [IMP] barcodes: form views action barcodes
Make all common form operations doable through barcode scanning
2015-09-11 12:04:13 +02:00
Arthur Maniet 5b96b4349e [IMP] barcodes: form view barcode handler 'pre_onchange_hook' mechanism
Since the method must return a deferred, resolve it with true to proceed with onchange
and with false to prevent the onchange. Deferred failure is not an option.
2015-09-11 12:04:13 +02:00
Arthur Maniet cdb30b507a [ADD] stock_barcode: field widget with barcodes scan + manual input
Barcodes are detected by catching keypresses. When a keypress is not
part of a barcode, it is 'released' by forging a keypress event.
For security reasons, a non-native keypress doesn't trigger the native
input mechanism. So in order to make both barcode-scanning and manual
keypresses work in a field, it is necessary to have a handler listen
to the 'false' keypresses and simulate the native input behaviour.
2015-09-03 11:23:38 +02:00
Arthur Maniet 27e237346d [IMP] barcodes: BarcodeEvents uses reserved barcodes prefixes
Export a list of barcodes prefixes used for software functionss
2015-09-03 11:11:56 +02:00
Arthur Maniet 17e2526667 [FIX] barcodes: use _.bind instead of function.bind because IE 2015-09-01 13:26:03 +02:00
Arthur Maniet 121556dcea [ADD] barcodes/web: element button can use attribute barcode_trigger
A button can be triggered when a barcode corresponding to its attribute
'barcode_trigger' is scanned
2015-09-01 13:26:02 +02:00
Arthur Maniet 670d759dbf [ADD] barcodes: BarcodeHandlerMixin that starts/stops the event handling
Only the barcode handlers in the front view should listen to barcode events.
2015-09-01 13:26:02 +02:00
Arthur Maniet 2df4060c77 [ADD] barcodes: onchange-like mechanism to react to scans in form view
For a model to use it, it must :
- Inherit barcodes.barcode_events_mixin and override on_barcode_scanned(self, barcode)
- Add <field name=barcode_scanned widget=barcode_handler/> to each form view that
  should listen to barcode events and trigger on_barcode_scanned.

The method on_barcode_scanned works just like an onchange.
2015-09-01 13:25:52 +02:00
Arthur Maniet 77878da066 [FIX] barcodes: key repeat prevention was mistakenly activated
TIL: The $(callback) function passes the jquery object to the callback
2015-08-05 12:45:02 +02:00
Arthur Maniet 581aba9fdb [FIX/REF] barcodes: don't catch keypress if a control key is pressed
This avoids breaking shortcuts on Firefox, which rely on keypress
events instead of keydown / keyup. The tradeoff is that a barcode
cannot be scanned and interpreted if ctrl, alt or cmd is pressed.
Also don't catch function keys.
2015-07-30 07:55:53 +02:00
Arthur Maniet 68ad51b6a9 [FIX] barcodes: style 2015-07-30 07:55:53 +02:00
Arthur Maniet 03534c5bef [IMP] barcodes: use a regexp to match a barcode 2015-07-30 07:55:53 +02:00
Arthur Maniet 0ed6a7dd18 [IMP] barcodes: use a known terminal char to stops buffering keys
BarcodeEvents uses the fact that a barcode usually ends with \n, \r or
\t - and never contains it - to stop buffing keys as soon as such a
character is inputted instead of waiting x milliseconds.
2015-07-30 07:55:53 +02:00
Arthur Maniet 47262c8587 [REF] barcodes: make key repeat prevention optional
This functionality was an attemps to fix the chair-to-keyboard
interface in the PoS. Since it is not a standard behaviour, it
must be explicitly requested.
2015-07-30 07:55:52 +02:00
Arthur Maniet 5b01eca5e4 [FIX] barcodes: BarcodeEvents handler binding and unbinding
In order to remove an eventhandler, removeEventListener must receive
the same function reference that was passed to addEventListener. So
the handlers references are kept as attributes of the class.
2015-07-30 07:55:52 +02:00
Arthur Maniet f45904f581 [REF] web: move barcode_events to module barcodes
If the module barcodes is installed, a BarcodeEvents singleton is
automatically instanciated. It listens to keypresses and, when a
sequence of keys represents a barcode, it broadcasts a 'barcode_scanned'
event on core.bus containing the barcode string.
2015-07-30 07:55:45 +02:00
Christophe Simonis 2cf91d16a5 [MERGE] forward port of branch saas-6 up to 63e92cb 2015-07-22 16:17:54 +02:00
Christophe Matthieu 500c33b184 [IMP] web: split model.js into model.js and data_model.js. Web js modules must call web.DataModel. 2015-07-10 16:32:35 +02:00
Joren Van Onder 80da43ebb8 [FIX] barcode_parser: don't match end of line
Causes issues with the card reader device.
2015-07-02 16:42:35 +02:00
Frédéric van der Essen 50c147514e [FIX] barcodes: correctly recompute the checksum of the product barcode when guessing it from a value encoding barcode 2015-06-29 15:43:15 +02:00
Christophe Simonis fe2b5f35a4 [MERGE] forward port of branch saas-6 up to bf1e999 2015-05-28 14:27:38 +02:00
Frédéric van der Essen 00236aafcc [FIX] point_of_sale: barcode patterns must match barcode as prefix, (and not anywhere in barcode) 2015-05-05 14:04:39 +02:00
Géry Debongnie 4fdf74fe21 [IMP] web+addons: improvement to module system
The module system needs to know the dependencies of a given module
before executing the function.  This is why the dependencies were
defined once in an array, and then were described one more times in the
call to require.

But a trick can simplify this: the boot function can parse the string
representation of the module and extract the calls to require from it.
It is more work for the processor, but it leads to simpler module
definitions.
2015-03-18 09:23:37 +01:00
Géry Debongnie 0dcc559cdd [REF] barcodes: update to the new module system 2015-03-18 09:01:51 +01:00
Frédéric van der Essen 3c5f62413e [FIX] barcodes: typo in function name 2015-01-28 17:01:27 +01:00
Frédéric van der Essen 59b0907d2e [IMP] barcodes, point_of_sale : add support for UPC-A barcodes
- Added support for UPC-A Barcodes
 - Add a way to automatically convert UPC-A to and from EAN13. This
   is usefull if you wish to standardise your product barcode encoding
   in one standard but have a mix of the two in your merchandise.
 - Various bugfixes.
2015-01-13 16:19:39 +01:00
Aaron Bohy dbcc93154f [FIX] barcodes: parse_barcode functions in PY and JS commented 2014-11-26 12:11:55 +01:00
Aaron Bohy b671824048 [FIX] barcodes, stock, point_of_sale: parse_barcode function uses regex, pattern and barcodes may now contain special characters \ { and ., special character * replaced by . 2014-11-26 12:11:51 +01:00
Aaron Bohy aae9dfe4e7 [FIX] barcodes: prepend a zero to ean13 barcodes scanned before looking for a match 2014-11-26 12:06:23 +01:00
Aaron Bohy 84c743dd40 [FIX] barcodes,point_of_sale,stock,base: minor changes from code review 2014-11-26 12:06:21 +01:00
Aaron Bohy 956faa62f7 [FIX] barcodes, point_of_sale: JS functions for parsing barcode moved to module barcodes, BarcodeParser 2014-11-26 12:06:20 +01:00
Aaron Bohy 74b1746ba7 [FIX]: stock: weighted type of patterns added in stock 2014-11-26 12:06:19 +01:00
Aaron Bohy c72674a01e [IMP] barcodes,point_of_sale : parse_code js function moved to barcodes module 2014-11-26 12:06:19 +01:00