Skip to content

Commit

Permalink
[IMP] project_task_material: pre-commit stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
aljaro committed Jul 13, 2023
1 parent 532c855 commit 870c4c5
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion project_task_material/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"name": "Project Task Material",
"summary": "Record products spent in a Task",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"category": "Project Management",
"author": "Daniel Reis," "Tecnativa," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/project",
Expand Down
33 changes: 25 additions & 8 deletions project_task_material/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ 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
# Create a new project user
self.project_user = self.env["res.users"].create(
{
"company_id": self.env.ref("base.main_company").id,
Expand All @@ -23,9 +21,28 @@ def setUp(self):
}
)

# Refer to a task assigned to the project user
self.task = self.env.ref("project.project_task_2")
self.product = self.env.ref("product.consu_delivery_03")
# Create a project
self.project = self.env["project.project"].create(
{
"company_id": self.env.ref("base.main_company").id,
"name": "Project for Test",
}
)

# Create a project task
self.project_task = self.env["project.task"].create(
{
"project_id": self.project.id,
"name": "Task for Test",
}
)

# Create a product template
self.product = self.env["product.template"].create(
{
"name": "Product for Test",
}
)

# Refer to a action from the user created
self.action = self.task.with_user(self.project_user.id)
# Set the user for the project task action
self.action = self.project_task.with_user(self.project_user.id)
2 changes: 1 addition & 1 deletion project_task_material/tests/test_create_material_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ def test_manager_add_task_material_right(self):
self.action.write(
{"material_ids": [(0, 0, {"product_id": self.product.id, "quantity": 4.0})]}
)
self.assertEqual(len(self.task.material_ids.ids), 1)
self.assertEqual(len(self.action.material_ids.ids), 1)
6 changes: 6 additions & 0 deletions setup/project_task_material/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 870c4c5

Please sign in to comment.