[FIX] stock: remove warning popup on update product quantity wizard and correctly verify access rights on stock.location
lp bug: https://launchpad.net/bugs/1200194 fixed bzr revid: mat@openerp.com-20130729135844-jtanbteqtg52ztnu
This commit is contained in:
parent
ecc9c506a5
commit
2f07aac8b2
|
@ -1697,13 +1697,13 @@ class stock_move(osv.osv):
|
|||
if picking_type in ('in', 'internal'):
|
||||
try:
|
||||
location_model, location_id = mod_obj.get_object_reference(cr, uid, 'stock', 'stock_location_stock')
|
||||
self.check_access_rule(cr, uid, [location_id], 'read', context=context)
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
|
||||
except (orm.except_orm, ValueError):
|
||||
location_id = False
|
||||
elif picking_type == 'out':
|
||||
try:
|
||||
location_model, location_id = mod_obj.get_object_reference(cr, uid, 'stock', 'stock_location_customers')
|
||||
self.check_access_rule(cr, uid, [location_id], 'read', context=context)
|
||||
self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
|
||||
except (orm.except_orm, ValueError):
|
||||
location_id = False
|
||||
|
||||
|
@ -1955,12 +1955,12 @@ 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.check_access_rule(cr, uid, [source_location[1]], 'read', context=context)
|
||||
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.check_access_rule(cr, uid, [dest_location[1]], 'read', context=context)
|
||||
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}}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import fields, osv
|
||||
from openerp.osv import fields, osv, orm
|
||||
import openerp.addons.decimal_precision as dp
|
||||
from openerp.tools.translate import _
|
||||
from openerp import tools
|
||||
|
@ -62,7 +62,11 @@ class stock_change_product_qty(osv.osv_memory):
|
|||
if 'product_id' in fields:
|
||||
res.update({'product_id': product_id})
|
||||
if 'location_id' in fields:
|
||||
location_id = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'stock_location_stock', context=context)
|
||||
try:
|
||||
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)
|
||||
except (orm.except_orm, ValueError):
|
||||
location_id = False
|
||||
res.update({'location_id': location_id and location_id.id or False})
|
||||
return res
|
||||
|
||||
|
|
Loading…
Reference in New Issue