I have 2 companies, am open the website in the second company, i am logged into the custom page that i create i need the id of the current company, that is 2 but when am call request.env.company or request.env.user.company i get the company id 1, but i am in the company 2 , how i solve this, in odoo 17
Esta pergunta foi sinalizada
4
Respostas
5134
Visualizações
Hello,
selected_companies = self.env['res.company'].browse(self._context.get('allowed_company_ids'))Thanks.
You can use the company service in your js and then send it to the controller.
let activerCompany = company.activeCompanyIds
The controller always gives id 1.
Hope this helps!
hi
try this,
request.env.user.company_id
I need in controller, when am using the context in the controller i get an error , AttributeError: 'Request' object has no attribute '_context'
Está gostando da discussão? Não fique apenas lendo, participe!
Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!
Inscrever-se| Publicações relacionadas | Respostas | Visualizações | Atividade | |
|---|---|---|---|---|
|
|
2
jun. 24
|
3084 | ||
|
|
3
mai. 24
|
3076 | ||
|
|
0
jun. 20
|
4141 | ||
|
|
1
mar. 15
|
7982 | ||
|
|
1
out. 24
|
2491 |