Multi-comapnies incorrect access right in view of partner list

Bug #1090049 reported by Damien D.
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Invalid
Undecided
OpenERP Publisher's Warranty Team

Bug Description

Hi all,

this can be tested here
http://54.247.19.40:48080/
database: Test_AccessRight
login: admin, salesA, salesB or salesAB
password: kazacube

I created a multi-companies database as admin with two companies
 - company A
 - company_B
I added useability/multi companies for admin

Then, as admin:
 Creation of Customer_A with Company A for company in sales & purchases tab
 Creation of Customer_B with Company_B for company in sales & purchases tab
 Creation of Customer_AB with nothing for company in sales & purchases tab
 Creation of salesA with:
      - groups: partner manager, employee, useability/multi companies, sales / Manager, Sale / User all leads, Sales / User
      - company A as company
      - company A as list of companies
 Creation of salesB:
      - groups: partner manager, employee, useability/multi companies, sales / Manager, Sale / User all leads, Sales / User
      - company_B as company
      - company_B as list of companies
 Creation of salesAB
      - groups: partner manager, employee, useability/multi companies, sales / Manager, Sale / User all leads, Sales / User
      - company A as company
      - company A and company_B as list of companies

Tests:
 - login as salesA: OK: I can see CustomerA, CustomerAB, company A in partner list
 - login as salesB: OK: I can see CustomerB and CustomerAB, company B in partner list: OK
 - login as salesAB: KO: I can see CustomerA and CustomerAB, company A but NOT customerB NOR company_B in partner list

Many thanks for your help

Damien D.

Tags: maintenance

Related branches

Changed in openobject-addons:
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)
tags: added: maintenance
Changed in openobject-addons:
status: New → Confirmed
status: Confirmed → In Progress
Revision history for this message
Pinakin Nayi (OpenERP) (pna-openerp) wrote :

Hello ,

I have fixed this issue in this following branch[6.0,6.1,trunk] :
6.0 := <email address hidden>
           rev no : 3651
6.1 := Revision ID: <email address hidden>
            Rev no : 4320
trunk := <email address hidden>
           Rev no : 4712

Thanks,
pna

Changed in openobject-addons:
status: In Progress → Fix Committed
Revision history for this message
Damien D. (ddelangle) wrote :

Hi,

this fix has been tested and the result is OK.

Many thanks for your help

Rgds,

Damien D.

Revision history for this message
Damien D. (ddelangle) wrote :

Hi again,

the fix is for partners. Is there a way to do this on all the object linked to company_A or company_B.
For example we would like to have the same result for product, accounting, warehouses,...

Thanks for your reply.

Rgs,

Damien D.

Revision history for this message
Damien D. (ddelangle) wrote :

Hi again,

we found that your patch raised new bugs, please go the db I provided and:
 - connect as admin
 - check company of customer_B: you find company_B: OK
 - connect as salesB
 - check company of customer_B: you find company_B: OK
 - connect as salesAB
 - check company of customer_B: you find company_A: ERROR

Rgds,

Damien D.

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

Hello,

As far as I can tell this is not a bug, but the expected behavior with the default OpenERP configuration, especially when the two companies are unrelated (not a parent of each other)

Here is how multi-company works in OpenERP:
- a user can only see documents that belong to the company that is currently set as their "main company" in their user preferences or to a child company, plus documents that do not belong to any company (it actually depends on the security rules configured for that kind of document, but this is the normal behavior) ;
- the list of "allowed companies" for a user should *only ever* be used to let the user switch companies in their user preferences, and never to decide which documents should be visible to the user.

So when users have several companies in their "allowed companies", that does not mean they will see documents from all these companies all the time. They must only see the documents from their currently selected company (and its child companies). If they want to start seeing documents from another company, their have to switch their current company in their user preferences.

In a nutshell, a user who belongs to several companies has to choose in which company context they want to work, at all time, and they cannot mix these contexts.
This is critical to ensure that OpenERP stays usable in multi-company mode, otherwise users would mix data from different companies all the time, causing countless errors: for example when you have to select the value for a field (say, a product or a fiscal period) it's not easy to tell which possible value belongs to which company.

Changed in openobject-addons:
status: Fix Committed → Invalid
Revision history for this message
Damien D. (ddelangle) wrote :

Hi,

many thanks Olivier for this very detailed post.

We did not see the way the module was designed. We did not see that current company of the user implies that this user we will work only with
 - objects of the company he is logged in
 - object of the child's company he is logged in
 - shared object.

In fact we thought that on each process and related object you can choose with which company you work. We thought this because, for example, when you are logged as admin you can go to sales > Create SO and choose between the list of companies. After reading your post I realise that when you are logged as saleAB (in my example) you can only create a SO for the company your are connected as (or switch company in your preference).

So I still have remarks:
 - Why is there a difference between saleAB and admin when creating a SO (for example)?
 - Even if a user has all companies there's no way for him to view all sales order in one list, which is generaly what a final user wants.
 - when you switch from one company to another: in the top of the screen the company's name is left unchanged and this may disturb the final user.

Rgds,

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.