From 03da57c1ec2dfaa2f5ad43aabb9a95fcff904d30 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Fri, 21 Mar 2014 17:21:32 +0100 Subject: [PATCH] [WIP]barcode interface: disable button process and put in pack if nothing to do bzr revid: csn@openerp.com-20140321162132-8otpcybk2gdrc7u7 --- addons/stock/static/src/js/widgets.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/addons/stock/static/src/js/widgets.js b/addons/stock/static/src/js/widgets.js index 001220779d5..624e0a82adf 100644 --- a/addons/stock/static/src/js/widgets.js +++ b/addons/stock/static/src/js/widgets.js @@ -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