How great is it to get Odoo (almost) 9.0 (almost) translated?
Clean .tx/config file
Regenerate .pot files
Fetch current translations from Transifex (10% completion)
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.
Now that most refactoring has been merged
It is better to have red a great work of another culture in translation than never to have read it at all.
― Henry Gratton Doyle
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.
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.
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.
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.
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.
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.
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.
This new module integrate the 'Mercury Pay' electronic payment
provider with the point of sale.
This commit is the end result of a large branch whose main
author is Joren Van Onder <jov@odoo.com>, with additional
contributions from Martin Donies <mdo@odoo.com> and Frederic van
der Essen <fva@odoo.com>