Multi-company Stock by Location

Asked by Kevin McMenamin

Not sure if this is a bug or a feature!

I have a multi-company situation with 12 companies and I want users to be able to see other companies stock. In user set up I get each user access to the other peer companies but not the parent company. However, in stock by location they can only see their own company. A user that has access to the parent company as well does see all companies.

I would have expected if my security allowed access to peer companies the system would display. I do have a workaround (give everyone access to a parent) but something to be fixed.

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Kevin McMenamin
Solved:
Last query:
Last reply:

This question was originally filed as bug #805712.

Revision history for this message
Amit Parik (amit-parik) said :
#1

Hello Kevin,

I have checked your issue and this is not a bug it's feature for multi-company environment.
In version 6 we have create a record rule of multi-company for most important objects like account.account, account.bank.statement, account.payment,product.template , stock.stock as well as stock.location and many important objects.

The record rule is like this : ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]

So it means that the parent company 's user can see the all the records of the child company as well as the his company (main company) and the child company's user can see only his company 's record and does not see the parent company's record.

So this is not a bug and this is the system behavior.

Hope this will help for you.

Thanks

Revision history for this message
Kevin McMenamin (kevin-mcmenamin) said :
#2

Thanks - unfortunately after further testing my workaround does not work, so this is a bug.
The users have a "home" company that they work for but are allowed to see (in this case) inventory at other companies. This is controlled by the security set up and the logic should not overwrite the security.

If they have their preference set up for their own company, they do not see the other companies.
If they change their preference to the parent, then they can see the other companies.

It is not workable for them to have their preferences set to the parent while working for a different company - I quickly tested a sales order to dispatch - the product was dispatched from the wrong warehouse on the system.

The record rule should be ['|',('company_id','=',False),('company_id','member_of',[user.company_id.ids])] **I know this is not correct but I don't know how to code :)

Revision history for this message
Graeme Gellatly (gdgellatly) said :
#3

Kevin,

Just change the rule. The default security rules are not really meant for
production anyway. I understand what you are saying, but honestly it never
gets changed, hence why the default rules are not suitable for production
comment. That is the advice I got from OpenERP last time I complained about
the default rules. Well actually it did get changed in January to this
current rule. Before it was more restrictive.

The easiest, if not most secure way to do this is create a new group, I
don't know multicompanysupergroup for example, and setup security rules of
1,'=',1 for the relevant objects. The best part about that is then the
users only need to be set for 1 company, but security and user setup is a
very large topic.

For testing just change the rule to 1,'=',1 for the objects in question.

On Wed, Jul 6, 2011 at 9:55 AM, Kevin McMenamin <
<email address hidden>> wrote:

> Question #163785 on OpenERP Addons changed:
> https://answers.launchpad.net/openobject-addons/+question/163785
>
> Kevin McMenamin gave more information on the question:
> Thanks - unfortunately after further testing my workaround does not work,
> so this is a bug.
> The users have a "home" company that they work for but are allowed to see
> (in this case) inventory at other companies. This is controlled by the
> security set up and the logic should not overwrite the security.
>
> If they have their preference set up for their own company, they do not see
> the other companies.
> If they change their preference to the parent, then they can see the other
> companies.
>
> It is not workable for them to have their preferences set to the parent
> while working for a different company - I quickly tested a sales order
> to dispatch - the product was dispatched from the wrong warehouse on the
> system.
>
> The record rule should be
>
> ['|',('company_id','=',False),('company_id','member_of',[user.company_id.ids])]
> **I know this is not correct but I don't know how to code :)
>
> --
> You received this question notification because you are a member of
> OpenERP Committers, which is an answer contact for OpenERP Addons.
>

Revision history for this message
Kevin McMenamin (kevin-mcmenamin) said :
#4

that works..thanks. Will tidy up when I get to security..someday!