Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
3871 Widoki

Hi Guys,

I tried to check the multi-company is enabled or not. But it returning empty records.

Can anyone help me to find whether the multi-company is enabled or not?

Note: Without creating any additional records

Code Snippet

multi_company = self.env['res.config.settings'].sudo().search([])

Tried Snippet

multi_company = self.env['ir.config_parameter'].sudo().get_param('group_multi_company')

Thanks in Advance


Awatar
Odrzuć
Autor Najlepsza odpowiedź

Hi Everyone,

Got a solution by using the below code

multi_company = self.env['res.users'].has_group('base.group_multi_company')

Thank You All

Awatar
Odrzuć
Najlepsza odpowiedź
multi_company = self.env['res.config.settings'].sudo().search([])
print(multi_company.group_multi_company)

If multi_company.group_multi_company is True => Multi-Company is enabled, if False, disabled.
Awatar
Odrzuć
Autor

HI Kripal,

Thanks for your answer. But it's not working and the same code added in my description.

Powiązane posty Odpowiedzi Widoki Czynność
0
lis 20
3832
1
mar 15
4682
4
paź 24
4024
0
maj 23
1822
1
kwi 21
2739