diff --git a/ssi_risk_analysis/__manifest__.py b/ssi_risk_analysis/__manifest__.py
index 456dc4b..a65f300 100644
--- a/ssi_risk_analysis/__manifest__.py
+++ b/ssi_risk_analysis/__manifest__.py
@@ -34,6 +34,7 @@
"menu.xml",
"views/risk_analysis_type_views.xml",
"views/risk_analysis_result_views.xml",
+ "views/risk_analysis_conclusion_views.xml",
"views/risk_item_views.xml",
"views/risk_analysis_views.xml",
"views/risk_analysis_worksheet_views.xml",
diff --git a/ssi_risk_analysis/models/__init__.py b/ssi_risk_analysis/models/__init__.py
index 31434ff..5adc718 100644
--- a/ssi_risk_analysis/models/__init__.py
+++ b/ssi_risk_analysis/models/__init__.py
@@ -6,9 +6,12 @@
risk_analysis_type,
risk_analysis_type_item,
risk_analysis_type_result,
+ risk_analysis_type_conclusion,
risk_analysis_result,
+ risk_analysis_conclusion,
risk_item,
risk_item_result,
+ risk_item_conclusion,
risk_analysis,
risk_analysis_item,
risk_analysis_worksheet_type,
diff --git a/ssi_risk_analysis/models/risk_analysis.py b/ssi_risk_analysis/models/risk_analysis.py
index fde5310..f689d4e 100644
--- a/ssi_risk_analysis/models/risk_analysis.py
+++ b/ssi_risk_analysis/models/risk_analysis.py
@@ -172,6 +172,44 @@ class RiskAnalysis(models.Model):
compute="_compute_result_id",
store=True,
)
+ need_dissenting_reason = fields.Boolean(
+ string="Need Dissenting Reason",
+ compute="_compute_need_dissenting_reason",
+ store=True,
+ )
+ dissenting_reason = fields.Text(
+ string="Dissenting Reason",
+ readonly=True,
+ states={
+ "open": [
+ ("readonly", False),
+ ],
+ },
+ )
+ allowed_conclusion_ids = fields.Many2many(
+ string="Allowed Risk Analysis Conclusions",
+ related="type_id.allowed_conclusion_ids",
+ store=False,
+ )
+ conclusion_id = fields.Many2one(
+ string="Conclusion",
+ comodel_name="risk_analysis_conclusion",
+ readonly=True,
+ states={
+ "open": [
+ ("readonly", False),
+ ],
+ },
+ )
+ conclusion = fields.Text(
+ string="Conclusion Reasoning",
+ readonly=True,
+ states={
+ "open": [
+ ("readonly", False),
+ ],
+ },
+ )
state = fields.Selection(
string="State",
selection=[
@@ -229,6 +267,17 @@ def _compute_result_id(self):
record.automatic_result_id = automatic_result
record.result_id = final_result
+ @api.depends(
+ "manual_result_id",
+ "automatic_result_id",
+ )
+ def _compute_need_dissenting_reason(self):
+ for record in self:
+ result = False
+ if record.manual_result_id != record.automatic_result_id:
+ result = True
+ record.need_dissenting_reason = result
+
@api.onchange(
"type_id",
)
diff --git a/ssi_risk_analysis/models/risk_analysis_conclusion.py b/ssi_risk_analysis/models/risk_analysis_conclusion.py
new file mode 100644
index 0000000..4cc3bcb
--- /dev/null
+++ b/ssi_risk_analysis/models/risk_analysis_conclusion.py
@@ -0,0 +1,11 @@
+# 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 models
+
+
+class RiskAnalysisConslusion(models.Model):
+ _name = "risk_analysis_conclusion"
+ _inherit = ["mixin.master_data"]
+ _description = "Risk Analysis Conclusion"
diff --git a/ssi_risk_analysis/models/risk_analysis_type.py b/ssi_risk_analysis/models/risk_analysis_type.py
index f028d71..3921620 100644
--- a/ssi_risk_analysis/models/risk_analysis_type.py
+++ b/ssi_risk_analysis/models/risk_analysis_type.py
@@ -31,6 +31,17 @@ class RiskAnalysisType(models.Model):
default="result = False",
required=True,
)
+ conclusion_ids = fields.One2many(
+ string="Risk Analysis Conclusions",
+ comodel_name="risk_analysis_type.conclusion",
+ inverse_name="type_id",
+ )
+ allowed_conclusion_ids = fields.Many2many(
+ string="Allowed Risk Analysis Conclusions",
+ comodel_name="risk_analysis_conclusion",
+ compute="_compute_allowed_conclusion_ids",
+ store=False,
+ )
def _compute_allowed_result_ids(self):
for record in self:
@@ -38,3 +49,10 @@ def _compute_allowed_result_ids(self):
for ra_result in record.result_ids:
result += ra_result.result_id
record.allowed_result_ids = result
+
+ def _compute_allowed_conclusion_ids(self):
+ for record in self:
+ result = self.env["risk_analysis_conclusion"]
+ for ra_conclusion in record.conclusion_ids:
+ result += ra_conclusion.conclusion_id
+ record.allowed_conclusion_ids = result
diff --git a/ssi_risk_analysis/models/risk_analysis_type_conclusion.py b/ssi_risk_analysis/models/risk_analysis_type_conclusion.py
new file mode 100644
index 0000000..1d17045
--- /dev/null
+++ b/ssi_risk_analysis/models/risk_analysis_type_conclusion.py
@@ -0,0 +1,29 @@
+# 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 fields, models
+
+
+class RiskAnalysisTypeConclusion(models.Model):
+ _name = "risk_analysis_type.conclusion"
+ _description = "Risk Analysis Type - Conclusion"
+ _order = "type_id, sequence, id"
+
+ type_id = fields.Many2one(
+ string="Type",
+ comodel_name="risk_analysis_type",
+ required=True,
+ ondelete="cascade",
+ )
+ sequence = fields.Integer(
+ string="Sequence",
+ default=10,
+ required=True,
+ )
+ conclusion_id = fields.Many2one(
+ string="Conclusion",
+ comodel_name="risk_analysis_conclusion",
+ required=True,
+ onldete="restrict",
+ )
diff --git a/ssi_risk_analysis/models/risk_analysis_worksheet.py b/ssi_risk_analysis/models/risk_analysis_worksheet.py
index a7f6d75..a27c8a8 100644
--- a/ssi_risk_analysis/models/risk_analysis_worksheet.py
+++ b/ssi_risk_analysis/models/risk_analysis_worksheet.py
@@ -198,6 +198,44 @@ class RiskAnalysisWorksheet(models.Model):
compute="_compute_result_id",
store=True,
)
+ need_dissenting_reason = fields.Boolean(
+ string="Need Dissenting Reason",
+ compute="_compute_need_dissenting_reason",
+ store=True,
+ )
+ dissenting_reason = fields.Text(
+ string="Dissenting Reason",
+ readonly=True,
+ states={
+ "open": [
+ ("readonly", False),
+ ],
+ },
+ )
+ allowed_conclusion_ids = fields.Many2many(
+ string="Allowed Risk Analysis Conclusions",
+ related="item_id.allowed_conclusion_ids",
+ store=False,
+ )
+ conclusion_id = fields.Many2one(
+ string="Conclusion",
+ comodel_name="risk_analysis_conclusion",
+ readonly=True,
+ states={
+ "open": [
+ ("readonly", False),
+ ],
+ },
+ )
+ conclusion = fields.Text(
+ string="Conclusion Reasoning",
+ readonly=True,
+ states={
+ "open": [
+ ("readonly", False),
+ ],
+ },
+ )
state = fields.Selection(
string="State",
selection=[
@@ -227,6 +265,17 @@ def _compute_allowed_item_ids(self):
result += item.item_id
record.allowed_item_ids = result
+ @api.depends(
+ "manual_result_id",
+ "automatic_result_id",
+ )
+ def _compute_need_dissenting_reason(self):
+ for record in self:
+ result = False
+ if record.manual_result_id != record.automatic_result_id:
+ result = True
+ record.need_dissenting_reason = result
+
@api.depends(
"item_id",
)
diff --git a/ssi_risk_analysis/models/risk_item.py b/ssi_risk_analysis/models/risk_item.py
index 5bb4f3c..f49c20b 100644
--- a/ssi_risk_analysis/models/risk_item.py
+++ b/ssi_risk_analysis/models/risk_item.py
@@ -15,6 +15,11 @@ class RiskItem(models.Model):
comodel_name="risk_item.result",
inverse_name="item_id",
)
+ conclusion_ids = fields.One2many(
+ string="Conclusions",
+ comodel_name="risk_item.conclusion",
+ inverse_name="item_id",
+ )
method = fields.Selection(
string="Method",
selection=[
@@ -29,19 +34,24 @@ class RiskItem(models.Model):
string="Worksheet Type",
comodel_name="risk_analysis_worksheet_type",
)
-
- @api.onchange(
- "method",
- )
- def onchange_worksheet_type_id(self):
- self.worksheet_type_id = False
-
allowed_result_ids = fields.Many2many(
string="Allowed Risk Analysis Results",
comodel_name="risk_analysis_result",
compute="_compute_allowed_result_ids",
store=False,
)
+ allowed_conclusion_ids = fields.Many2many(
+ string="Allowed Risk Analysis Conclusions",
+ comodel_name="risk_analysis_conclusion",
+ compute="_compute_allowed_conclusion_ids",
+ store=False,
+ )
+
+ @api.onchange(
+ "method",
+ )
+ def onchange_worksheet_type_id(self):
+ self.worksheet_type_id = False
def _compute_allowed_result_ids(self):
for record in self:
@@ -49,3 +59,10 @@ def _compute_allowed_result_ids(self):
for ra_result in record.result_ids:
result += ra_result.result_id
record.allowed_result_ids = result
+
+ def _compute_allowed_conclusion_ids(self):
+ for record in self:
+ result = self.env["risk_analysis_conclusion"]
+ for ra_conclusion in record.conclusion_ids:
+ result += ra_conclusion.conclusion_id
+ record.allowed_conclusion_ids = result
diff --git a/ssi_risk_analysis/models/risk_item_conclusion.py b/ssi_risk_analysis/models/risk_item_conclusion.py
new file mode 100644
index 0000000..c301bdc
--- /dev/null
+++ b/ssi_risk_analysis/models/risk_item_conclusion.py
@@ -0,0 +1,29 @@
+# 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 fields, models
+
+
+class RiskItemConclusion(models.Model):
+ _name = "risk_item.conclusion"
+ _description = "Risk Item Conclusion"
+ _order = "item_id, sequence, id"
+
+ item_id = fields.Many2one(
+ string="Item",
+ comodel_name="risk_item",
+ required=True,
+ ondelete="cascade",
+ )
+ sequence = fields.Integer(
+ string="Sequence",
+ default=10,
+ required=True,
+ )
+ conclusion_id = fields.Many2one(
+ string="Conclusion",
+ comodel_name="risk_analysis_conclusion",
+ required=True,
+ onldete="restrict",
+ )
diff --git a/ssi_risk_analysis/security/ir.model.access.csv b/ssi_risk_analysis/security/ir.model.access.csv
index 0cfecbe..1deff75 100644
--- a/ssi_risk_analysis/security/ir.model.access.csv
+++ b/ssi_risk_analysis/security/ir.model.access.csv
@@ -5,12 +5,18 @@ access_risk_analysis_type_item_configurator,risk_analysis_type_item - configurat
access_risk_analysis_type_item_all,risk_analysis_type_item - all user,model_risk_analysis_type_item,,1,0,0,0
access_risk_analysis_type_result_configurator,risk_analysis_type_result - configurator,model_risk_analysis_type_result,risk_analysis_type_group,1,1,1,1
access_risk_analysis_type_result_all,risk_analysis_type_result - all user,model_risk_analysis_type_result,,1,0,0,0
+access_risk_analysis_type_conclusion_configurator,risk_analysis_type_conclusion - configurator,model_risk_analysis_type_conclusion,risk_analysis_type_group,1,1,1,1
+access_risk_analysis_type_conclusion_all,risk_analysis_type_conclusion - all user,model_risk_analysis_type_conclusion,,1,0,0,0
access_risk_analysis_result_configurator,risk_analysis_result - configurator,model_risk_analysis_result,risk_analysis_result_group,1,1,1,1
access_risk_analysis_result_all,risk_analysis_result - all user,model_risk_analysis_result,,1,0,0,0
+access_risk_analysis_conclusion_configurator,risk_analysis_conclusion - configurator,model_risk_analysis_conclusion,risk_analysis_conclusion_group,1,1,1,1
+access_risk_analysis_conclusion_all,risk_analysis_conclusion - all user,model_risk_analysis_conclusion,,1,0,0,0
access_risk_item_configurator,risk_item - configurator,model_risk_item,risk_item_group,1,1,1,1
access_risk_item_all,risk_item - all user,model_risk_item,,1,0,0,0
access_risk_item_result_configurator,risk_item_result - configurator,model_risk_item_result,risk_item_group,1,1,1,1
access_risk_item_result_all,risk_item_result - all user,model_risk_item_result,,1,0,0,0
+access_risk_item_conclusion_configurator,risk_item_conclusion - configurator,model_risk_item_conclusion,risk_item_group,1,1,1,1
+access_risk_item_conclusion_all,risk_item_conclusion - all user,model_risk_item_conclusion,,1,0,0,0
access_risk_analysis_worksheet_type_configurator,risk_analysis_worksheet_type - all,model_risk_analysis_worksheet_type,risk_analysis_worksheet_type_group,1,1,1,1
access_risk_analysis_worksheet_type_all,risk_analysis_worksheet_type - all,model_risk_analysis_worksheet_type,,1,0,0,0
access_risk_analysis_all,risk_analysis - all,model_risk_analysis,,1,0,0,0
diff --git a/ssi_risk_analysis/security/res_group_data.xml b/ssi_risk_analysis/security/res_group_data.xml
index f0349d3..674b07c 100644
--- a/ssi_risk_analysis/security/res_group_data.xml
+++ b/ssi_risk_analysis/security/res_group_data.xml
@@ -29,6 +29,18 @@
/>
+
+ Risk Analysis Conclusion
+
+
+
+
Risk Analysis Worksheet Type
+
+
+
+ risk_analysis_conclusion - search
+ risk_analysis_conclusion
+
+ primary
+
+
+
+
+
+
+ risk_analysis_conclusion - tree
+ risk_analysis_conclusion
+
+ primary
+
+
+
+
+
+
+ risk_analysis_conclusion - form
+ risk_analysis_conclusion
+
+ primary
+
+
+
+
+
+
+
+ Risk Analysis Conclusions
+ ir.actions.act_window
+ risk_analysis_conclusion
+ tree,form
+
+
+
+
+
diff --git a/ssi_risk_analysis/views/risk_analysis_type_views.xml b/ssi_risk_analysis/views/risk_analysis_type_views.xml
index 9415fbd..61c969d 100644
--- a/ssi_risk_analysis/views/risk_analysis_type_views.xml
+++ b/ssi_risk_analysis/views/risk_analysis_type_views.xml
@@ -67,6 +67,14 @@
/>
+
+
+
+
+
+
+
+
diff --git a/ssi_risk_analysis/views/risk_analysis_views.xml b/ssi_risk_analysis/views/risk_analysis_views.xml
index e3b665e..281c866 100644
--- a/ssi_risk_analysis/views/risk_analysis_views.xml
+++ b/ssi_risk_analysis/views/risk_analysis_views.xml
@@ -32,6 +32,7 @@
+
@@ -99,24 +100,43 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ssi_risk_analysis/views/risk_analysis_worksheet_views.xml b/ssi_risk_analysis/views/risk_analysis_worksheet_views.xml
index d283d8e..7330b0d 100644
--- a/ssi_risk_analysis/views/risk_analysis_worksheet_views.xml
+++ b/ssi_risk_analysis/views/risk_analysis_worksheet_views.xml
@@ -86,24 +86,43 @@
force_save="1"
/>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ssi_risk_analysis/views/risk_item_views.xml b/ssi_risk_analysis/views/risk_item_views.xml
index e49ad90..3f94dea 100644
--- a/ssi_risk_analysis/views/risk_item_views.xml
+++ b/ssi_risk_analysis/views/risk_item_views.xml
@@ -52,6 +52,14 @@
+
+
+
+
+
+
+
+