diff --git a/addons/stock/static/src/js/widgets.js b/addons/stock/static/src/js/widgets.js index 8bb36bd3e42..56503cbadbc 100644 --- a/addons/stock/static/src/js/widgets.js +++ b/addons/stock/static/src/js/widgets.js @@ -608,6 +608,13 @@ function openerp_picking_widgets(instance){ self.locations = locations; }); }); + }).then(function(){ + return new instance.web.Model('stock.picking').call('check_group_pack').then(function(result){ + console.log('show pack:' + result); + return self.show_pack = result; + + }); + }).then(function(){ if (self.picking.pack_operation_exist === false){ self.picking.recompute_pack_op = false; @@ -678,6 +685,10 @@ function openerp_picking_widgets(instance){ else { self.$('.js_reload_op').addClass('hidden'); } + if (!self.show_pack){ + console.log('hide pack button start'); + self.$('.js_pick_pack').addClass('hidden'); + } }).fail(function(error) {console.log(error);}); @@ -698,7 +709,10 @@ function openerp_picking_widgets(instance){ .then(function(){ self.picking_editor.remove_blink(); self.picking_editor.renderElement(); - + if (!self.show_pack){ + console.log('hide pack button refresh'); + self.$('.js_pick_pack').addClass('hidden'); + } if (self.picking.recompute_pack_op){ self.$('.js_reload_op').removeClass('hidden'); } diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 546c71eb211..8fa4c5d19d1 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -731,6 +731,21 @@ class stock_picking(osv.osv): continue return res + def check_group_pack(self, cr, uid, context=None): + """ + This function will return true if we have the setting to use package activated + """ + settings_obj = self.pool.get('stock.config.settings') + config_ids = settings_obj.search(cr, uid, [], limit=1, order='id DESC', context=context) + #If we don't have updated config until now, all fields are by default false and so should be not dipslayed + if not config_ids: + return False + + stock_settings = settings_obj.browse(cr, uid, config_ids[0], context=context) + if stock_settings.group_stock_tracking_lot: + return True + return False + def action_assign_owner(self, cr, uid, ids, context=None): for picking in self.browse(cr, uid, ids, context=context): packop_ids = [op.id for op in picking.pack_operation_ids]