Skip to content

Async Knowledge

AsyncKnowledgeNamespace for the knowledge.article model (Odoo Enterprise), accessed as client.knowledge on AsyncOdooClient.

knowledge

Async knowledge article operations for Vodoo.

AsyncKnowledgeNamespace

AsyncKnowledgeNamespace(client: AsyncOdooClient)

Bases: _KnowledgeAttrs, AsyncDomainNamespace

Async namespace for knowledge.article model.

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

create async

create(name: str, *, body: str | None = None, parent_id: int | None = None, category: str | None = None, icon: str | None = None, **extra_fields: Any) -> int

Create a knowledge article.

Source code in src/vodoo/aio/knowledge.py
async def create(
    self,
    name: str,
    *,
    body: str | None = None,
    parent_id: int | None = None,
    category: str | None = None,
    icon: str | None = None,
    **extra_fields: Any,
) -> int:
    """Create a knowledge article."""
    values = _build_article_values(
        name,
        body=body,
        parent_id=parent_id,
        category=category,
        icon=icon,
        **extra_fields,
    )
    return await self._client.create(self._model, values)

url async

url(record_id: int) -> str

Get the web URL for a knowledge article.

Tries the article_url field first, falls back to the standard URL.

Source code in src/vodoo/aio/knowledge.py
async def url(self, record_id: int) -> str:  # type: ignore[override]
    """Get the web URL for a knowledge article.

    Tries the ``article_url`` field first, falls back to the standard URL.
    """
    article = await self.get(record_id, fields=["article_url"])
    if article.get("article_url"):
        return str(article["article_url"])
    return super().url(record_id)