Skip to Content
Menu
This question has been flagged
5 Replies
1964 Views

Odoo 11

Hi hopefully someone can help me to better understand Record Rules in Odoo 11.

I installed the Manufacturing, Inventory, Purchase, Invoice and Quality modules.

For the Manufacturing module I created  one users called FilmUser to better control access. To avoid problems I duplicated the Manufacturing/User group to create Manufacturing/FilmOps for FilmUser

So far the only change I have made in this new group is of course the users that belongs to the group and added  Record Rules. I'm intending to use the Record Rules to filter the Manufacturing Orders the FilmUser can see and process

This is the Record Rule I'm using 

Access Right Apply for: (Read, Write, Create, Delete)

Domain Filter ['&', ('routing_id', 'ilike', 'Sub-Film%'), ('state', '!=', 'confirmed')]

This works as I expected to filter the Manufacturing Orders the user can see. As it only sees the MOs with a routing Sub-Film which are in a State other than Confirmed. But it fails When I try to MARK AS DONE the MO, When I try I receive the following error:

The requested operation cannot be completed due to security restrictions. Please contact your system administrator.

(Document type: mrp.production, Operation: read)

If I remove this Rules then I can MARK AS DONE the MO but of course then I can see all MOs with any Routing which are in all states including Confirmed.

Any Clues or Suggestions to make this work?

Thank you in Advanced

Avatar
Discard

Hi,

Thank you everyone for your help, To test I changed the rule as this: [('routing_id', 'ilike', 'Sub-Film%')] but I still receive the error???

Now I can see MOs with any status and only those that have Sub-Film as routing

Here I don't understand why I still receive the error?

Best Answer

You are only allowing users in this group to see Manufacturing Orders that are not confirmed:

('state', '!=', 'confirmed')

What happens to the STATE field when a Manufacturing Order is done?    It changes to "done" - so that's why you get the error as you are only allowing users in this group to see Manufacturing Orders that are not confirmed (not done either).

Avatar
Discard
Best Answer

Ray is correct, of course.  

Have you thought of allowing this user group to view (but not update) orders in the "Confirmed" state?  

You could also create a new menu item and Windows Action and use "Domain" to prevent them viewing Manufacturing Orders with "Confirmed" state.  This may not be a complete solution because there may be other ways to view Manufacturing Orders (whereas Record Rules would block access completely).

Avatar
Discard