Skip to Content
Menu
This question has been flagged
1 Reply
1505 Views

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. 

Avatar
Discard
Best Answer

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
Avatar
Discard