Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
1652 มุมมอง

I created a group names Suva Sales and i want this group of users to have read access only at CRM "Won stage". 

I tried record rules [('stage_id.name','!=',Won')] and also tried [["stage_id","=",4]] but could not solve it. 


Any help here. 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello, Rishal Chand, you can try the following code in which you need to inherit search_read method:

class CRMLead(models.Model):

    _inherit = "crm.lead"

    @api.model

    def search_read(self, domain=None, fields=None, offset=0,limit=None, order=None):

       if self.user_has_groups('your_group_name'):

            domain += [('stage_id.name', '=', 'Won')]

        res = super(CRMLead, self).search_read(domain, fields, offset, limit, order)

        return res

Thanks
อวตาร
ละทิ้ง