mirror of
https://github.com/odoo-ide/odoo-stubs.git
synced 2025-05-08 16:52:26 +03:00
81 lines
2.6 KiB
Python
81 lines
2.6 KiB
Python
from typing import Any, Optional
|
|
|
|
from ...api import Environment
|
|
from ...models import BaseModel
|
|
from .exception import NoComponentError as NoComponentError
|
|
from .exception import SeveralComponentError as SeveralComponentError
|
|
from .models.collection import Collection
|
|
|
|
DEFAULT_CACHE_SIZE: int
|
|
|
|
class ComponentDatabases(dict): ...
|
|
|
|
class ComponentRegistry:
|
|
ready: bool
|
|
def __init__(self, cachesize=...) -> None: ...
|
|
def __getitem__(self, key): ...
|
|
def __setitem__(self, key, value) -> None: ...
|
|
def __contains__(self, key) -> bool: ...
|
|
def get(self, key, default: Any | None = None): ...
|
|
def __iter__(self): ...
|
|
def load_components(self, module) -> None: ...
|
|
def lookup(
|
|
self,
|
|
collection_name: str | None = None,
|
|
usage: str | None = None,
|
|
model_name: str | None = None,
|
|
): ...
|
|
|
|
class WorkContext:
|
|
collection: Collection
|
|
model_name: str
|
|
model: BaseModel
|
|
components_registry: ComponentRegistry
|
|
def __init__(
|
|
self,
|
|
model_name: str | None = None,
|
|
collection: Optional[Collection] = None,
|
|
components_registry: ComponentRegistry | None = None,
|
|
**kwargs
|
|
) -> None: ...
|
|
@property
|
|
def env(self) -> Environment: ...
|
|
def work_on(
|
|
self, model_name: str | None = None, collection: Optional[Collection] = None
|
|
) -> WorkContext: ...
|
|
def component_by_name(
|
|
self, name: str, model_name: str | BaseModel | None = None
|
|
) -> Component: ...
|
|
def component(
|
|
self, usage: str | None = None, model_name: str | BaseModel | None = None, **kw
|
|
) -> Component: ...
|
|
def many_components(
|
|
self, usage: str | None = None, model_name: str | BaseModel | None = None, **kw
|
|
) -> list[Component]: ...
|
|
|
|
class MetaComponent(type):
|
|
def __init__(cls: type[AbstractComponent], name, bases, attrs) -> None: ...
|
|
@property
|
|
def apply_on_models(cls: type[AbstractComponent]): ...
|
|
|
|
class AbstractComponent(metaclass=MetaComponent):
|
|
work: WorkContext
|
|
def __init__(self, work_context: WorkContext) -> None: ...
|
|
@property
|
|
def collection(self) -> Collection: ...
|
|
@property
|
|
def env(self) -> Environment: ...
|
|
@property
|
|
def model(self) -> BaseModel: ...
|
|
def component_by_name(
|
|
self, name: str, model_name: str | BaseModel | None = None
|
|
) -> Component: ...
|
|
def component(
|
|
self, usage: str | None = None, model_name: str | BaseModel | None = None, **kw
|
|
) -> Component: ...
|
|
def many_components(
|
|
self, usage: str | None = None, model_name: str | BaseModel | None = None, **kw
|
|
) -> list[Component]: ...
|
|
|
|
class Component(AbstractComponent): ...
|