From cbb9dd3222da0e06ba8406daf1cf54c591726865 Mon Sep 17 00:00:00 2001 From: Jordi Ballester Alomar Date: Tue, 3 Jul 2018 17:13:18 +0200 Subject: [PATCH] add 'can_review' to tier.validation so that the buttons approve and reject can be hidden according to this computed field. --- base_tier_validation/models/tier_validation.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/base_tier_validation/models/tier_validation.py b/base_tier_validation/models/tier_validation.py index 5b6ec5f..66473a1 100644 --- a/base_tier_validation/models/tier_validation.py +++ b/base_tier_validation/models/tier_validation.py @@ -33,6 +33,12 @@ class TierValidation(models.AbstractModel): compute="_compute_reviewer_ids", search="_search_reviewer_ids", ) + can_review = fields.Boolean(compute="_compute_can_review") + + @api.multi + def _compute_can_review(self): + for rec in self: + rec.can_review = self.env.user in rec.reviewer_ids @api.multi @api.depends('review_ids')