Hello,
I created a module that add on stock.location, product.product, stock.picking and res.users a many2one field : warehouse_id.
from osv import osv, fields
class res_users(osv.osv):
_name = 'res.users'
_inherit = 'res.users'
_columns = {
'warehouse_id': fields.many2one('stock.warehouse', 'Entrepot'),
}
res_users()
class stock_picking(osv.osv):
_name = 'stock.picking'
_inherit = 'stock.picking'
_columns = {
'warehouse_id': fields.many2one('stock.warehouse', 'Entrepot', required=True),
}
stock_picking()
class stock_location(osv.osv):
_name = 'stock.location'
_inherit = 'stock.location'
_columns = {
'warehouse_id': fields.many2one('stock.warehouse', 'Entrepot', required=True),
}
stock_location()
class product_product(osv.osv):
_name = 'product.product'
_inherit = 'product.product'
_columns = {
'warehouse_id': fields.many2one('stock.warehouse', 'Entrepot', required=True),
}
product_product()
Then, I added record rule on stock.location, product.product and stock.picking like that :
[('warehouse_id', '=', user.warehouse_id.id)]
And the problem is when I try to load the tree view of product.product, it shows me :
AccessError Operation prohibited by access rules, or performed on an already deleted document (Operation: read, Document type: Stock Location).
Does anyone have an idea to solve this problem or what am I doing wrong ?
Thank you a lot !