[IMP] Bar code scanning check if packing or lot needed, should work through has_group instead of settings

bzr revid: jco@openerp.com-20140430121241-wo78a9odt4bamru2
This commit is contained in:
Josse Colpaert 2014-04-30 14:12:41 +02:00
parent 63986a8d02
commit bd88fcd759
1 changed files with 2 additions and 14 deletions

View File

@ -720,23 +720,11 @@ class stock_picking(osv.osv):
def check_group_lot(self, cr, uid, context=None): def check_group_lot(self, cr, uid, context=None):
""" This function will return true if we have the setting to use lots activated. """ """ This function will return true if we have the setting to use lots activated. """
settings_obj = self.pool.get('stock.config.settings') return self.pool.get('res.users').has_group(cr, uid, 'stock.group_production_lot')
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)
return stock_settings.group_stock_production_lot
def check_group_pack(self, cr, uid, context=None): def check_group_pack(self, cr, uid, context=None):
""" This function will return true if we have the setting to use package activated. """ """ This function will return true if we have the setting to use package activated. """
settings_obj = self.pool.get('stock.config.settings') return self.pool.get('res.users').has_group(cr, uid, 'stock.group_tracking_lot')
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)
return stock_settings.group_stock_tracking_lot
def action_assign_owner(self, cr, uid, ids, context=None): def action_assign_owner(self, cr, uid, ids, context=None):
for picking in self.browse(cr, uid, ids, context=context): for picking in self.browse(cr, uid, ids, context=context):