Skip to content

Async Projects

AsyncProjectNamespace for the project.project model, accessed as client.projects on AsyncOdooClient.

projects

Async project (project.project) operations for Vodoo.

AsyncProjectNamespace

AsyncProjectNamespace(client: AsyncOdooClient)

Bases: GeneratedAsyncProjectNamespace

Async namespace for custom project.project workflows.

Source code in src/vodoo/aio/_domain.py
def __init__(self, client: AsyncOdooClient) -> None:
    self._client = client

resolve_project_id async

resolve_project_id(project: int | str) -> int

Resolve a project ID or exact project name to an ID.

Source code in src/vodoo/aio/projects.py
async def resolve_project_id(self, project: int | str) -> int:
    """Resolve a project ID or exact project name to an ID."""
    numeric_id = _numeric_project_id(project)
    if numeric_id is not None:
        return numeric_id

    assert isinstance(project, str)
    candidates = await self._client.search_read(
        self._model,
        domain=[("name", "=ilike", project)],
        fields=["id", "name"],
        order="id",
    )
    return _resolved_project_name(candidates, project)

milestones async

milestones(project: int | str) -> list[dict[str, Any]]

List milestones for a project ID or exact project name.

Source code in src/vodoo/aio/projects.py
async def milestones(self, project: int | str) -> list[dict[str, Any]]:
    """List milestones for a project ID or exact project name."""
    project_id = await self.resolve_project_id(project)
    return await self._client.search_read(
        "project.milestone",
        domain=[("project_id", "=", project_id)],
        fields=MILESTONE_FIELDS,
        order="deadline, id",
    )

create_milestone async

create_milestone(project: int | str, name: str, deadline: str) -> int

Create a milestone for a project ID or exact project name.

Source code in src/vodoo/aio/projects.py
async def create_milestone(self, project: int | str, name: str, deadline: str) -> int:
    """Create a milestone for a project ID or exact project name."""
    project_id = await self.resolve_project_id(project)
    return await self._client.create(
        "project.milestone",
        {"project_id": project_id, "name": name, "deadline": deadline},
    )