You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.7 KiB
49 lines
1.7 KiB
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class TierReview(models.Model):
|
|
_name = "tier.review"
|
|
_description = "Tier Review"
|
|
|
|
name = fields.Char(related="definition_id.name", readonly=True)
|
|
status = fields.Selection(
|
|
selection=[("pending", "Pending"),
|
|
("rejected", "Rejected"),
|
|
("approved", "Approved")],
|
|
default="pending",
|
|
)
|
|
model = fields.Char(string='Related Document Model', index=True)
|
|
res_id = fields.Integer(string='Related Document ID', index=True)
|
|
definition_id = fields.Many2one(
|
|
comodel_name="tier.definition",
|
|
)
|
|
review_type = fields.Selection(
|
|
related="definition_id.review_type", readonly=True,
|
|
)
|
|
reviewer_id = fields.Many2one(
|
|
related="definition_id.reviewer_id", readonly=True,
|
|
)
|
|
reviewer_group_id = fields.Many2one(
|
|
related="definition_id.reviewer_group_id", readonly=True,
|
|
)
|
|
reviewer_ids = fields.Many2many(
|
|
string="Reviewers", comodel_name="res.users",
|
|
compute="_compute_reviewer_ids", store=True,
|
|
)
|
|
sequence = fields.Integer(string="Tier")
|
|
done_by = fields.Many2one(
|
|
comodel_name="res.users",
|
|
)
|
|
requested_by = fields.Many2one(
|
|
comodel_name="res.users",
|
|
)
|
|
reviewed_date = fields.Datetime(string='Validation Date')
|
|
|
|
@api.multi
|
|
@api.depends('reviewer_id', 'reviewer_group_id', 'reviewer_group_id.users')
|
|
def _compute_reviewer_ids(self):
|
|
for rec in self:
|
|
rec.reviewer_ids = rec.reviewer_id + rec.reviewer_group_id.users
|