Odoo - Hide button for specific user

前端 未结 2 1594
醉话见心
醉话见心 2021-02-20 03:11

I am using odoo 10 enterpeise . I want to show buttons to specific users not to groups because there would be many users in a group and i want to only show below button who have

2条回答
  •  天命终不由人
    2021-02-20 04:09

    One of the thing i know to use a field in attrs the field must be Mentionsed in the form. i don't know how to get the value of the user id in the form. but if there is not a short way like uid or user you can work arround this, just create a m2o field to res.users make this field compute field with store = False.

        # by default store = False this means the value of this field
        # is always computed.
        current_user = fields.Many2one('res.users', compute='_get_current_user')
    
        @api.depends()
        def _get_current_user(self):
            for rec in self:
                rec.current_user = self.env.user
    

    and you can use this field in your form.

        
                  

    sorry for my english.

提交回复
热议问题