Skip to content

Commit

Permalink
Merge PR #5 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by andhit-r
  • Loading branch information
ssi-bot committed Sep 10, 2023
2 parents 7ccff54 + b1966e3 commit ed61594
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions ssi_risk_analysis/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
risk_analysis_item,
risk_analysis_worksheet_type,
risk_analysis_worksheet,
mixin_risk_analysis,
)
38 changes: 38 additions & 0 deletions ssi_risk_analysis/models/mixin_risk_analysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2022 OpenSynergy Indonesia
# Copyright 2022 PT. Simetri Sinergi Indonesia
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).


from odoo import api, fields, models


class MixinRiskAnalysis(models.AbstractModel):
_name = "mixin.risk_analysis"
_description = "Mixin for Object With Risk Analysis"

risk_analysis_id = fields.Many2one(
string="# Risk Analysis",
comodel_name="risk_analysis",
)
risk_analysis_state = fields.Selection(
related="risk_analysis_id.state",
store=True,
)
risk_analysis_result_id = fields.Many2one(
string="Risk Analysis Result",
comodel_name="risk_analysis_result",
compute="_compute_risk_analysis_result_id",
store=True,
)

@api.depends(
"risk_analysis_id",
"risk_analysis_id.state",
"risk_analysis_id.result_id",
)
def _compute_risk_analysis_result_id(self):
for record in self:
result = False
if record.risk_analysis_id and record.risk_analysis_id.state == "done":
result = record.risk_analysis_id.result_id
record.risk_analysis_result_id = result

0 comments on commit ed61594

Please sign in to comment.