summaryrefslogtreecommitdiff
path: root/addons/barcodes/static/src/js/form_view_barcode_handler.js
AgeCommit message (Collapse)Author
2017-04-11[REF] barcode, *: update code to new JS frameworkChristophe Matthieu
With the new views, the barcode mechanisms were completely broken, because the view and widget JS code was totally changed. This commit update and refactor all that code to make it work with the new design philosophy. Also, it update the coding style.
2017-04-11[REF] web,*: remove 'web.model' and 'web.dataModelGéry Debongnie
Use this.rpc instead of Model object, with web.ajax if necessary. nb: EventDispatcherMixin include now the custom_events managment instead of widget
2017-04-11[FIX] web, barcodes: attrs processing in kanbanqsm-odoo
Commit cef659783514f8935cc46a496f71063d022e8dac changed the way domains are computed but forgot to change the values representation used by the Kanban view. This commit fixes that and adds tests to make sure it does not happen again.
2017-04-11[REF] web, *: redesign all JS viewsGéry Debongnie
This commit introduce a full redesign of all JS views. We started basically from scratch. The goal was to unify all the various views under a common framework, to make them testable, to make then usable in different conditions (in studio, or in the frontend), and to make our lives easier. Some important points are: - we introduced new coding guidelines (camelCase, 80 chars width, ...) - we have a brand new testing framework (still QUnit based) - kanban view moved to the web addon - calendar view (formerly web_calender) moved to web as well - the tree view was removed - all new code should be documented We hope that this code is the start of a new era for the Odoo web client, we want to have a high quality codebase, well documented, well tested, well designed. Work done by the framework team: mostly aab, ged, chm, dmo, qsm
2017-01-10[MERGE] forward port branch saas-11 up to f1583504cebChristophe Simonis
2017-01-09[FIX] barcodes: form view barcode handler: concurrencySimon Lejeune
Suppose the following usecase: you scan the first product of the picking. A server onchange is then triggered. You scan the same product a second time, before the first onchange has returned. You expect that the first onchange is completely executed before running the second one. This was not the case. Moreover, some onchanges were not be able to work with the invalid state of the formview at some times, and crashed. The previous implementation was wrong because id didn't run the main barcode processing mechanism inside a Mutex. It was also wrong because it didn't correctly wait for the onchange to execute (a previous barcode onchanges or some classic ones) before setting the barcode field.
2016-10-19[FIX] barcodes: _set_quantity_listenerPierre Masereel
Before, the '_set_quantity_listener' function was opening a 'window.prompt' which had different comportment depending the navigator. For example, the focus was not allways on the input field, the enter key 'Cancel' the prompt or 'validate' it. So to improve the usability and the consistancy we used a dialog instead a prompt, to manage the focus and the 'Enter' key pressed when we want to set a quantity.
2016-10-14[FIX] barcodes: set_quantity traceback on mobilePierre Masereel
When we are trying to set the quantity on a mobile device, we get a traceback saying that we cannot call the 'find' function on the elements returned by '_get_records'. This '_get_records' function returns a 'Collection' when called on a tree view and an 'Array' when called on a kanban view. When we are working on a mobile device, most of the one2many are displayed as kanban. The thing is when we work with the object returned by '_get_records' we call a 'find' method on it, which is implemented by Odoo's Collection class. So when we call 'find' on an 'Array' we actually call 'Array.prototype.find' which is implemented on most desktop browser and on some mobile browser [1]. This is what caused the traceback on Chrome in Android. To fix this issue, we enforce '_get_records' to always return an 'Array' and we ensure that, when working on this 'Array', we use '_.find'. [1] https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find
2016-09-15[FIX] barcodes: correctly unbind quantity event listenerSimon Lejeune
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-03-18[FIX] barcodes: first qualify the quantity event before handling itJoren Van Onder
Introduced by 5bb64d40d0b94b252c2e29e6a050ae37fbd87b0f. 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-17[IMP] barcodes: allow immediate quantity input after scanningJoren Van Onder
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[IMP] stock, barcodes: make barcode operations more mobile friendlyJoren Van Onder
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.
2015-09-11[FIX] barcodes: dumb typoArthur Maniet
2015-09-11[IMP] barcodes: form views action barcodesArthur Maniet
Make all common form operations doable through barcode scanning
2015-09-11[IMP] barcodes: form view barcode handler 'pre_onchange_hook' mechanismArthur Maniet
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-03[IMP] barcodes: BarcodeEvents uses reserved barcodes prefixesArthur Maniet
Export a list of barcodes prefixes used for software functionss
2015-09-01[ADD] barcodes: BarcodeHandlerMixin that starts/stops the event handlingArthur Maniet
Only the barcode handlers in the front view should listen to barcode events.
2015-09-01[ADD] barcodes: onchange-like mechanism to react to scans in form viewArthur Maniet
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.