[WIP]barcode interface: disable button process and put in pack if nothing to do

bzr revid: csn@openerp.com-20140321162132-8otpcybk2gdrc7u7
This commit is contained in:
Cedric Snauwaert 2014-03-21 17:21:32 +01:00
parent c780e41803
commit 03da57c1ec
1 changed files with 23 additions and 0 deletions

View File

@ -122,6 +122,7 @@ function openerp_picking_widgets(instance){
renderElement: function(){
var self = this;
this._super();
this.check_content_screen();
this.$('.js_pick_done').click(function(){ self.getParent().done(); });
this.$('.js_pick_print').click(function(){ self.getParent().print_picking(); });
this.$('.oe_pick_app_header').text(self.get_header());
@ -267,6 +268,28 @@ function openerp_picking_widgets(instance){
this.$('.js_loc').removeClass('info');
this.$('.js_pack_op_line'+processed+'.hidden').removeClass('hidden');
}
this.check_content_screen();
},
check_content_screen: function(){
//get all visible element and if none has positive qty, disable put in pack and process button
//TODO process should be clickable if we have a container visible at screen and not processed
var self = this;
var qties = this.$('.js_pack_op_line:not(.processed):not(.hidden) .js_qty').map(function(){return $(this).attr('placeholder')});
var disabled = true;
$.each(qties,function(index, value){
if (parseInt(value)>0){
disabled = false;
}
});
if (disabled){
self.$('.js_drop_down').addClass('disabled');
self.$('.js_pick_pack').addClass('disabled');
}
else{
self.$('.js_drop_down').removeClass('disabled');
self.$('.js_pick_pack').removeClass('disabled');
}
},
get_current_op_selection: function(ignore_container){
//get ids of visible on the screen