Browse Source

[IMP] base_tier_validation: Pass parameters as functions

pull/69/head
Enric Tobella 6 years ago
committed by Lois Rilo
parent
commit
6f6a251240
  1. 11
      base_tier_validation/models/tier_review.py
  2. 14
      base_tier_validation_formula/models/tier_review.py

11
base_tier_validation/models/tier_review.py

@ -42,8 +42,15 @@ class TierReview(models.Model):
)
reviewed_date = fields.Datetime(string='Validation Date')
@api.model
def _get_reviewer_fields(self):
return ['reviewer_id', 'reviewer_group_id', 'reviewer_group_id.users']
@api.multi
@api.depends('reviewer_id', 'reviewer_group_id', 'reviewer_group_id.users')
@api.depends(lambda self: self._get_reviewer_fields())
def _compute_reviewer_ids(self):
for rec in self:
rec.reviewer_ids = rec.reviewer_id + rec.reviewer_group_id.users
rec.reviewer_ids = rec._get_reviewers()
def _get_reviewers(self):
return self.reviewer_id + self.reviewer_group_id.users

14
base_tier_validation_formula/models/tier_review.py

@ -14,13 +14,13 @@ class TierReview(models.Model):
compute="_compute_python_reviewer_ids", store=True
)
@api.depends('reviewer_id', 'reviewer_group_id', 'reviewer_group_id.users',
'python_reviewer_ids')
def _compute_reviewer_ids(self):
super(TierReview, self)._compute_reviewer_ids()
for rec in self:
rec.reviewer_ids = rec.reviewer_id + rec.reviewer_group_id.users \
+ rec.python_reviewer_ids
@api.model
def _get_reviewer_fields(self):
res = super()._get_reviewer_fields()
return res + ['python_reviewer_ids']
def _get_reviewers(self):
return super()._get_reviewers() + self.python_reviewer_ids
@api.multi
@api.depends('definition_id.reviewer_expression',

Loading…
Cancel
Save