mirror of
https://github.com/bringout/oca-project.git
synced 2026-04-18 11:42:06 +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,3 @@
|
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0).
|
||||
|
||||
from . import test_create_material_lines
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
# Copyright 2018 - Brain-tec AG - Carlos Jesus Cebrian
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0).
|
||||
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestProjectCases(TransactionCase):
|
||||
"""Prepare data to test the module."""
|
||||
|
||||
def setUp(self):
|
||||
"""Create user, task, project as well as refre action of the user."""
|
||||
super(TestProjectCases, self).setUp()
|
||||
|
||||
# Create new User
|
||||
# Add it to the `project user` group
|
||||
self.project_user = self.env["res.users"].create(
|
||||
{
|
||||
"company_id": self.env.ref("base.main_company").id,
|
||||
"name": "Carlos Project User",
|
||||
"login": "cpu",
|
||||
"email": "cpu@yourcompany.com",
|
||||
"groups_id": [(6, 0, [self.ref("project.group_project_user")])],
|
||||
}
|
||||
)
|
||||
|
||||
# Create new project
|
||||
self.project = self.env["project.project"].create({"name": "Project Test"})
|
||||
|
||||
# Create new task
|
||||
self.task = self.env["project.task"].create(
|
||||
{"project_id": self.project.id, "name": "Task Test"}
|
||||
)
|
||||
self.product = self.env.ref("product.consu_delivery_03")
|
||||
|
||||
# Refer to a action from the user created
|
||||
self.action = self.task.with_user(self.project_user.id)
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
# Copyright 2016 Tecnativa - Vicent Cubells
|
||||
# Copyright 2018 - Brain-tec AG - Carlos Jesus Cebrian
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0).
|
||||
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
from .common import TestProjectCases
|
||||
|
||||
|
||||
class ProjectTaskMaterial(TestProjectCases):
|
||||
def test_manager_add_task_material_wrong(self):
|
||||
"""
|
||||
TEST CASE 1
|
||||
The user is adding some materials in the task
|
||||
with different wrong values
|
||||
|
||||
"""
|
||||
try:
|
||||
# Material with `quantity = 0.0`
|
||||
self.action.write(
|
||||
{
|
||||
"material_ids": [
|
||||
(0, 0, {"product_id": self.product.id, "quantity": 0.0})
|
||||
]
|
||||
}
|
||||
)
|
||||
except ValidationError as err:
|
||||
self.assertEqual(
|
||||
str(err.args[0]),
|
||||
"Quantity of material consumed must be greater than 0.",
|
||||
)
|
||||
|
||||
try:
|
||||
# Material with `negative quantity`
|
||||
self.action.write(
|
||||
{
|
||||
"material_ids": [
|
||||
(0, 0, {"product_id": self.product.id, "quantity": -10.0})
|
||||
]
|
||||
}
|
||||
)
|
||||
except ValidationError as err:
|
||||
self.assertEqual(
|
||||
str(err.args[0]),
|
||||
"Quantity of material consumed must be greater than 0.",
|
||||
)
|
||||
|
||||
def test_manager_add_task_material_right(self):
|
||||
"""
|
||||
TEST CASE 2
|
||||
The user is adding some materials in the task
|
||||
with right values
|
||||
|
||||
"""
|
||||
# Material with `quantity = 1.0`
|
||||
self.action.write(
|
||||
{"material_ids": [(0, 0, {"product_id": self.product.id, "quantity": 4.0})]}
|
||||
)
|
||||
self.assertEqual(len(self.task.material_ids.ids), 1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue