Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3867 Lượt xem

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


Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất
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.
Ảnh đại diện
Huỷ bỏ
Tác giả

HI Kripal,

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 11 20
3830
1
thg 3 15
4675
4
thg 10 24
4022
0
thg 5 23
1818
1
thg 4 21
2738