mirror of
https://github.com/odoo-ide/odoo-stubs.git
synced 2025-05-08 16:52:26 +03:00
Update stubs
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
from codecs import CodecInfo
|
||||
from re import Pattern
|
||||
|
||||
from . import addons as addons
|
||||
from . import api as api
|
||||
from . import conf as conf
|
||||
@@ -18,6 +21,8 @@ from .tools.translate import _lt as _lt
|
||||
|
||||
evented: bool
|
||||
multi_process: bool
|
||||
iso8859_8: CodecInfo
|
||||
iso8859_8ie_re: Pattern
|
||||
SUPERUSER_ID: int
|
||||
|
||||
def registry(database_name: str | None = ...) -> Registry: ...
|
||||
|
||||
@@ -21,7 +21,7 @@ from .fields import Field
|
||||
from .models import BaseModel
|
||||
from .modules.registry import Registry
|
||||
from .sql_db import Cursor
|
||||
from .tools import StackMap, frozendict
|
||||
from .tools import SQL, StackMap, frozendict
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_ModelT = TypeVar("_ModelT", bound=BaseModel)
|
||||
@@ -63,12 +63,18 @@ class Environment(Mapping[str, BaseModel]):
|
||||
su: bool = ...
|
||||
args: tuple[Cursor, int, dict, bool]
|
||||
def reset(self) -> None: ...
|
||||
uid_origin: int | None
|
||||
all: Transaction
|
||||
transaction: Transaction
|
||||
registry: Registry
|
||||
cache: Cache
|
||||
def __new__(
|
||||
cls, cr: Cursor, uid: int | None, context: dict, su: bool = ...
|
||||
cls,
|
||||
cr: Cursor,
|
||||
uid: int | None,
|
||||
context: dict,
|
||||
su: bool = ...,
|
||||
uid_origin: int | None = ...,
|
||||
) -> Environment: ...
|
||||
def __contains__(self, model_name) -> bool: ...
|
||||
def __getitem__(self, model_name: str) -> BaseModel: ...
|
||||
@@ -113,6 +119,8 @@ class Environment(Mapping[str, BaseModel]):
|
||||
def add_to_compute(self, field: Field, records: BaseModel): ...
|
||||
def remove_to_compute(self, field: Field, records: BaseModel) -> None: ...
|
||||
def cache_key(self, field: Field): ...
|
||||
def flush_query(self, query: SQL): ...
|
||||
def execute_query(self, query: SQL) -> list[tuple]: ...
|
||||
|
||||
class Transaction:
|
||||
registry: Registry
|
||||
|
||||
@@ -16,6 +16,7 @@ from typing import (
|
||||
import psycopg2
|
||||
from markupsafe import Markup
|
||||
|
||||
from . import SUPERUSER_ID as SUPERUSER_ID
|
||||
from .api import Environment, Registry
|
||||
from .models import BaseModel
|
||||
from .tools import date_utils, float_utils
|
||||
@@ -408,7 +409,6 @@ class Many2one(_Relational):
|
||||
def convert_to_write(self, value, record: BaseModel): ...
|
||||
def convert_to_export(self, value, record: BaseModel) -> str: ...
|
||||
def convert_to_display_name(self, value, record: BaseModel) -> str: ...
|
||||
def convert_to_onchange(self, value, record: BaseModel, names): ...
|
||||
def write(self, records: _ModelT, value) -> None: ...
|
||||
|
||||
class Many2oneReference(Integer):
|
||||
@@ -441,6 +441,7 @@ class Properties(Field):
|
||||
definition_record_field: str | None
|
||||
ALLOWED_TYPES: tuple[str, ...]
|
||||
compute: Callable
|
||||
def setup_related(self, model: BaseModel) -> None: ...
|
||||
def convert_to_column(
|
||||
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
|
||||
): ...
|
||||
@@ -451,7 +452,6 @@ class Properties(Field):
|
||||
): ...
|
||||
def convert_to_read_multi(self, values, records: BaseModel): ...
|
||||
def convert_to_write(self, value, record: BaseModel): ...
|
||||
def convert_to_onchange(self, value, record: BaseModel, names): ...
|
||||
def write(self, records: _ModelT, value) -> None: ...
|
||||
|
||||
class PropertiesDefinition(Field):
|
||||
|
||||
@@ -82,7 +82,7 @@ PREFETCH_MAX: int
|
||||
LOG_ACCESS_COLUMNS: list[str]
|
||||
MAGIC_COLUMNS: list[str]
|
||||
READ_GROUP_TIME_GRANULARITY: dict[str, dateutil.relativedelta.relativedelta]
|
||||
READ_GROUP_AGGREGATE: dict[str, Callable[[str, str], str]]
|
||||
READ_GROUP_AGGREGATE: dict[str, Callable[[str, str | SQL], SQL]]
|
||||
READ_GROUP_DISPLAY_FORMAT: dict[str, str]
|
||||
|
||||
def is_definition_class(cls) -> bool: ...
|
||||
@@ -111,6 +111,7 @@ class BaseModel(metaclass=MetaModel):
|
||||
_fold_name: str
|
||||
_translate: bool
|
||||
_check_company_auto: bool
|
||||
_allow_sudo_commands: bool
|
||||
_depends: dict[str, Iterable[str]]
|
||||
_transient_max_count: int
|
||||
_transient_max_hours: float
|
||||
@@ -121,8 +122,8 @@ class BaseModel(metaclass=MetaModel):
|
||||
_fields: dict[str, Field]
|
||||
_field_definitions: list[Field]
|
||||
_log_access: bool
|
||||
_ids: tuple
|
||||
_prefetch_ids: Iterable[int]
|
||||
_ids: tuple[int | NewId]
|
||||
_prefetch_ids: Iterable[int | NewId]
|
||||
env: Environment = ...
|
||||
pool: Registry
|
||||
id = fields.Id()
|
||||
@@ -147,6 +148,8 @@ class BaseModel(metaclass=MetaModel):
|
||||
@classmethod
|
||||
def _init_constraints_onchanges(cls) -> None: ...
|
||||
@property
|
||||
def _table_sql(self) -> SQL: ...
|
||||
@property
|
||||
def _constraint_methods(self) -> list: ...
|
||||
@property
|
||||
def _ondelete_methods(self) -> list: ...
|
||||
@@ -224,21 +227,12 @@ class BaseModel(metaclass=MetaModel):
|
||||
limit: int | None = ...,
|
||||
order: str | None = ...,
|
||||
) -> list[tuple]: ...
|
||||
def _read_group_select(
|
||||
self, aggregate_spec: str, query: Query
|
||||
) -> tuple[SQL, list[str]]: ...
|
||||
def _read_group_groupby(
|
||||
self, groupby_spec: str, query: Query
|
||||
) -> tuple[SQL, list[str]]: ...
|
||||
def _read_group_having(
|
||||
self, having_domain: list, query: Query
|
||||
) -> tuple[SQL, list[str]]: ...
|
||||
def _read_group_select(self, aggregate_spec: str, query: Query) -> SQL: ...
|
||||
def _read_group_groupby(self, groupby_spec: str, query: Query) -> SQL: ...
|
||||
def _read_group_having(self, having_domain: list, query: Query) -> SQL: ...
|
||||
def _read_group_orderby(
|
||||
self, order: str, groupby_terms: dict[str, SQL], query: Query
|
||||
) -> tuple[SQL, SQL, list[str]]: ...
|
||||
def _read_group_check_field_access_rights(
|
||||
self, field_names: Collection[str]
|
||||
) -> None: ...
|
||||
) -> tuple[SQL, SQL]: ...
|
||||
def _read_group_empty_value(self, spec: str) -> Any: ...
|
||||
def _read_group_postprocess_groupby(
|
||||
self, groupby_spec: str, raw_values
|
||||
@@ -283,11 +277,14 @@ class BaseModel(metaclass=MetaModel):
|
||||
lazy: bool = ...,
|
||||
) -> list[dict[str, Any]]: ...
|
||||
def _field_to_sql(
|
||||
self, alias: str, fname: str, query: Query | None = ...
|
||||
self, alias: str, fname: str, query: Query | None = ..., flush: bool = ...
|
||||
) -> SQL: ...
|
||||
def _field_properties_to_sql(
|
||||
self, alias: str, fname: str, property_name: str, query: Query
|
||||
) -> SQL: ...
|
||||
def _condition_to_sql(
|
||||
self, alias: str, fname: str, operator: str, value, query: Query
|
||||
) -> SQL: ...
|
||||
def get_property_definition(self, full_name: str) -> dict: ...
|
||||
def _parent_store_compute(self): ...
|
||||
def _check_removed_columns(self, log: bool = ...) -> None: ...
|
||||
|
||||
@@ -35,6 +35,7 @@ class Registry(Mapping[str, type[BaseModel]]):
|
||||
cache_sequences: dict
|
||||
has_unaccent: bool
|
||||
has_trigram: bool
|
||||
unaccent: Callable[[Any], str]
|
||||
def init(self, db_name: str) -> None: ...
|
||||
@classmethod
|
||||
def delete(cls, db_name: str) -> None: ...
|
||||
@@ -86,14 +87,17 @@ class Registry(Mapping[str, type[BaseModel]]):
|
||||
def cache_invalidated(self) -> set: ...
|
||||
def setup_signaling(self) -> None: ...
|
||||
def get_sequences(self, cr: Cursor) -> tuple[int, dict]: ...
|
||||
def check_signaling(self) -> Registry: ...
|
||||
def check_signaling(self, cr: Cursor) -> Registry: ...
|
||||
def signal_changes(self) -> None: ...
|
||||
def reset_changes(self) -> None: ...
|
||||
def manage_changes(self) -> None: ...
|
||||
def in_test_mode(self) -> bool: ...
|
||||
def enter_test_mode(self, cr: Cursor) -> None: ...
|
||||
test_readonly_enabled: bool
|
||||
def enter_test_mode(
|
||||
self, cr: Cursor, test_readonly_enabled: bool = ...
|
||||
) -> None: ...
|
||||
def leave_test_mode(self) -> None: ...
|
||||
def cursor(self) -> Cursor: ...
|
||||
def cursor(self, readonly: bool = ...) -> Cursor: ...
|
||||
|
||||
class DummyRLock:
|
||||
def acquire(self) -> None: ...
|
||||
|
||||
@@ -33,12 +33,14 @@ class PerfFilter(logging.Filter):
|
||||
def format_perf(
|
||||
self, query_count: int, query_time: float, remaining_time: float
|
||||
): ...
|
||||
def format_cursor_mode(self, cursor_mode): ...
|
||||
def filter(self, record: LogRecord): ...
|
||||
|
||||
class ColoredPerfFilter(PerfFilter):
|
||||
def format_perf(
|
||||
self, query_count: int, query_time: float, remaining_time: float
|
||||
): ...
|
||||
def format_cursor_mode(self, cursor_mode): ...
|
||||
|
||||
class DBFormatter(logging.Formatter):
|
||||
def format(self, record: LogRecord): ...
|
||||
|
||||
@@ -18,6 +18,9 @@ DECIMAL_TO_FLOAT_TYPE: Any
|
||||
real_time: Callable
|
||||
re_from: Pattern
|
||||
re_into: Pattern
|
||||
|
||||
def categorize_query(decoded_query: str) -> tuple[str, Any]: ...
|
||||
|
||||
sql_counter: int
|
||||
MAX_IDLE_TIMEOUT: int
|
||||
|
||||
@@ -80,10 +83,13 @@ class Cursor(BaseCursor):
|
||||
def __getattr__(self, name: str): ...
|
||||
@property
|
||||
def closed(self) -> bool: ...
|
||||
@property
|
||||
def readonly(self) -> bool: ...
|
||||
def now(self) -> datetime: ...
|
||||
|
||||
class TestCursor(BaseCursor):
|
||||
def __init__(self, cursor: Cursor, lock: RLock) -> None: ...
|
||||
readonly: bool
|
||||
def __init__(self, cursor: Cursor, lock: RLock, readonly: bool) -> None: ...
|
||||
def execute(self, *args, **kwargs): ...
|
||||
def close(self) -> None: ...
|
||||
def commit(self) -> None: ...
|
||||
@@ -94,7 +100,9 @@ class TestCursor(BaseCursor):
|
||||
class PsycoConnection(psycopg2.extensions.connection): ...
|
||||
|
||||
class ConnectionPool:
|
||||
def __init__(self, maxconn: int = ...) -> None: ...
|
||||
def __init__(self, maxconn: int = ..., readonly: bool = ...) -> None: ...
|
||||
@property
|
||||
def readonly(self) -> bool: ...
|
||||
def borrow(self, connection_info: dict) -> PsycoConnection: ...
|
||||
def give_back(
|
||||
self, connection: PsycoConnection, keep_in_pool: bool = ...
|
||||
@@ -110,7 +118,7 @@ class Connection:
|
||||
def cursor(self) -> Cursor: ...
|
||||
def __bool__(self) -> NoReturn: ...
|
||||
|
||||
def connection_info_for(db_or_uri: str) -> tuple[str, dict]: ...
|
||||
def db_connect(to: str, allow_uri: bool = ...) -> Connection: ...
|
||||
def connection_info_for(db_or_uri: str, readonly: bool = ...) -> tuple[str, dict]: ...
|
||||
def db_connect(to: str, allow_uri: bool = ..., readonly: bool = ...) -> Connection: ...
|
||||
def close_db(db_name: str) -> None: ...
|
||||
def close_all() -> None: ...
|
||||
|
||||
@@ -47,6 +47,7 @@ def new_test_user(
|
||||
context: dict | None = ...,
|
||||
**kwargs
|
||||
) -> Users: ...
|
||||
def loaded_demo_data(env: Environment) -> bool: ...
|
||||
|
||||
class RecordCapturer:
|
||||
def __init__(self, model: BaseModel, domain: list) -> None: ...
|
||||
@@ -102,6 +103,11 @@ class BaseCase(case.TestCase, metaclass=MetaCase):
|
||||
profile_session: str
|
||||
def profile(self, description: str = ..., **kwargs) -> Profiler: ...
|
||||
|
||||
class Like:
|
||||
pattern: str
|
||||
regex: str
|
||||
def __init__(self, pattern) -> None: ...
|
||||
|
||||
savepoint_seq: count[int]
|
||||
|
||||
class TransactionCase(BaseCase):
|
||||
|
||||
@@ -5,6 +5,7 @@ from dateutil.relativedelta import relativedelta
|
||||
|
||||
_DateTimeT = TypeVar("_DateTimeT", datetime.date, datetime.datetime)
|
||||
|
||||
def date_type(value: _DateTimeT) -> type[_DateTimeT]: ...
|
||||
def get_month(date: _DateTimeT) -> Tuple[_DateTimeT, _DateTimeT]: ...
|
||||
def get_quarter_number(date: _DateTimeT) -> int: ...
|
||||
def get_quarter(date: _DateTimeT) -> Tuple[_DateTimeT, _DateTimeT]: ...
|
||||
|
||||
@@ -17,7 +17,7 @@ class BrandedFileWriter(PdfFileWriter):
|
||||
PdfFileWriter = BrandedFileWriter
|
||||
|
||||
def merge_pdf(pdf_data: Iterable[bytes]) -> bytes: ...
|
||||
def fill_form_fields_pdf(document: bytes, form_fields: dict | None = ...) -> bytes: ...
|
||||
def fill_form_fields_pdf(writer: PdfFileWriter, form_fields: dict) -> None: ...
|
||||
def rotate_pdf(pdf: bytes) -> bytes: ...
|
||||
def to_pdf_stream(attachment: IrAttachment) -> BytesIO: ...
|
||||
def add_banner(
|
||||
|
||||
@@ -32,12 +32,14 @@ class Collector:
|
||||
def post_process(self) -> None: ...
|
||||
@property
|
||||
def entries(self) -> list[dict]: ...
|
||||
def summary(self) -> str: ...
|
||||
|
||||
class SQLCollector(Collector):
|
||||
name: str
|
||||
def start(self) -> None: ...
|
||||
def stop(self) -> None: ...
|
||||
def hook(self, cr: Cursor, query, params, query_start, query_time) -> None: ...
|
||||
def summary(self) -> str: ...
|
||||
|
||||
class PeriodicCollector(Collector):
|
||||
name: str
|
||||
@@ -102,6 +104,8 @@ class Profiler:
|
||||
filecache: dict
|
||||
params: Any
|
||||
profile_id: Any
|
||||
log: bool
|
||||
sub_profilers: list[Profiler]
|
||||
db: str | None
|
||||
collectors: list[Collector]
|
||||
def __init__(
|
||||
@@ -112,12 +116,14 @@ class Profiler:
|
||||
description: str | None = ...,
|
||||
disable_gc: bool = ...,
|
||||
params: Any | None = ...,
|
||||
log: bool = ...,
|
||||
) -> None: ...
|
||||
def __enter__(self: _T) -> _T: ...
|
||||
def __exit__(self, *args) -> None: ...
|
||||
def entry_count(self) -> int: ...
|
||||
def format_path(self, path: str) -> str: ...
|
||||
def json(self) -> str: ...
|
||||
def summary(self) -> str: ...
|
||||
|
||||
class Nested(Generic[_T]):
|
||||
profiler: Profiler
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
from typing import Iterable, Iterator
|
||||
|
||||
from ..sql_db import Cursor
|
||||
from ..api import Environment
|
||||
from . import SQL
|
||||
|
||||
class Query:
|
||||
limit: int | None
|
||||
offset: int | None
|
||||
def __init__(
|
||||
self, cr: Cursor, alias: str, table: str | SQL | None = ...
|
||||
self, env: Environment, alias: str, table: SQL | None = ...
|
||||
) -> None: ...
|
||||
def make_alias(self, alias: str, link: str) -> str: ...
|
||||
def add_table(self, alias: str, table: str | SQL | None = ...) -> None: ...
|
||||
def add_table(self, alias: str, table: SQL | None = ...) -> None: ...
|
||||
def add_join(
|
||||
self, kind: str, alias: str, table: str | SQL | None, condition: SQL
|
||||
) -> None: ...
|
||||
@@ -21,7 +21,7 @@ class Query:
|
||||
self,
|
||||
lhs_alias: str,
|
||||
lhs_column: str,
|
||||
rhs_table: str,
|
||||
rhs_table: str | SQL,
|
||||
rhs_column: str,
|
||||
link: str,
|
||||
) -> str: ...
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
import enum
|
||||
from collections import defaultdict
|
||||
from re import Pattern
|
||||
from typing import Iterable, Literal
|
||||
from typing import Iterable, Iterator, Literal
|
||||
|
||||
from ..fields import Field
|
||||
from ..models import BaseModel
|
||||
from ..sql_db import Cursor
|
||||
|
||||
IDENT_RE: Pattern
|
||||
|
||||
class SQL:
|
||||
def __new__(cls, code: str | SQL = ..., *args) -> SQL: ...
|
||||
def __new__(
|
||||
cls, code: str | SQL = ..., *args, to_flush: Field | None = ..., **kwargs
|
||||
) -> SQL: ...
|
||||
@property
|
||||
def to_flush(self) -> Iterator[Field]: ...
|
||||
@property
|
||||
def code(self) -> str: ...
|
||||
@property
|
||||
@@ -20,7 +25,9 @@ class SQL:
|
||||
def __iter__(self): ...
|
||||
def join(self, args: Iterable) -> SQL: ...
|
||||
@classmethod
|
||||
def identifier(cls, name: str, subname: str | None = ...) -> SQL: ...
|
||||
def identifier(
|
||||
cls, name: str, subname: str | None = ..., to_flush: Field | None = ...
|
||||
) -> SQL: ...
|
||||
|
||||
def existing_tables(cr: Cursor, tablenames: Iterable[str]) -> list[str]: ...
|
||||
def table_exists(cr: Cursor, tablename: str) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user