Multi-Company user can't see only children companies

Bug #1121950 reported by BEEWAY
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Confirmed
Medium
OpenERP's Framework R&D

Bug Description

Hi,

I created a new db with the multi-company option.
As we are going to have several administrators, I created 2 new users with fully rights.
With the admin login, I can see that I've allowed those users to see several companies. When I log with one of those users and I go to the user management interface, I can only see the user's main company and its children companies in the field "Allowed companies".
Parent companies can't be seen although it is set with admin account.

I Hope this is clear.

I'm using openerp_7.0-20130211-002141-1_all.deb

It used to work in begin of january versions

Thanks in advance for your help
Christophe

Dawn Richardson (r-dawn)
Changed in openobject-addons:
status: New → Confirmed
Revision history for this message
Dawn Richardson (r-dawn) wrote :

I also have this problem using version 7.0-20130122-001415.

- Create new DB
- Go to Users > Users > Adminstrator and update the access rights to the following: Multi-Companies=True. Technical Features = True.
- Refresh and then go to Companies > Companies and create a new company, 'Company B'
- Go to Users > Users and create a new user, 'User B' with the following access rights: company='Your Company'. Allowed Companies='Your Company', 'Company B'. Adminstration='Settings'. Multi Companies= True.
- Change User B 's password
- Sign in as User B.
- Go to Users > Users > User B > Access Rights > Allowed Companies and only "Your Company" is shown, even though we gave it 'Company B' above.

Another issues in viewing users related to this as well. Following on from above
- Go to Preferences (in top right corner)
- Change Company from 'Your Company' to 'Company B'.
- Go to Users > Users and no users show up in the list.

If it was working correctly, surely User B would at least be able to see himself?

Revision history for this message
Danijel Ilievski (danijel-san) wrote :

I can confirm the bug Christophe has reported.

Assume a clean database with multi company setting enabled.
Using Admin account create the following company structure (go to Settings >> Companies):

1. Main company M
     1.1 Company A
             1.1.1 Company A1
             1.1.2 Company A2
     1.2 Company B
             1.2.1 Company B1

Then, create new user login (go to Settings >> Users), UserB as Christophe said and set the Company field to 'Company A' and put the following under Allowed Companies: 'Company A', 'Company A1', 'Company B1'.

Under Access Rights, set the Administration field to either 'Access Rights' or 'Settings'. Which one you choose doesn't matter as the bug manifests itself using both of the options.

Also set any other installed module to at least 'User' so UserB can see the top-most menu.

Log in as UserB and go to Settings >> open UserB by clicking on it and go to Access Rights section.
What you'll see in the Allowed Companies field is: 'Company A' and 'Company A1'. 'Company B1' is not in the list!

The only 'workaround' to see 'Company B1' is to set UserB's company to 'Main company M' using Admin login.

Revision history for this message
Danijel Ilievski (danijel-san) wrote :

Which is not desirable solution in my case

Revision history for this message
Danijel Ilievski (danijel-san) wrote :

BTW I'm using OpenERP version 7.0-20130222-002152

Revision history for this message
Togar Hutabarat (to-garnet) wrote :

Hi all..

I also have this problem in our client's company (I work currently as a consultant in an OpenERP Partner for Indonesia: ADSOFT).
This bug can be fixed by modifying default Record Rules for object res.company (Company). Actually I'm using OpenERP v6.1 while doing this settings, I think it will work for v7.0 as well. Here is the step.
1. Open Record Rules' Menu from Menu > Settings > Security > Record Rules.
2. Open record rules for object "res.company".
3. Inside text box "Rule definition (domain filter)" you will find rule "[('id','child_of',[user.company_id.id])]". Delete the value so the text box will be empty, save.
4. Log in with user you've created before then check the Allowed Companies for that users. The other company should be appear.

NB: Please notice that this access rule configuration will back to it's default settings if you restart the server and update module "base". If you want to keep this configuration, you can create and install a simple tiny module that replace the rule (id=res_company_rule) and empty the "domain force" tag. The XML script will be like below..

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
    <record id="res_company_rule" model="ir.rule">
        <field name="name">company rule</field>
        <field model="ir.model" name="model_id" ref="model_res_company"/>
        <field eval="True" name="global"/>
        <field name="domain_force"></field>
    </record>
</data>
</openerp>

Sorry for my bad English.
Togar
ADSOFT - OpenERP Partner for Indonesia

affects: openobject-addons → openobject-server
Revision history for this message
Twinkle Christian(OpenERP) (tch-openerp) wrote :

Hello,

Currently, I have checked this issue, and having same problem as per bug description and as comment #1. So, I am confirming this issue.

Thank you.

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Medium
Revision history for this message
indra kurniawan (kkaite2) wrote :

Hi Togar, imho deleting the record rules for res.company will disable the access rules; which defeat the purpose of multi company module.

I also got access denied issue using multi company, and when I debug and check the res_partner table in database; the company_id in the res_partner table is incorrectly set to the company of the "logged in user" instead of the user's company

is a this bug in user creation/edit process? (company_id for res_partner is set to the current logged in user)
and is this related to this issue?

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

Other bug subscribers

Remote bug watches

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