Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
3 Vastaukset
19700 Näkymät

We need to create multiple users within several companies. When I select another company rather than "Your company", I receive this error : "The chosen company is not in the allowed companies for this user"

Any idea?

Avatar
Hylkää
Tekijä

I didn't see this field! Thanks !!

You are welcome, no need to thank me, we all try to colaborate to learn from the community. Just keep making question and answering if you know the answer to other questions. And don't forget to upvote and check correct answers, as you have already done. And last but not least, this is not an answer, it should be a comment.

(I converted it ;))

Tekijä

thanks ! :-)

Paras vastaus

Easy, setup the companies for the ones the user is allowed to work with. Go to Settings/Users and select the user you need to configure, press Edit button, go the Access Rights tab and add the companies from the Allowed Companies dropdown box

Here is a screen capture of the user form where you can configure it.

image description

Avatar
Hylkää

Hello... I have just installed OpenERP server but I don't see "Allowed Companies" configuration in Access Rights tab.

You will need to go into the user settings for your admin user and check the box for 'multi companies' under 'usability'.

My question is irrelevant, but how did you insert the image in your answer using the data url ? I tried to do the same unsuccessfully. Is this because of low karma?

Paras vastaus

When you create a new user, and are using multi-company, then you must set

company_id

and

company_ids

If you look in

odoo\addons\base\models\res_users.py	

then you can seach for the error message and see Odoo searching for company_id in company_ids so if company_ids is not set when the user is created then this error will be generated.

To create a minimal user, you need to create the following fields:

company_id
company_ids
partner_id
login
groups_id

but don't forget to look up the defaults.


Avatar
Hylkää
Paras vastaus

The chosen Branch is not in the allowed Branches for this user getting same error while create user by button

company also same error

Py code

def action_create_user(self):
for line in self:

if line.name:
user = self.env["res.users"].create({"name": line.name,
"login": line.employee_code, "company_ids": line.company_id,
"branch_ids": line.branch_id})
print(user, "user")
line.user_id = user.id
def action_create_user(self):
for line in self:

if line.name:
user = self.env["res.users"].create({"name": line.name,
"login": line.employee_code, "company_ids": line.company_id,
"branch_ids": line.branch_id})
print(user, "user")
line.user_id = user.id
xml file.



Avatar
Hylkää

Hello, I'm having the same problem, did you solve it ?

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
maalisk. 15
7229
1
maalisk. 15
6408
3
maalisk. 15
12732
2
maalisk. 15
8352
2
jouluk. 19
11463