[FIX]barcode interface: hide put in pack button if option is not selected in settings

bzr revid: csn@openerp.com-20140331094020-fvbmj0a0dac1v5ou
This commit is contained in:
Cedric Snauwaert 2014-03-31 11:40:20 +02:00
parent 8c7a9fa0ae
commit 815d984bad
2 changed files with 30 additions and 1 deletions

View File

@ -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');
}

View File

@ -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]