Browse Source

Merge pull request #2 from etobella/11.0-imp-base_tier_validation_et

[IMP] base_tier_validation: Pass parameters as functions
pull/55/head
Jordi Ballester Alomar 6 years ago
committed by GitHub
parent
commit
5f22d0c7d2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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

@ -41,8 +41,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