[FIX] stock: mute orm logger before checking access rules
bzr revid: chs@openerp.com-20131108224724-3u72ec3molct34he
This commit is contained in:
+14
-7
@@ -1722,7 +1722,8 @@ class stock_move(osv.osv):
|
||||
if location_xml_id:
|
||||
try:
|
||||
location_model, location_id = mod_obj.get_object_reference(cr, uid, 'stock', location_xml_id)
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
|
||||
with tools.mute_logger('openerp.osv.orm'):
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
|
||||
except (orm.except_orm, ValueError):
|
||||
location_id = False
|
||||
|
||||
@@ -1756,7 +1757,8 @@ class stock_move(osv.osv):
|
||||
if location_xml_id:
|
||||
try:
|
||||
location_model, location_id = mod_obj.get_object_reference(cr, uid, 'stock', location_xml_id)
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
|
||||
with tools.mute_logger('openerp.osv.orm'):
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
|
||||
except (orm.except_orm, ValueError):
|
||||
location_id = False
|
||||
|
||||
@@ -1980,12 +1982,14 @@ class stock_move(osv.osv):
|
||||
location_dest_id = 'stock_location_customers'
|
||||
try:
|
||||
source_location = mod_obj.get_object_reference(cr, uid, 'stock', location_source_id)
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [source_location[1]], 'read', context=context)
|
||||
with tools.mute_logger('openerp.osv.orm'):
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [source_location[1]], 'read', context=context)
|
||||
except (orm.except_orm, ValueError):
|
||||
source_location = False
|
||||
try:
|
||||
dest_location = mod_obj.get_object_reference(cr, uid, 'stock', location_dest_id)
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [dest_location[1]], 'read', context=context)
|
||||
with tools.mute_logger('openerp.osv.orm'):
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [dest_location[1]], 'read', context=context)
|
||||
except (orm.except_orm, ValueError):
|
||||
dest_location = False
|
||||
return {'value':{'location_id': source_location and source_location[1] or False, 'location_dest_id': dest_location and dest_location[1] or False}}
|
||||
@@ -2931,7 +2935,8 @@ class stock_inventory_line(osv.osv):
|
||||
def _default_stock_location(self, cr, uid, context=None):
|
||||
try:
|
||||
location_model, location_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'stock_location_stock')
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
|
||||
with tools.mute_logger('openerp.osv.orm'):
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
|
||||
except (orm.except_orm, ValueError):
|
||||
location_id = False
|
||||
return location_id
|
||||
@@ -2975,7 +2980,8 @@ class stock_warehouse(osv.osv):
|
||||
def _default_lot_input_stock_id(self, cr, uid, context=None):
|
||||
try:
|
||||
lot_input_stock_model, lot_input_stock_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'stock_location_stock')
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [lot_input_stock_id], 'read', context=context)
|
||||
with tools.mute_logger('openerp.osv.orm'):
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [lot_input_stock_id], 'read', context=context)
|
||||
except (ValueError, orm.except_orm):
|
||||
# the user does not have read access on the location or it does not exists
|
||||
lot_input_stock_id = False
|
||||
@@ -2984,7 +2990,8 @@ class stock_warehouse(osv.osv):
|
||||
def _default_lot_output_id(self, cr, uid, context=None):
|
||||
try:
|
||||
lot_output_model, lot_output_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'stock_location_output')
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [lot_output_id], 'read', context=context)
|
||||
with tools.mute_logger('openerp.osv.orm'):
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [lot_output_id], 'read', context=context)
|
||||
except (ValueError, orm.except_orm):
|
||||
# the user does not have read access on the location or it does not exists
|
||||
lot_output_id = False
|
||||
|
||||
Reference in New Issue
Block a user