access_restriction_by_user/models/stock_picking.py

13 lines
432 B
Python

from odoo import models, fields, api
class StockPicking(models.Model):
_inherit = 'stock.picking'
hide_quality_check_button = fields.Boolean(compute='_compute_hide_quality_check_button')
@api.depends('picking_type_id')
@api.depends_context('uid')
def _compute_hide_quality_check_button(self):
for record in self:
record.hide_quality_check_button = not self.env.user.allowed_quality_checks