تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
1879 أدوات العرض

Hi,


How can I activate an additional company on the company switcher, but from python/the backend?

I can retrieve the currently selected companies from the context, using:

self._context.get('allowed_company_ids')

Is there a way to add to the 'allowed_company_ids' ?


Thanks,

Stijn









الصورة الرمزية
إهمال
أفضل إجابة

Hi, 

You can see following for this:

https://youtu.be/GkNgc-fZO-I

Hope it helps,

Thanks

الصورة الرمزية
إهمال
أفضل إجابة

Yes. You could add the new company to the User - Allowed Companies

الصورة الرمزية
إهمال
الكاتب

I'm probably missing something, but I don't see a "allowed_company_ids" property or method in the user model?

Company_ids is there though, but that is not what I need.

الكاتب

There's probably some confusing due to the naming.

Indeed, in the interface (Settings / Users / User detail), you have "Allowed Companies". This field refers to "user.company_ids" and I can and do already add companies there.

What I'm asking about is the selected companies in the company switcher button on the top right (right next to the profile) in multi company mode.

The selected companies are (at least) stored in the context, in "self._context.get('allowed_company_ids')"

So after I've added the company to the user, I also want to select it in the company switcher. That is where I'm stuck.