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

Hi All,

Is there a way to extract the XML ID for a group?  The reason being that I need to use the XML ID in the " self.env.user.has_group() " function.  But the input for this is XML ID and not ID.  


Example Extract Below:

modelname = "claim.claim"

modelAccessListing = self.env['ir.model.access'].sudo().search([('model_id.name','=', modelname)])

for groupobj in modelAccessListing : 

     if self.env.user.has_group(groupobj.group_id -> XML ID):

          ## TEST OUTPUT

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



I use get_xml_id() function to get xml id. This is working in odoo 11.


Thanks !


iWesabe

Ảnh đại diện
Huỷ bỏ