Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX]base_tier_validation_report: attempt to fix ci #733

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions base_tier_validation_report/models/tier_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TierReview(models.Model):
resource_ref = fields.Reference(
selection="_selection_resource_ref",
compute="_compute_resource_ref",
store=True,
store=False,
readonly=True,
compute_sudo=True,
)
Expand All @@ -27,6 +27,7 @@ class TierReview(models.Model):
compute_sudo=True,
)

@api.model
def _selection_resource_ref(self):
models = self.env["tier.definition"]._get_tier_validation_model_names()
res = [(m, self.env[m]._description) for m in models]
Expand All @@ -35,12 +36,16 @@ def _selection_resource_ref(self):
@api.depends("model", "res_id")
def _compute_resource_ref(self):
for rec in self:
rec.resource_ref = (
"%s,%s" % (rec.model, rec.res_id) if rec.res_id else False
)
rec.resource_name = rec.resource_ref.display_name
rec.resource_type = rec.model
rec.next_review = rec.resource_ref.next_review
if rec.model and rec.model in self.env:
rec.resource_ref = "%s,%s" % (
rec.model,
rec.res_id,
) # if rec.res_id else False
rec.resource_name = rec.resource_ref.display_name
rec.resource_type = rec.model
rec.next_review = rec.resource_ref.next_review
else:
rec.resource_ref = None

def action_open_resource_ref(self):
self.ensure_one()
Expand Down