[FIX]barcode interface: also reconnect scanner when dialog is closed
bzr revid: csn@openerp.com-20140430081033-quuudobu7g1516ar
This commit is contained in:
parent
40549064c6
commit
7c6c5f281f
|
@ -196,12 +196,19 @@ function openerp_picking_widgets(instance){
|
||||||
var lot_name = false;
|
var lot_name = false;
|
||||||
self.$('.js_lot_scan').val('');
|
self.$('.js_lot_scan').val('');
|
||||||
var $lot_modal = self.$el.siblings('#js_LotChooseModal');
|
var $lot_modal = self.$el.siblings('#js_LotChooseModal');
|
||||||
|
//disconnect scanner to prevent scanning a product in the back while dialog is open
|
||||||
self.getParent().barcode_scanner.disconnect();
|
self.getParent().barcode_scanner.disconnect();
|
||||||
$lot_modal.modal()
|
$lot_modal.modal()
|
||||||
//focus input
|
//focus input
|
||||||
$lot_modal.on('shown.bs.modal', function(){
|
$lot_modal.on('shown.bs.modal', function(){
|
||||||
self.$('.js_lot_scan').focus();
|
self.$('.js_lot_scan').focus();
|
||||||
})
|
})
|
||||||
|
//reactivate scanner when dialog close
|
||||||
|
$lot_modal.on('hidden.bs.modal', function(){
|
||||||
|
self.getParent().barcode_scanner.connect(function(ean){
|
||||||
|
self.getParent().scan(ean);
|
||||||
|
});
|
||||||
|
})
|
||||||
self.$('.js_lot_scan').focus();
|
self.$('.js_lot_scan').focus();
|
||||||
//button action
|
//button action
|
||||||
self.$('.js_validate_lot').click(function(){
|
self.$('.js_validate_lot').click(function(){
|
||||||
|
@ -210,10 +217,12 @@ function openerp_picking_widgets(instance){
|
||||||
if (name.length !== 0){
|
if (name.length !== 0){
|
||||||
lot_name = name;
|
lot_name = name;
|
||||||
}
|
}
|
||||||
|
$lot_modal.modal('hide');
|
||||||
|
//we need this here since it is not sure the hide event
|
||||||
|
//will be catch because we refresh the view after the create_lot call
|
||||||
self.getParent().barcode_scanner.connect(function(ean){
|
self.getParent().barcode_scanner.connect(function(ean){
|
||||||
self.getParent().scan(ean);
|
self.getParent().scan(ean);
|
||||||
});
|
});
|
||||||
$lot_modal.modal('hide');
|
|
||||||
self.getParent().create_lot(op_id, lot_name);
|
self.getParent().create_lot(op_id, lot_name);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue