Skip to content

Projects

ProjectNamespace for the project.project model, accessed as client.projects.

projects

Project (project.project) operations for Vodoo.

ProjectNamespace

ProjectNamespace(client: OdooClient)

Bases: _ProjectAttrs, DomainNamespace

Namespace for project.project operations.

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

stages

stages(project_id: int | None = None) -> list[dict[str, Any]]

List task stages, optionally filtered by project.

PARAMETER DESCRIPTION
project_id

Project ID to filter stages (None = all stages)

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
list[dict[str, Any]]

List of stage dictionaries with id, name, sequence, fold

Source code in src/vodoo/projects.py
def stages(self, project_id: int | None = None) -> list[dict[str, Any]]:
    """List task stages, optionally filtered by project.

    Args:
        project_id: Project ID to filter stages (None = all stages)

    Returns:
        List of stage dictionaries with id, name, sequence, fold

    """
    domain: list[Any] = []
    if project_id is not None:
        domain.append(("project_ids", "in", [project_id]))

    return self._client.search_read(
        "project.task.type",
        domain=domain,
        fields=STAGE_FIELDS,
        order="sequence",
    )

display_stages

display_stages(stages: list[dict[str, Any]]) -> None

Display stages in a table, TSV, or JSON format.

PARAMETER DESCRIPTION
stages

List of stage dictionaries

TYPE: list[dict[str, Any]]

Source code in src/vodoo/projects.py
def display_stages(stages: list[dict[str, Any]]) -> None:
    """Display stages in a table, TSV, or JSON format.

    Args:
        stages: List of stage dictionaries

    """
    from vodoo.base import _is_simple_output, is_structured_output, structured_print

    if is_structured_output():
        structured_print(stages)
        return

    if _is_simple_output():
        print("id\tname\tsequence\tfold")
        for stage in stages:
            fold = "true" if stage.get("fold") else "false"
            print(f"{stage['id']}\t{stage['name']}\t{stage.get('sequence', '')}\t{fold}")
    else:
        from rich.console import Console
        from rich.table import Table

        console = Console()
        table = Table(show_header=True, header_style="bold magenta")
        table.add_column("ID", style="cyan", justify="right")
        table.add_column("Name", style="green")
        table.add_column("Sequence", justify="right")
        table.add_column("Folded", justify="center")

        for stage in stages:
            table.add_row(
                str(stage["id"]),
                stage["name"],
                str(stage.get("sequence", "")),
                "✓" if stage.get("fold") else "",
            )

        console.print(table)