mirror of
https://github.com/bringout/oca-project.git
synced 2026-04-18 15:02:00 +02:00
Move 124 sale modules to oca-sale, create oca-project with 56 project modules from oca-workflow-process
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9eb7ae5807
commit
6094c218b2
2332 changed files with 125826 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
from . import test_project_milestone_status
|
||||
from . import test_project_status
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
from odoo.tests import new_test_user
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class ProjectMilestoneStatusCommon(TransactionCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
|
||||
cls.timesheet_line_model = cls.env["account.analytic.line"]
|
||||
cls.project1 = cls.env["project.project"].create({"name": "Project 1"})
|
||||
cls.milestone1 = cls.env["project.milestone"].create(
|
||||
{"name": "Milestone 1", "project_id": cls.project1.id}
|
||||
)
|
||||
cls.user = new_test_user(
|
||||
cls.env, login="test-user", groups="hr_timesheet.group_hr_timesheet_user"
|
||||
)
|
||||
cls.employee_1 = cls.env["hr.employee"].create(
|
||||
{
|
||||
"name": "Test employee 1",
|
||||
"user_id": cls.user.id,
|
||||
}
|
||||
)
|
||||
cls.task1 = cls.env["project.task"].create(
|
||||
{
|
||||
"name": "name1",
|
||||
"project_id": cls.project1.id,
|
||||
"milestone_id": cls.milestone1.id,
|
||||
"planned_hours": 5.0,
|
||||
}
|
||||
)
|
||||
cls.task2 = cls.env["project.task"].create(
|
||||
{
|
||||
"name": "name2",
|
||||
"project_id": cls.project1.id,
|
||||
"milestone_id": cls.milestone1.id,
|
||||
"planned_hours": 5.0,
|
||||
}
|
||||
)
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
from odoo.addons.project_milestone_status.tests.common import (
|
||||
ProjectMilestoneStatusCommon,
|
||||
)
|
||||
|
||||
|
||||
class TestProjectMilestoneStatus(ProjectMilestoneStatusCommon):
|
||||
def test_check_execution_empty(self):
|
||||
project_milestone_id = self.project1.milestone_ids.browse(self.milestone1.id)
|
||||
self.assertEqual(
|
||||
project_milestone_id.execution, 0, "There is no execution at the milestone"
|
||||
)
|
||||
|
||||
def test_check_execution_done(self):
|
||||
project_milestone_id = self.project1.milestone_ids.browse(self.milestone1.id)
|
||||
self.task1.write(
|
||||
{
|
||||
"stage_id": self.env["project.task.type"]
|
||||
.search([("fold", "=", True)], limit=1)
|
||||
.id
|
||||
}
|
||||
)
|
||||
self.assertEqual(
|
||||
project_milestone_id.execution,
|
||||
50,
|
||||
"There is a 50 percent execution of the milestone",
|
||||
)
|
||||
|
||||
def test_check_dedication_empty(self):
|
||||
project_milestone_id = self.project1.milestone_ids.browse(self.milestone1.id)
|
||||
self.assertEqual(
|
||||
project_milestone_id.dedication,
|
||||
0,
|
||||
"There is no dedication in the milestone",
|
||||
)
|
||||
|
||||
def test_check_dedication_done(self):
|
||||
project_milestone_id = self.project1.milestone_ids.browse(self.milestone1.id)
|
||||
self.timesheet_line_model.create(
|
||||
{
|
||||
"name": "test",
|
||||
"employee_id": self.employee_1.id,
|
||||
"unit_amount": 2.0,
|
||||
"project_id": self.project1.id,
|
||||
"task_id": self.task1.id,
|
||||
}
|
||||
)
|
||||
self.assertEqual(
|
||||
project_milestone_id.dedication,
|
||||
20,
|
||||
"There is a 20 percent dedication in the milestone",
|
||||
)
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
from odoo.addons.project_milestone_status.tests.common import (
|
||||
ProjectMilestoneStatusCommon,
|
||||
)
|
||||
|
||||
|
||||
class TestProjectStatus(ProjectMilestoneStatusCommon):
|
||||
def test_check_execution_empty(self):
|
||||
self.assertEqual(self.project1._get_execution()["all_task"], 2)
|
||||
self.assertEqual(self.project1._get_execution()["excuted"], 0)
|
||||
self.assertEqual(self.project1._get_execution()["percent"], 0)
|
||||
|
||||
def test_check_execution_done(self):
|
||||
self.task1.write(
|
||||
{
|
||||
"stage_id": self.env["project.task.type"]
|
||||
.search([("fold", "=", True)], limit=1)
|
||||
.id
|
||||
}
|
||||
)
|
||||
self.assertEqual(self.project1._get_execution()["all_task"], 2)
|
||||
self.assertEqual(self.project1._get_execution()["excuted"], 5)
|
||||
self.assertEqual(self.project1._get_execution()["percent"], 50)
|
||||
|
||||
def test_check_dedication_empty(self):
|
||||
self.assertEqual(self.project1._get_dedication()["dedicated"], 0)
|
||||
self.assertEqual(self.project1._get_dedication()["percent"], 0)
|
||||
|
||||
def test_check_dedication_done(self):
|
||||
self.project1.milestone_ids.browse(self.milestone1.id)
|
||||
self.timesheet_line_model.create(
|
||||
{
|
||||
"name": "test",
|
||||
"employee_id": self.employee_1.id,
|
||||
"unit_amount": 2.0,
|
||||
"project_id": self.project1.id,
|
||||
"task_id": self.task1.id,
|
||||
}
|
||||
)
|
||||
self.assertEqual(self.project1._get_dedication()["dedicated"], 2)
|
||||
self.assertEqual(self.project1._get_dedication()["percent"], 20)
|
||||
Loading…
Add table
Add a link
Reference in a new issue