Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Problmes with linking users to Companys

By
Fabian
on 1/26/16, 4:18 AM 499 views

Hey,

I have a Problem linking a User to an new Comapny.

Here da description of my problem.

I have created User1 for the company "My Company".

Now I've created a second company: "My Comapany2" and I want to link User1 only to My Comapany2.

The Problem I'm getting this error:

"ValidateError

Field(s) `company_id, company_ids` failed against a constraint: The chosen company is not in the allowed companies for this user"

I'm logged in as admin in Odoo8.

0

Ermin Trevisan

--Ermin Trevisan--
3524
| 6 3 7
Walchwil, Switzerland
--Ermin Trevisan--


Ermin Trevisan
On 1/26/16, 6:10 AM

You have to add My Company2 to the "Allowed Companies" in the preferences of User1.

0
Fabian
On 1/26/16, 6:47 AM

oh yeah thx!

If anyone want to create a user via API and link the user to an Company you can use the following code:

user_id=models.execute_kw(db, uid, password, 'res.users', 'create', [{'name':"Username",    'login':'Username@gmail.com','company_ids':[(4, comp_id,False)], 'company_id':comp_id, 'new_password':'123456'}])
0
Nilim
On 1/27/16, 7:35 AM

Hi Fabian,

W.r.t your query, I have go through your query and tried to replicate it. Following might be the reasons due to which you had been receiving the issue :-

1) While creating the user, the option of Multi Companies under tab Usability needs to be selected for that particular user.

2) Post this the required companies must be added under “Allowed Companies” for that particular user.

By doing so your issue of linking a User to an new Company would be solved.

Hope this helps

Cheers!!

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/26/16, 4:18 AM
Seen: 499 times
Last updated: 1/27/16, 9:11 AM