Record rules for 'stock.picking' are not enforced on 'stock.picking.out' when displaying tree view

Bug #1104163 reported by Egor Tsinko
32
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 2

Bug Description

How to reproduce:
1. Create new database with demo data
2. Enable 'Technical Features' and 'Multi Companies' for administrator
3. install 'warehouse' module
4. Edit user 'demo':
  - change company to 'Your Company, Birmingham shop'
  - change allowed companies to 'Your Company, Birmingham shop'
5. Create a delivery order as administrator to any of the partners, but make sure that the company is set to 'Your Company' in 'Additional Info' tab
6. Log out and log in as 'demo' user
7. Go to Warehouse/Delivery Orders and see OUT/00001 which this user shouldn't be able to see.
8. Click on delivery order OUT/00001 and error pops up:
" Access Denied
The requested operation cannot be completed due to security restrictions. Please contact your system administrator.
(Document type: Picking List, Operation: read)"

I traced this error to the following issue.
To display tree list OpenErp calls search() method on the objects it displaying. In this case it is 'stock.picking.out'. Search method checks access rights and access rules and since there are no access rules for 'stock.picking.out' it displays the delivery order.

Related branches

Revision history for this message
Egor Tsinko (etsinko) wrote :
summary: - [7.0] Record rules for 'stock.picking' are not enforced on
- 'stock.picking.out' when displaying tree view
+ Record rules for 'stock.picking' are not enforced on 'stock.picking.out'
+ when displaying tree view
Changed in openobject-addons:
status: New → Confirmed
Changed in openobject-addons:
importance: Undecided → Medium
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
Changed in openobject-addons:
status: Confirmed → In Progress
status: In Progress → Confirmed
Revision history for this message
Amit Dodiya (OpenERP) (ado-openerp) wrote :

Hello,

For 7.0 this issue is fixed with following branch:
branch: lp:~openerp-dev/openobject-addons/7.0-opw-590100-ado
revision-id: <email address hidden>
revision-no: 8914

Soon our experts will review and merge it with stable(7.0) addons.

Regards,
Amit

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Egor, thanks for the analysis and for the patch! A variation of your patch (to also cover read()) was just merged in the addons 7.0 branch at revision 8990 (revision-id: <email address hidden>, available in nightly builds as of tomorrow).

There was a bit of confusion with various patches and duplicate bugs, but the problem should now be fixed.

no longer affects: openobject-addons/trunk
Changed in openobject-addons:
status: Confirmed → Fix Released
no longer affects: openobject-addons/7.0
Changed in openobject-addons:
milestone: none → 7.0
Revision history for this message
Oliver Yuan (oliver-yuan) wrote :

It seems that this brought another side effect - the record rule defined on stock.picking.out cannot be applied.

     1. add a new field called warehouse_id by inheriting stock.picking.out
     2. define a record rule on stock.picking.out to filter the data records by warehouse_id

This rule is not effective.

Our temp solution is to comment search() under stock.picking.out class in stock.stock.py

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.