Skip to content

Commit

Permalink
[ssi_risk_analysis] 14.0.1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
usa8bit committed Oct 15, 2023
1 parent 3e5fd61 commit 42a7870
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ssi_risk_analysis/models/risk_analysis_worksheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Copyright 2022 PT. Simetri Sinergi Indonesia
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0-standalone.html).

from odoo import api, fields, models
from odoo import _, api, fields, models
from odoo.tools.safe_eval import safe_eval
from odoo.exceptions import ValidationError
from odoo.exceptions import Warning as UserError


class RiskAnalysisWorksheet(models.Model):
Expand Down Expand Up @@ -318,4 +318,13 @@ def _check_item_id(self):
('id', '!=', record.id)
])
if items:
raise ValidationError("The risk item '%s - %s' is already used." % (record.item_id.name, record.risk_analysis_id.name))
error_message = _(
"""
Context: You can not select the same risk item
Database ID: %s
Problem: Risk item: %s is used
Solution: Use another risk item
"""
% (record.id, record.item_id.name,)
)
raise UserError(error_message)

0 comments on commit 42a7870

Please sign in to comment.