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
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Účetnictví
- Sklad
- PoS
- Project
- MRP
This question has been flagged
4
Odpovědi
2529
Zobrazení
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'
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Přihlásit seRelated Posts | Odpovědi | Zobrazení | Aktivita | |
---|---|---|---|---|
|
2
čvn 24
|
1897 | ||
|
3
kvě 24
|
1652 | ||
|
0
čvn 20
|
2641 | ||
|
1
bře 15
|
6445 | ||
|
1
říj 24
|
971 |