mirror of
https://github.com/bringout/oca-project.git
synced 2026-04-18 13:22:06 +02:00
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
from odoo.tests.common import TransactionCase
|
|
|
|
|
|
class TestProjectRisk(TransactionCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
super().setUpClass()
|
|
cls.project = cls.env["project.project"].create(
|
|
{"name": "Research & Development", "privacy_visibility": "followers"}
|
|
)
|
|
cls.risk_category = cls.env["project.risk.category"].create({"name": "Quality"})
|
|
cls.risk = cls.env["project.risk"].create(
|
|
{
|
|
"name": "Risk X",
|
|
"project_id": cls.project.id,
|
|
"project_risk_category_id": cls.risk_category.id,
|
|
"probability": "2",
|
|
"impact": "2",
|
|
}
|
|
)
|
|
|
|
def test_project(self):
|
|
self.assertEqual(self.project.project_risk_count, 1)
|
|
action = self.project.view_risk()
|
|
self.assertEqual(action["context"]["default_project_id"], self.project.id)
|
|
self.assertListEqual(action["domain"], [("project_id", "=", self.project.id)])
|
|
|
|
def test_risk(self):
|
|
self.risk.write({"actionee_id": self.env.user.id, "owner_id": self.env.user.id})
|
|
self.assertEqual(self.risk.rating, "4")
|