mirror of
https://github.com/odoo-ide/odoo-stubs.git
synced 2025-05-08 16:52:26 +03:00
Cleanup
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
from psycopg2 import connection
|
||||
|
||||
from . import addons as addons
|
||||
from . import api as api
|
||||
from . import conf as conf
|
||||
@@ -19,13 +17,7 @@ from .tools.translate import _ as _
|
||||
from .tools.translate import _lt as _lt
|
||||
|
||||
evented: bool
|
||||
|
||||
def gevent_wait_callback(conn: connection, timeout: float | None = ...) -> None: ...
|
||||
|
||||
multi_process: bool
|
||||
|
||||
def _decompress(data: bytes) -> bytes: ...
|
||||
|
||||
SUPERUSER_ID: int
|
||||
|
||||
def registry(database_name: str | None = ...) -> Registry: ...
|
||||
|
||||
@@ -7,7 +7,6 @@ from typing import (
|
||||
Iterable,
|
||||
Iterator,
|
||||
KeysView,
|
||||
Literal,
|
||||
Mapping,
|
||||
Optional,
|
||||
Sequence,
|
||||
@@ -16,11 +15,14 @@ from typing import (
|
||||
)
|
||||
from weakref import WeakSet
|
||||
|
||||
from odoo.addons.base.models.res_company import Company
|
||||
from odoo.addons.base.models.res_users import Users
|
||||
|
||||
from .fields import Field
|
||||
from .models import BaseModel
|
||||
from .modules.registry import Registry
|
||||
from .sql_db import Cursor
|
||||
from .tools import OrderedSet, StackMap, frozendict
|
||||
from .tools import StackMap, frozendict
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_ModelT = TypeVar("_ModelT", bound=BaseModel)
|
||||
@@ -32,7 +34,6 @@ class Params:
|
||||
args: tuple
|
||||
kwargs: dict
|
||||
def __init__(self, args: tuple, kwargs: dict) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
class Meta(type):
|
||||
def __new__(meta, name: str, bases: tuple, attrs: dict): ...
|
||||
@@ -53,19 +54,8 @@ def downgrade(method: Callable, value, self, args, kwargs): ...
|
||||
def split_context(method: Callable, args, kwargs) -> tuple: ...
|
||||
def autovacuum(method: _CallableT) -> _CallableT: ...
|
||||
def model(method: _CallableT) -> _CallableT: ...
|
||||
def _model_create_single(
|
||||
create: Callable[..., _ModelT], self: _ModelT, arg
|
||||
) -> _ModelT: ...
|
||||
def model_create_single(method: _CallableT) -> _CallableT: ...
|
||||
def _model_create_multi(
|
||||
create: Callable[..., _ModelT], self: _ModelT, arg
|
||||
) -> _ModelT: ...
|
||||
def model_create_multi(method: _CallableT) -> _CallableT: ...
|
||||
def _call_kw_model(method: Callable[..., _ModelT], self: _ModelT, args, kwargs): ...
|
||||
def _call_kw_model_create(
|
||||
method: Callable[..., _ModelT], self: _ModelT, args, kwargs
|
||||
) -> list[int] | int | Literal[False]: ...
|
||||
def _call_kw_multi(method: Callable[..., _ModelT], self: _ModelT, args, kwargs): ...
|
||||
def call_kw(model: BaseModel, name: str, args, kwargs): ...
|
||||
|
||||
class Environment(Mapping[str, BaseModel]):
|
||||
@@ -79,8 +69,6 @@ class Environment(Mapping[str, BaseModel]):
|
||||
transaction: Transaction
|
||||
registry: Registry
|
||||
cache: Cache
|
||||
_cache_key: dict[Field, Any]
|
||||
_protected: StackMap[Field, set[int]]
|
||||
def __new__(
|
||||
cls, cr: Cursor, uid: int | None, context: dict, su: bool = ...
|
||||
) -> Environment: ...
|
||||
@@ -94,7 +82,7 @@ class Environment(Mapping[str, BaseModel]):
|
||||
def __call__(
|
||||
self,
|
||||
cr: Cursor | None = ...,
|
||||
user: Union["odoo.model.res_users", int, None] = ...,
|
||||
user: "Union[Users, int, None]" = ...,
|
||||
context: dict | None = ...,
|
||||
su: bool | None = ...,
|
||||
) -> Environment: ...
|
||||
@@ -105,16 +93,15 @@ class Environment(Mapping[str, BaseModel]):
|
||||
def is_admin(self) -> bool: ...
|
||||
def is_system(self) -> bool: ...
|
||||
@property
|
||||
def user(self) -> "odoo.model.res_users": ...
|
||||
def user(self) -> "Users": ...
|
||||
@property
|
||||
def company(self) -> "odoo.model.res_company": ...
|
||||
def company(self) -> "Company": ...
|
||||
@property
|
||||
def companies(self) -> "odoo.model.res_company": ...
|
||||
def companies(self) -> "Company": ...
|
||||
@property
|
||||
def lang(self) -> str: ...
|
||||
def clear(self) -> None: ...
|
||||
def invalidate_all(self, flush: bool = ...) -> None: ...
|
||||
def _recompute_all(self) -> None: ...
|
||||
def flush_all(self) -> None: ...
|
||||
def is_protected(self, field: Field, record: BaseModel) -> bool: ...
|
||||
def protected(self, field: Field) -> BaseModel: ...
|
||||
@@ -145,12 +132,7 @@ NOTHING: object
|
||||
EMPTY_DICT: frozendict
|
||||
|
||||
class Cache:
|
||||
_data: defaultdict[Field, dict]
|
||||
_dirty: defaultdict[Field, OrderedSet[int]]
|
||||
def __init__(self) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def _get_field_cache(self, model: BaseModel, field: Field) -> dict: ...
|
||||
def _set_field_cache(self, model: BaseModel, field: Field): ...
|
||||
def contains(self, record: BaseModel, field: Field) -> bool: ...
|
||||
def contains_field(self, field: Field) -> bool: ...
|
||||
def get(self, record: BaseModel, field: Field, default=...): ...
|
||||
@@ -203,4 +185,3 @@ class Cache:
|
||||
class Starred:
|
||||
value: Any
|
||||
def __init__(self, value) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from typing import Any
|
||||
|
||||
from .fields import Field
|
||||
from .models import BaseModel
|
||||
|
||||
@@ -18,7 +16,6 @@ class RedirectWarning(Exception):
|
||||
def name(self): ...
|
||||
|
||||
class AccessDenied(UserError):
|
||||
__cause__: Any
|
||||
traceback: tuple[str, str, str]
|
||||
def __init__(self, message: str = ...) -> None: ...
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import enum
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Collection,
|
||||
Container,
|
||||
Generic,
|
||||
Iterator,
|
||||
@@ -53,14 +52,6 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
|
||||
column_type: tuple[str, str] | None
|
||||
write_sequence: int
|
||||
args: dict[str, Any] | None
|
||||
_module: str
|
||||
_modules: tuple[str, ...]
|
||||
_setup_done: bool
|
||||
_sequence: int | None
|
||||
_base_fields: tuple[Field, ...]
|
||||
_extra_keys: tuple[str, ...]
|
||||
_direct: bool
|
||||
_toplevel: bool
|
||||
automatic: bool
|
||||
inherited: bool
|
||||
inherited_field: Field | None
|
||||
@@ -71,8 +62,6 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
|
||||
index: str | bool | None
|
||||
manual: bool
|
||||
copy: bool
|
||||
_depends: Collection[str] | None
|
||||
_depends_context: Collection[str] | None
|
||||
recursive: bool
|
||||
compute: str | Callable | None
|
||||
compute_sudo: bool
|
||||
@@ -99,59 +88,21 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
|
||||
related_attrs: list[tuple[str, str]]
|
||||
description_attrs: list[tuple[str, str]]
|
||||
def __init__(self, string: str = ..., **kwargs) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __set_name__(self, owner: Type[BaseModel], name: str) -> None: ...
|
||||
def _get_attrs(self, model_class: Type[BaseModel], name: str) -> dict[str, Any]: ...
|
||||
def _setup_attrs(self, model_class: Type[BaseModel], name: str): ...
|
||||
def prepare_setup(self) -> None: ...
|
||||
def setup(self, model: BaseModel) -> None: ...
|
||||
def setup_nonrelated(self, model: BaseModel) -> None: ...
|
||||
def get_depends(self, model: BaseModel) -> tuple: ...
|
||||
def setup_related(self, model: BaseModel) -> None: ...
|
||||
def traverse_related(self, record: _ModelT) -> tuple[_ModelT, Field]: ...
|
||||
def _compute_related(self, records: BaseModel) -> None: ...
|
||||
def _process_related(self, value): ...
|
||||
def _inverse_related(self, records: BaseModel) -> None: ...
|
||||
def _search_related(self, records: BaseModel, operator: str, value) -> list: ...
|
||||
_related_comodel_name: str | None
|
||||
_related_string: str | None
|
||||
_related_help: str | None
|
||||
_related_groups: str | None
|
||||
_related_group_operator: str | None
|
||||
@property
|
||||
def base_field(self) -> Field: ...
|
||||
@property
|
||||
def groupable(self) -> bool: ...
|
||||
def _default_company_dependent(self, model: BaseModel): ...
|
||||
def _compute_company_dependent(self, records: BaseModel) -> None: ...
|
||||
def _inverse_company_dependent(self, records: BaseModel) -> None: ...
|
||||
def _search_company_dependent(self, records: BaseModel, operator: str, value): ...
|
||||
def resolve_depends(self, registry: Registry) -> Iterator[tuple]: ...
|
||||
def get_description(
|
||||
self, env: Environment, attributes: Container[str] | None = ...
|
||||
) -> dict[str, Any]: ...
|
||||
_description_name: str
|
||||
_description_type: str
|
||||
_description_store: bool | None
|
||||
_description_manual: Any
|
||||
_description_related: str | None
|
||||
_description_company_dependent: bool
|
||||
_description_readonly: bool
|
||||
_description_required: bool
|
||||
_description_states: dict[str, list[tuple]] | None
|
||||
_description_groups: str | None
|
||||
_description_change_default: bool
|
||||
_description_group_operator: str | None
|
||||
_description_default_export_compatible: bool
|
||||
_description_exportable: bool
|
||||
def _description_depends(self, env: Environment): ...
|
||||
@property
|
||||
def _description_searchable(self) -> bool: ...
|
||||
@property
|
||||
def _description_sortable(self) -> bool: ...
|
||||
def _description_string(self, env: Environment) -> str | None: ...
|
||||
def _description_help(self, env: Environment) -> str | None: ...
|
||||
def is_editable(self) -> bool: ...
|
||||
def convert_to_column(
|
||||
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
|
||||
@@ -168,7 +119,6 @@ class Field(Generic[_FieldValueT], metaclass=MetaField):
|
||||
def column_order(self) -> int: ...
|
||||
def update_db(self, model: BaseModel, columns: dict[str, Any]): ...
|
||||
def update_db_column(self, model: BaseModel, column: dict | None) -> None: ...
|
||||
def _convert_db_column(self, model: BaseModel, column: dict | None) -> None: ...
|
||||
def update_db_notnull(self, model: BaseModel, column: dict | None) -> None: ...
|
||||
def update_db_related(self, model: BaseModel) -> None: ...
|
||||
def read(self, records: BaseModel) -> None: ...
|
||||
@@ -200,7 +150,6 @@ class Integer(Field[int]):
|
||||
type: str
|
||||
column_type: tuple[str, str]
|
||||
group_operator: str
|
||||
def _get_attrs(self, model_class: Type[BaseModel], name: str): ...
|
||||
def convert_to_column(
|
||||
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
|
||||
) -> int: ...
|
||||
@@ -209,12 +158,10 @@ class Integer(Field[int]):
|
||||
) -> int | None: ...
|
||||
def convert_to_record(self, value, record: BaseModel): ...
|
||||
def convert_to_read(self, value, record: BaseModel, use_name_get: bool = ...): ...
|
||||
def _update(self, records: BaseModel, value) -> None: ...
|
||||
def convert_to_export(self, value, record): ...
|
||||
|
||||
class Float(Field[float]):
|
||||
type: str
|
||||
_digits: tuple[int, int] | str | None
|
||||
group_operator: str
|
||||
def __init__(
|
||||
self, string: str = ..., digits: tuple[int, int] | str | None = ..., **kwargs
|
||||
@@ -222,8 +169,6 @@ class Float(Field[float]):
|
||||
@property
|
||||
def column_type(self): ...
|
||||
def get_digits(self, env: Environment) -> tuple[int, int]: ...
|
||||
_related__digits: Any
|
||||
def _description_digits(self, env: Environment) -> tuple[int, int]: ...
|
||||
def convert_to_column(
|
||||
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
|
||||
) -> float: ...
|
||||
@@ -245,7 +190,6 @@ class Monetary(Field[float]):
|
||||
def __init__(
|
||||
self, string: str = ..., currency_field: str = ..., **kwargs
|
||||
) -> None: ...
|
||||
def _description_currency_field(self, env: Environment) -> str: ...
|
||||
def get_currency_field(self, model: BaseModel) -> str: ...
|
||||
def setup_nonrelated(self, model: BaseModel) -> None: ...
|
||||
def setup_related(self, model: BaseModel) -> None: ...
|
||||
@@ -263,36 +207,26 @@ class _String(Field[str]):
|
||||
translate: Callable | bool
|
||||
unaccent: bool
|
||||
def __init__(self, string: str = ..., **kwargs) -> None: ...
|
||||
_related_translate: bool
|
||||
def _description_translate(self, env: Environment) -> bool: ...
|
||||
def _convert_db_column(self, model: BaseModel, column: dict) -> None: ...
|
||||
def get_trans_terms(self, value) -> list: ...
|
||||
def get_text_content(self, term): ...
|
||||
def convert_to_column(
|
||||
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
|
||||
): ...
|
||||
def _convert_from_cache_to_column(self, value): ...
|
||||
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
|
||||
def convert_to_record(self, value, record: BaseModel): ...
|
||||
def convert_to_write(self, value, record: BaseModel): ...
|
||||
def get_translation_dictionary(
|
||||
self, from_lang_value: str, to_lang_values: dict
|
||||
) -> dict: ...
|
||||
def _get_stored_translations(self, record: BaseModel) -> dict[str, str]: ...
|
||||
def write(self, records: _ModelT, value) -> None: ...
|
||||
|
||||
class Char(_String):
|
||||
type: str
|
||||
size: int | None
|
||||
trim: bool
|
||||
def _setup_attrs(self, model_class: Type[BaseModel], name: str) -> None: ...
|
||||
@property
|
||||
def column_type(self) -> tuple[str, str]: ...
|
||||
def update_db_column(self, model: BaseModel, column: dict | None) -> None: ...
|
||||
_related_size: int | None
|
||||
_related_trim: bool
|
||||
_description_size: int | None
|
||||
_description_trim: bool
|
||||
def convert_to_column(
|
||||
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
|
||||
) -> str | None: ...
|
||||
@@ -316,28 +250,14 @@ class Html(_String):
|
||||
sanitize_form: bool
|
||||
strip_style: bool
|
||||
strip_classes: bool
|
||||
def _get_attrs(self, model_class: Type[BaseModel], name: str) -> dict[str, Any]: ...
|
||||
@property
|
||||
def column_type(self) -> tuple[str, str]: ...
|
||||
_related_sanitize: bool
|
||||
_related_sanitize_tags: bool
|
||||
_related_sanitize_attributes: bool
|
||||
_related_sanitize_style: bool
|
||||
_related_strip_style: bool
|
||||
_related_strip_classes: bool
|
||||
_description_sanitize: bool
|
||||
_description_sanitize_tags: bool
|
||||
_description_sanitize_attributes: bool
|
||||
_description_sanitize_style: bool
|
||||
_description_strip_style: bool
|
||||
_description_strip_classes: bool
|
||||
def convert_to_column(
|
||||
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
|
||||
) -> Markup | None: ...
|
||||
def convert_to_cache(
|
||||
self, value, record: BaseModel, validate: bool = ...
|
||||
) -> Markup | None: ...
|
||||
def _convert(self, value, record: BaseModel, validate: bool) -> Markup | None: ...
|
||||
def convert_to_record(self, value, record: BaseModel) -> Markup | None: ...
|
||||
def convert_to_read(
|
||||
self, value, record: BaseModel, use_name_get: bool = ...
|
||||
@@ -393,17 +313,12 @@ class Datetime(Field[datetime.datetime]):
|
||||
def convert_to_export(self, value, record: BaseModel): ...
|
||||
def convert_to_display_name(self, value, record: BaseModel) -> str: ...
|
||||
|
||||
_BINARY = memoryview
|
||||
|
||||
class Binary(Field[bytes]):
|
||||
type: str
|
||||
prefetch: bool
|
||||
_depends_context: tuple[str]
|
||||
attachment: bool
|
||||
@property
|
||||
def column_type(self) -> tuple[str, str] | None: ...
|
||||
def _get_attrs(self, model_class: Type[BaseModel], name: str) -> dict[str, Any]: ...
|
||||
_description_attachment: bool
|
||||
def convert_to_column(
|
||||
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
|
||||
) -> psycopg2.Binary | None: ...
|
||||
@@ -423,8 +338,6 @@ class Image(Binary):
|
||||
def setup(self, model: BaseModel) -> None: ...
|
||||
def create(self, record_values: list[tuple[BaseModel, Any]]) -> None: ...
|
||||
def write(self, records: BaseModel, value) -> None: ...
|
||||
def _image_process(self, value): ...
|
||||
def _process_related(self, value): ...
|
||||
|
||||
class Selection(Field[str]):
|
||||
type: str
|
||||
@@ -437,13 +350,6 @@ class Selection(Field[str]):
|
||||
) -> None: ...
|
||||
def setup_nonrelated(self, model: BaseModel) -> None: ...
|
||||
def setup_related(self, model: BaseModel): ...
|
||||
def _get_attrs(self, model_class: Type[BaseModel], name: str) -> dict[str, Any]: ...
|
||||
def _setup_attrs(self, model_class: Type[BaseModel], name: str) -> None: ...
|
||||
def _selection_modules(self, model: BaseModel) -> dict[str, set[str, str]]: ...
|
||||
def _description_selection(self, env: Environment) -> _Selection: ...
|
||||
def _default_group_expand(
|
||||
self, records: BaseModel, groups, domain, order
|
||||
) -> list[str]: ...
|
||||
def get_values(self, env: Environment) -> list[str]: ...
|
||||
def convert_to_column(
|
||||
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
|
||||
@@ -476,12 +382,6 @@ class _Relational(Field[BaseModel]):
|
||||
comodel_name: str
|
||||
def setup_nonrelated(self, model: BaseModel) -> None: ...
|
||||
def get_domain_list(self, model: BaseModel) -> _Domain: ...
|
||||
@property
|
||||
def _related_domain(self) -> _DomainRaw: ...
|
||||
_related_context: dict
|
||||
_description_relation: str | None
|
||||
_description_context: dict
|
||||
def _description_domain(self, env: Environment) -> _Domain: ...
|
||||
|
||||
class Many2one(_Relational):
|
||||
type: str
|
||||
@@ -492,12 +392,10 @@ class Many2one(_Relational):
|
||||
def __init__(
|
||||
self, comodel_name: str = ..., string: str = ..., **kwargs
|
||||
) -> None: ...
|
||||
def _setup_attrs(self, model_class: Type[BaseModel], name: str) -> None: ...
|
||||
def setup_nonrelated(self, model: BaseModel) -> None: ...
|
||||
def update_db(self, model: BaseModel, columns): ...
|
||||
def update_db_column(self, model: BaseModel, column) -> None: ...
|
||||
def update_db_foreign_key(self, model: BaseModel, column) -> None: ...
|
||||
def _update(self, records: BaseModel, value) -> None: ...
|
||||
def convert_to_column(
|
||||
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
|
||||
): ...
|
||||
@@ -510,17 +408,12 @@ class Many2one(_Relational):
|
||||
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: ...
|
||||
def _remove_inverses(self, records: BaseModel, value): ...
|
||||
def _update_inverses(self, records: BaseModel, value) -> None: ...
|
||||
|
||||
class Many2oneReference(Integer):
|
||||
type: str
|
||||
model_field: str | None
|
||||
_related_model_field: str | None
|
||||
group_operator: str | None
|
||||
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
|
||||
def _update_inverses(self, records: BaseModel, value) -> None: ...
|
||||
def _record_ids_per_res_model(self, records: BaseModel) -> dict[str, set]: ...
|
||||
|
||||
class Json(Field):
|
||||
type: str
|
||||
@@ -545,12 +438,8 @@ class Properties(Field):
|
||||
definition: str | None
|
||||
definition_record: str | None
|
||||
definition_record_field: str | None
|
||||
_description_definition_record: str | None
|
||||
_description_definition_record_field: str | None
|
||||
ALLOWED_TYPES: tuple[str, ...]
|
||||
_depends: tuple[str, ...]
|
||||
compute: Callable
|
||||
def _setup_attrs(self, model_class: Type[BaseModel], name: str) -> None: ...
|
||||
def convert_to_column(
|
||||
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
|
||||
): ...
|
||||
@@ -562,36 +451,7 @@ class Properties(Field):
|
||||
): ...
|
||||
def convert_to_write(self, value, record: BaseModel): ...
|
||||
def convert_to_onchange(self, value, record: BaseModel, names): ...
|
||||
def _get_res_ids_per_model(
|
||||
self, records: BaseModel, values_list, use_name_get: bool = ...
|
||||
) -> dict[str, set[int]]: ...
|
||||
def write(self, records: _ModelT, value) -> None: ...
|
||||
def _compute(self, records: BaseModel) -> None: ...
|
||||
def _add_default_values(self, env: Environment, values: dict[str, Any]): ...
|
||||
def _get_properties_definition(self, record: BaseModel): ...
|
||||
@classmethod
|
||||
def _add_display_name(
|
||||
cls, values_list: list[dict], env: Environment, value_keys: tuple[str] = ...
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def _remove_display_name(
|
||||
cls, values_list: list[dict], value_key: str = ...
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def _add_missing_names(cls, values_list: list[dict]) -> None: ...
|
||||
@classmethod
|
||||
def _parse_json_types(
|
||||
cls,
|
||||
values_list: list[dict],
|
||||
env: Environment,
|
||||
res_ids_per_model: dict[str, set[int]],
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def _list_to_dict(cls, values_list: list[dict]) -> dict: ...
|
||||
@classmethod
|
||||
def _dict_to_list(
|
||||
cls, values_dict: dict, properties_definition: Sequence[dict]
|
||||
) -> Sequence[dict]: ...
|
||||
|
||||
class PropertiesDefinition(Field):
|
||||
type: str
|
||||
@@ -607,10 +467,6 @@ class PropertiesDefinition(Field):
|
||||
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
|
||||
def convert_to_record(self, value, record: BaseModel): ...
|
||||
def convert_to_read(self, value, record: BaseModel, use_name_get: bool = ...): ...
|
||||
@classmethod
|
||||
def _validate_properties_definition(
|
||||
cls, properties_definition: Sequence[dict], env
|
||||
): ...
|
||||
|
||||
class Command(enum.IntEnum):
|
||||
CREATE: int
|
||||
@@ -637,7 +493,6 @@ class Command(enum.IntEnum):
|
||||
|
||||
class _RelationalMulti(_Relational):
|
||||
write_sequence: int
|
||||
def _update(self, records: BaseModel, value) -> None: ...
|
||||
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
|
||||
def convert_to_record(self, value, record: BaseModel): ...
|
||||
def convert_to_record_multi(self, values, records: BaseModel): ...
|
||||
@@ -665,7 +520,6 @@ class One2many(_RelationalMulti):
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
def setup_nonrelated(self, model: BaseModel) -> None: ...
|
||||
_description_relation_field: str | None
|
||||
def update_db(self, model: BaseModel, columns) -> None: ...
|
||||
def get_domain_list(self, records: BaseModel): ...
|
||||
def read(self, records: BaseModel): ...
|
||||
@@ -676,7 +530,6 @@ class One2many(_RelationalMulti):
|
||||
|
||||
class Many2many(_RelationalMulti):
|
||||
type: str
|
||||
_explicit: bool
|
||||
relation: str | None
|
||||
column1: str | None
|
||||
column2: str | None
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from collections import defaultdict
|
||||
from collections.abc import MutableMapping
|
||||
from contextlib import nullcontext
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Collection,
|
||||
Generator,
|
||||
Iterable,
|
||||
Literal,
|
||||
Mapping,
|
||||
TypeVar,
|
||||
)
|
||||
from typing import Any, Callable, Iterable, Literal, Mapping, TypeVar
|
||||
|
||||
import geoip2.database
|
||||
import geoip2.models
|
||||
import werkzeug
|
||||
from odoo.addons.base.models.res_lang import Lang
|
||||
from odoo.addons.website.models.website import Website
|
||||
from werkzeug.datastructures import Headers
|
||||
from werkzeug.exceptions import NotFound
|
||||
from werkzeug.local import LocalStack
|
||||
from werkzeug.middleware.proxy_fix import ProxyFix as ProxyFix_
|
||||
from werkzeug.routing import Map, Rule
|
||||
from werkzeug.urls import URL
|
||||
@@ -28,7 +19,6 @@ from .models import BaseModel
|
||||
from .modules.registry import Registry
|
||||
from .sql_db import Cursor
|
||||
from .tools._vendor import sessions
|
||||
from .tools.profiler import Profiler
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -86,7 +76,7 @@ class Stream:
|
||||
@classmethod
|
||||
def from_path(cls, path: str, filter_ext: tuple[str, ...] = ...) -> Stream: ...
|
||||
@classmethod
|
||||
def from_attachment(cls, attachment: "odoo.model.ir_attachment") -> Stream: ...
|
||||
def from_attachment(cls, attachment) -> Stream: ...
|
||||
@classmethod
|
||||
def from_binary_field(cls, record: BaseModel, field_name: str) -> Stream: ...
|
||||
def read(self) -> bytes: ...
|
||||
@@ -111,12 +101,6 @@ def route(
|
||||
csrf: bool = ...,
|
||||
**kw
|
||||
): ...
|
||||
def _generate_routing_rules(
|
||||
modules: Collection[str], nodb_only: bool, converters: Any | None = ...
|
||||
) -> Generator[tuple[str, Any], None, None]: ...
|
||||
def _check_and_complete_route_definition(
|
||||
controller_cls: type, submethod, merged_routing: dict
|
||||
) -> None: ...
|
||||
|
||||
class FilesystemSessionStore(sessions.FilesystemSessionStore):
|
||||
def get_session_filename(self, sid: str) -> str: ...
|
||||
@@ -127,7 +111,6 @@ class FilesystemSessionStore(sessions.FilesystemSessionStore):
|
||||
|
||||
class Session(MutableMapping):
|
||||
can_save: bool
|
||||
__data: dict
|
||||
is_dirty: bool
|
||||
is_explicit: bool
|
||||
is_new: bool
|
||||
@@ -156,10 +139,6 @@ class GeoIP(Mapping):
|
||||
ip: str
|
||||
def __init__(self, ip: str) -> None: ...
|
||||
@property
|
||||
def _city_record(self) -> geoip2.models.City: ...
|
||||
@property
|
||||
def _country_record(self) -> geoip2.models.Country: ...
|
||||
@property
|
||||
def country_name(self): ...
|
||||
@property
|
||||
def country_code(self): ...
|
||||
@@ -169,7 +148,6 @@ class GeoIP(Mapping):
|
||||
def __iter__(self): ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
_request_stack: LocalStack
|
||||
request: Request
|
||||
|
||||
class Response(werkzeug.Response):
|
||||
@@ -232,16 +210,15 @@ class Request:
|
||||
session: Session
|
||||
db: str | None
|
||||
env: Environment | None
|
||||
website: "odoo.model.website"
|
||||
website: "Website"
|
||||
website_routing: int
|
||||
is_frontend: bool
|
||||
is_frontend_multilang: bool
|
||||
lang: "odoo.model.res_lang"
|
||||
lang: "Lang"
|
||||
def __init__(self, httprequest: werkzeug.Request) -> None: ...
|
||||
def _get_session_and_dbname(self) -> tuple[Session, str]: ...
|
||||
def update_env(
|
||||
self,
|
||||
user: "odoo.model.res_users | int | None" = ...,
|
||||
user=...,
|
||||
context: dict[str, Any] | None = ...,
|
||||
su: bool | None = ...,
|
||||
) -> None: ...
|
||||
@@ -258,7 +235,6 @@ class Request:
|
||||
def cr(self) -> Cursor: ...
|
||||
@cr.setter
|
||||
def cr(self, value) -> None: ...
|
||||
_cr: Cursor
|
||||
@property
|
||||
def best_lang(self) -> str | None: ...
|
||||
def csrf_token(self, time_limit: int | None = ...) -> str: ...
|
||||
@@ -267,8 +243,6 @@ class Request:
|
||||
def default_lang(self) -> str: ...
|
||||
def get_http_params(self) -> dict: ...
|
||||
def get_json_data(self): ...
|
||||
def _get_profiler_context_manager(self) -> Profiler | nullcontext: ...
|
||||
def _inject_future_response(self, response: werkzeug.Response): ...
|
||||
def make_response(
|
||||
self,
|
||||
data: str,
|
||||
@@ -297,15 +271,6 @@ class Request:
|
||||
def render(
|
||||
self, template: str, qcontext: dict | None = ..., lazy: bool = ..., **kw
|
||||
): ...
|
||||
def _save_session(self) -> None: ...
|
||||
def _set_request_dispatcher(self, rule: Rule) -> None: ...
|
||||
def _serve_static(self) -> werkzeug.Response: ...
|
||||
def _serve_nodb(self): ...
|
||||
def _serve_db(self): ...
|
||||
params: dict
|
||||
def _serve_ir_http(self): ...
|
||||
|
||||
_dispatchers: dict[str, type[Dispatcher]]
|
||||
|
||||
class Dispatcher(ABC):
|
||||
routing_type: str
|
||||
@@ -338,9 +303,6 @@ class JsonRPCDispatcher(Dispatcher):
|
||||
def is_compatible_with(cls, request: Request) -> bool: ...
|
||||
def dispatch(self, endpoint, args): ...
|
||||
def handle_error(self, exc: Exception) -> Callable: ...
|
||||
def _response(
|
||||
self, result: Any | None = ..., error: Any | None = ...
|
||||
) -> Response: ...
|
||||
|
||||
class Application:
|
||||
@property
|
||||
|
||||
@@ -15,6 +15,8 @@ from typing import (
|
||||
|
||||
import dateutil.relativedelta
|
||||
import psycopg2
|
||||
from odoo.addons.base.models.res_company import Company
|
||||
from odoo.addons.base.models.res_users import Users
|
||||
|
||||
from . import api, fields
|
||||
from .api import Environment
|
||||
@@ -62,8 +64,6 @@ class NewId:
|
||||
def __bool__(self) -> bool: ...
|
||||
def __eq__(self, other) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
def origin_ids(ids: Iterable) -> Iterator[int]: ...
|
||||
|
||||
@@ -436,12 +436,8 @@ class BaseModel(metaclass=MetaModel):
|
||||
def ensure_one(self: _ModelT) -> _ModelT: ...
|
||||
def with_env(self: _ModelT, env: Environment) -> _ModelT: ...
|
||||
def sudo(self: _ModelT, flag: bool = ...) -> _ModelT: ...
|
||||
def with_user(
|
||||
self: _ModelT, user: Union["odoo.model.res_partner", int]
|
||||
) -> _ModelT: ...
|
||||
def with_company(
|
||||
self: _ModelT, company: Union["odoo.model.res_company", int]
|
||||
) -> _ModelT: ...
|
||||
def with_user(self: _ModelT, user: "Union[Users, int]") -> _ModelT: ...
|
||||
def with_company(self: _ModelT, company: "Union[Company, int]") -> _ModelT: ...
|
||||
def with_context(self: _ModelT, *args, **kwargs) -> _ModelT: ...
|
||||
def with_prefetch(
|
||||
self: _ModelT, prefetch_ids: Iterable[int] | None = ...
|
||||
@@ -485,7 +481,7 @@ class BaseModel(metaclass=MetaModel):
|
||||
def __le__(self: _ModelT, other: _ModelT) -> bool: ...
|
||||
def __gt__(self: _ModelT, other: _ModelT) -> bool: ...
|
||||
def __ge__(self: _ModelT, other: _ModelT) -> bool: ...
|
||||
def __int__(self): ...
|
||||
def __int__(self) -> int: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __getitem__(self, key: str | int | slice): ...
|
||||
@@ -530,7 +526,6 @@ class BaseModel(metaclass=MetaModel):
|
||||
def _populate(self: _ModelT, size: str) -> _ModelT: ...
|
||||
|
||||
class RecordCache(MutableMapping):
|
||||
_record: BaseModel
|
||||
def __init__(self, record: BaseModel) -> None: ...
|
||||
def __contains__(self, name: str) -> bool: ...
|
||||
def __getitem__(self, name: str) -> Any: ...
|
||||
|
||||
@@ -10,7 +10,6 @@ class Graph(dict[str, Node]):
|
||||
self, cr: Cursor, module_list: list[str], force: list | None = ...
|
||||
): ...
|
||||
def __iter__(self) -> Iterator[Node]: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
class Node:
|
||||
def __new__(cls, name: str, graph: Graph, info: dict[str, Any]) -> Node: ...
|
||||
@@ -31,8 +30,6 @@ class Node:
|
||||
def add_child(self, name: str, info: dict[str, Any]): ...
|
||||
def __setattr__(self, name: str, value) -> None: ...
|
||||
def __iter__(self) -> Iterator[Node]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def _pprint(self, depth: int = ...) -> str: ...
|
||||
def should_have_demo(self) -> bool: ...
|
||||
@property
|
||||
def parents(self) -> Iterable[Node]: ...
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from ..api import Environment
|
||||
from ..sql_db import Cursor
|
||||
from ..tests.result import OdooTestResult
|
||||
from .graph import Graph, Node
|
||||
from .registry import Registry
|
||||
@@ -20,7 +19,6 @@ def load_module_graph(
|
||||
report: OdooTestResult | None = ...,
|
||||
models_to_check: set[str] | None = ...,
|
||||
) -> tuple[list[str], list[str]]: ...
|
||||
def _check_module_names(cr: Cursor, module_names: Iterable[str]) -> None: ...
|
||||
def load_marked_modules(
|
||||
env: Environment,
|
||||
graph: Graph,
|
||||
|
||||
@@ -13,5 +13,4 @@ class MigrationManager:
|
||||
graph: Graph
|
||||
migrations: dict
|
||||
def __init__(self, cr: Cursor, graph: Graph) -> None: ...
|
||||
def _get_files(self) -> None: ...
|
||||
def migrate_module(self, pkg: Node, stage: str) -> None: ...
|
||||
|
||||
@@ -5,7 +5,6 @@ from ..tools import pycompat as pycompat
|
||||
|
||||
MANIFEST_NAMES: tuple[str, ...]
|
||||
README: list[str]
|
||||
_DEFAULT_MANIFEST: dict[str, Any]
|
||||
|
||||
class UpgradeHook:
|
||||
def find_module(self, name: str, path: Any | None = ...) -> UpgradeHook | None: ...
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
import threading
|
||||
from collections import defaultdict, deque
|
||||
from collections.abc import Mapping
|
||||
from threading import RLock
|
||||
from typing import Any, Callable, ClassVar, Collection, Iterable, Iterator
|
||||
from typing import Any, Callable, ClassVar, Iterable, Iterator
|
||||
|
||||
from ..fields import Field
|
||||
from ..models import BaseModel
|
||||
from ..sql_db import Connection, Cursor
|
||||
from ..tests.result import OdooTestResult
|
||||
from ..sql_db import Cursor
|
||||
from ..tools import Collector
|
||||
from ..tools.lru import LRU
|
||||
from .graph import Node
|
||||
|
||||
class Registry(Mapping[str, type[BaseModel]]):
|
||||
_lock: RLock
|
||||
_saved_lock: RLock | None
|
||||
registries: ClassVar[LRU]
|
||||
def __new__(cls, db_name: str) -> Registry: ...
|
||||
@classmethod
|
||||
@@ -26,19 +21,9 @@ class Registry(Mapping[str, type[BaseModel]]):
|
||||
update_module: bool = ...,
|
||||
) -> Registry: ...
|
||||
models: dict[str, type[BaseModel]]
|
||||
_sql_constraints: set
|
||||
_init: bool
|
||||
_database_translated_fields: Collection[str]
|
||||
_assertion_report: OdooTestResult
|
||||
_fields_by_model: Any
|
||||
_ordinary_tables: set[str] | None
|
||||
_constraint_queue: deque
|
||||
__cache: LRU
|
||||
_init_modules: set[str]
|
||||
updated_modules: list[str]
|
||||
loaded_xmlids: set
|
||||
db_name: str
|
||||
_db: Connection
|
||||
test_cr: Cursor | None
|
||||
test_lock: RLock | None
|
||||
loaded: bool
|
||||
@@ -46,11 +31,8 @@ class Registry(Mapping[str, type[BaseModel]]):
|
||||
field_depends: Collector
|
||||
field_depends_context: Collector
|
||||
field_inverses: Collector
|
||||
_field_trigger_trees: dict[Field, TriggerTree]
|
||||
_is_modifying_relations: dict[Field, bool]
|
||||
registry_sequence: int | None
|
||||
cache_sequence: int | None
|
||||
_invalidation_flags: threading.local
|
||||
has_unaccent: bool
|
||||
has_trigram: bool
|
||||
def init(self, db_name: str) -> None: ...
|
||||
@@ -66,23 +48,16 @@ class Registry(Mapping[str, type[BaseModel]]):
|
||||
def __delitem__(self, model_name: str) -> None: ...
|
||||
def descendants(self, model_names: Iterable[str], *kinds) -> set[str]: ...
|
||||
def load(self, cr: Cursor, module: Node) -> set[str]: ...
|
||||
_m2m: defaultdict[Any, list]
|
||||
def setup_models(self, cr: Cursor) -> None: ...
|
||||
@property
|
||||
def field_computed(self) -> dict[Field, list[Field]]: ...
|
||||
def get_trigger_tree(self, fields: list, select: Callable = ...) -> TriggerTree: ...
|
||||
def get_dependent_fields(self, field: Field) -> Iterator[Field]: ...
|
||||
def _discard_fields(self, fields: list[Field]) -> None: ...
|
||||
def get_field_trigger_tree(self, field: Field) -> TriggerTree: ...
|
||||
@property
|
||||
def _field_triggers(self) -> defaultdict[Field, Any]: ...
|
||||
def is_modifying_relations(self, field: Field) -> bool: ...
|
||||
def post_init(self, func: Callable, *args, **kwargs) -> None: ...
|
||||
def post_constraint(self, func: Callable, *args, **kwargs) -> None: ...
|
||||
def finalize_constraints(self) -> None: ...
|
||||
_post_init_queue: deque
|
||||
_foreign_keys: Any
|
||||
_is_install: bool
|
||||
def init_models(
|
||||
self, cr: Cursor, model_names: Iterable[str], context: dict, install: bool = ...
|
||||
) -> None: ...
|
||||
@@ -100,7 +75,6 @@ class Registry(Mapping[str, type[BaseModel]]):
|
||||
) -> None: ...
|
||||
def check_foreign_keys(self, cr: Cursor) -> None: ...
|
||||
def check_tables_exist(self, cr: Cursor) -> None: ...
|
||||
def _clear_cache(self) -> None: ...
|
||||
def clear_caches(self) -> None: ...
|
||||
def is_an_ordinary_table(self, model: BaseModel) -> bool: ...
|
||||
@property
|
||||
@@ -131,7 +105,6 @@ class TriggerTree(dict):
|
||||
root: Any
|
||||
def __init__(self, root: Any = ..., *args, **kwargs) -> None: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def increase(self, key) -> TriggerTree: ...
|
||||
def depth_first(self) -> Iterator[TriggerTree]: ...
|
||||
@classmethod
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import logging.handlers
|
||||
import warnings
|
||||
from logging import Logger, LogRecord
|
||||
from typing import IO, TextIO
|
||||
from typing import TextIO
|
||||
|
||||
def log(
|
||||
logger: Logger, level: int, prefix: str, msg, depth: int | None = ...
|
||||
@@ -9,9 +9,7 @@ def log(
|
||||
|
||||
class WatchedFileHandler(logging.handlers.WatchedFileHandler):
|
||||
errors: None
|
||||
_builtin_open: None
|
||||
def __init__(self, filename: str) -> None: ...
|
||||
def _open(self) -> IO: ...
|
||||
|
||||
class PostgreSQLHandler(logging.Handler):
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
@@ -24,7 +22,6 @@ BLUE: int
|
||||
MAGENTA: int
|
||||
CYAN: int
|
||||
WHITE: int
|
||||
_NOTHING: int
|
||||
DEFAULT: int
|
||||
RESET_SEQ: str
|
||||
COLOR_SEQ: str
|
||||
@@ -49,8 +46,6 @@ class DBFormatter(logging.Formatter):
|
||||
class ColoredFormatter(DBFormatter):
|
||||
def format(self, record: LogRecord): ...
|
||||
|
||||
_logger_init: bool
|
||||
|
||||
def init_logger(): ...
|
||||
|
||||
DEFAULT_LOG_CONFIGURATION: list[str]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from typing import Any, Callable, Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from ..fields import Field
|
||||
from ..models import MAGIC_COLUMNS as MAGIC_COLUMNS
|
||||
from ..models import BaseModel
|
||||
from ..sql_db import Cursor
|
||||
@@ -29,27 +28,16 @@ def combine(operator: str, unit, zero, domains: list[_Domain]) -> _Domain: ...
|
||||
def AND(domains: list[_Domain]) -> _Domain: ...
|
||||
def OR(domains: list[_Domain]) -> _Domain: ...
|
||||
def distribute_not(domain: _Domain) -> _Domain: ...
|
||||
def _anyfy_leaves(domain: _Domain, model: BaseModel) -> _Domain: ...
|
||||
def _tree_from_domain(domain: _Domain) -> tuple: ...
|
||||
def _tree_not(tree: tuple) -> tuple: ...
|
||||
def _tree_and(trees: Iterable[tuple]) -> tuple: ...
|
||||
def _tree_or(trees: Iterable[tuple]) -> tuple: ...
|
||||
def _tree_combine_anies(tree: tuple, model: BaseModel) -> tuple: ...
|
||||
def _tree_as_domain(tree: tuple) -> _Domain: ...
|
||||
def domain_combine_anies(domain: _Domain, model: BaseModel) -> _Domain: ...
|
||||
def prettify_domain(domain: _Domain, pre_indent: int = ...) -> str: ...
|
||||
def _quote(to_quote: str) -> str: ...
|
||||
def normalize_leaf(element): ...
|
||||
def is_operator(element) -> bool: ...
|
||||
def is_leaf(element, internal: bool = ...) -> bool: ...
|
||||
def is_boolean(element) -> bool: ...
|
||||
def check_leaf(element, internal: bool = ...) -> None: ...
|
||||
def _unaccent_wrapper(x) -> str: ...
|
||||
def get_unaccent_wrapper(cr: Cursor) -> Callable[[Any], str]: ...
|
||||
|
||||
class expression:
|
||||
_unaccent_wrapper: Callable[[Any], str]
|
||||
_has_trigram: bool
|
||||
root_model: BaseModel
|
||||
root_alias: str | None
|
||||
expression: _Domain
|
||||
@@ -62,6 +50,4 @@ class expression:
|
||||
alias: str | None = ...,
|
||||
query: Query | None = ...,
|
||||
) -> None: ...
|
||||
def _unaccent(self, field: Field) -> Callable[[Any], str]: ...
|
||||
def parse(self): ...
|
||||
def __leaf_to_sql(self, leaf, model: BaseModel, alias: str) -> tuple[str, list]: ...
|
||||
|
||||
@@ -9,17 +9,6 @@ class DatabaseExists(Warning): ...
|
||||
|
||||
def check_db_management_enabled(method: _CallableT) -> _CallableT: ...
|
||||
def check_super(passwd: str) -> Literal[True]: ...
|
||||
def _initialize_db(
|
||||
id,
|
||||
db_name: str,
|
||||
demo: bool,
|
||||
lang: str,
|
||||
user_password: str,
|
||||
login: str = ...,
|
||||
country_code: str | None = ...,
|
||||
phone: str | None = ...,
|
||||
) -> None: ...
|
||||
def _create_empty_database(name: str) -> None: ...
|
||||
def exp_create_database(
|
||||
db_name: str,
|
||||
demo: bool,
|
||||
@@ -30,7 +19,6 @@ def exp_create_database(
|
||||
phone: str | None = ...,
|
||||
) -> Literal[True]: ...
|
||||
def exp_duplicate_database(db_original_name: str, db_name: str) -> Literal[True]: ...
|
||||
def _drop_conn(cr: Cursor, db_name: str) -> None: ...
|
||||
def exp_drop(db_name: str) -> bool: ...
|
||||
def exp_dump(db_name: str, format: str) -> str: ...
|
||||
def dump_db_manifest(cr: Cursor) -> dict[str, Any]: ...
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
from typing import Any, Callable, Iterator, TypeVar
|
||||
|
||||
from psycopg2 import IntegrityError
|
||||
from typing import Any, Callable, TypeVar
|
||||
|
||||
from ..api import Environment
|
||||
from ..exceptions import ValidationError
|
||||
from ..sql_db import Cursor
|
||||
|
||||
_CallableT = TypeVar("_CallableT", bound=Callable)
|
||||
|
||||
PG_CONCURRENCY_ERRORS_TO_RETRY: tuple[str, str, str]
|
||||
MAX_TRIES_ON_CONCURRENCY_FAILURE: int
|
||||
|
||||
_CallableT = TypeVar("_CallableT", bound=Callable)
|
||||
|
||||
def dispatch(method: str, params): ...
|
||||
def execute_cr(cr: Cursor, uid: int, obj: str, method: str, *args, **kw): ...
|
||||
def execute_kw(
|
||||
db: str, uid: int, obj: str, method: str, args, kw: dict | None = ...
|
||||
): ...
|
||||
def execute(db: str, uid: int, obj: str, method: str, *args, **kw): ...
|
||||
def _as_validation_error(env: Environment, exc: IntegrityError) -> ValidationError: ...
|
||||
def retrying(func: Callable[[], Any], env: Environment): ...
|
||||
def _traverse_containers(val, type_) -> Iterator: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from itertools import chain as chain
|
||||
from socket import socket as socket_
|
||||
from threading import Semaphore, Thread
|
||||
from typing import Any, Callable, Iterable, Literal, TypeVar
|
||||
from typing import Any, Callable, Literal, TypeVar
|
||||
|
||||
import werkzeug.serving
|
||||
from gevent.pywsgi import WSGIServer
|
||||
@@ -47,7 +47,6 @@ class ThreadedWSGIServerReloadable(
|
||||
def server_bind(self) -> None: ...
|
||||
def server_activate(self) -> None: ...
|
||||
def process_request(self, request, client_address) -> None: ...
|
||||
def _handle_request_noblock(self) -> None: ...
|
||||
def shutdown_request(self, request) -> None: ...
|
||||
|
||||
class FSWatcherBase:
|
||||
@@ -71,7 +70,6 @@ class FSWatcherInotify(FSWatcherBase):
|
||||
|
||||
class CommonServer:
|
||||
app: Any
|
||||
_on_stop_funcs: list[Callable]
|
||||
interface: str
|
||||
port: int
|
||||
pid: int
|
||||
@@ -167,7 +165,6 @@ class Worker:
|
||||
def start(self) -> None: ...
|
||||
def stop(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def _runloop(self) -> None: ...
|
||||
|
||||
class WorkerHTTP(Worker):
|
||||
sock_timeout: float
|
||||
@@ -182,7 +179,6 @@ class WorkerCron(Worker):
|
||||
watchdog_timeout: int
|
||||
def __init__(self, multi: PreforkServer) -> None: ...
|
||||
def sleep(self) -> None: ...
|
||||
def _db_list(self): ...
|
||||
def process_work(self) -> None: ...
|
||||
dbcursor: Cursor
|
||||
def start(self) -> None: ...
|
||||
@@ -191,7 +187,6 @@ class WorkerCron(Worker):
|
||||
server: CommonServer | None
|
||||
|
||||
def load_server_wide_modules() -> None: ...
|
||||
def _reexec(updated_modules: Iterable[str] | None = ...) -> None: ...
|
||||
def load_test_file_py(registry: Registry, test_file: str) -> None: ...
|
||||
def preload_registries(dbnames: list[str] | None): ...
|
||||
def start(preload: list[str] | None = ..., stop: bool = ...): ...
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
from datetime import datetime
|
||||
from re import Pattern
|
||||
from threading import Lock, RLock
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Generator,
|
||||
Iterable,
|
||||
Iterator,
|
||||
Literal,
|
||||
NoReturn,
|
||||
Sequence,
|
||||
TypeVar,
|
||||
)
|
||||
from threading import RLock
|
||||
from typing import Any, Callable, Iterable, Iterator, NoReturn, TypeVar
|
||||
|
||||
import psycopg2.extensions
|
||||
from psycopg2.sql import Identifier
|
||||
|
||||
from .api import Transaction
|
||||
from .tools import Callbacks
|
||||
@@ -33,20 +22,12 @@ MAX_IDLE_TIMEOUT: int
|
||||
|
||||
class Savepoint:
|
||||
name: str
|
||||
_name: Identifier
|
||||
_cr: BaseCursor
|
||||
closed: bool
|
||||
def __init__(self, cr: BaseCursor) -> None: ...
|
||||
def __enter__(self: _SavepointT) -> _SavepointT: ...
|
||||
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
|
||||
def close(self, *, rollback: bool = ...) -> None: ...
|
||||
def rollback(self) -> None: ...
|
||||
def _close(self, rollback: bool) -> None: ...
|
||||
|
||||
class _FlushingSavepoint(Savepoint):
|
||||
def __init__(self, cr: BaseCursor) -> None: ...
|
||||
def rollback(self) -> None: ...
|
||||
def _close(self, rollback: bool) -> None: ...
|
||||
|
||||
class BaseCursor:
|
||||
precommit: Callbacks
|
||||
@@ -71,29 +52,19 @@ class Cursor(BaseCursor):
|
||||
sql_from_log: dict
|
||||
sql_into_log: dict
|
||||
sql_log_count: int
|
||||
_closed: bool
|
||||
__pool: ConnectionPool
|
||||
dbname: str
|
||||
_cnx: PsycoConnection
|
||||
_obj: psycopg2.extensions.cursor
|
||||
__caller: tuple[str, int | str] | Literal[False]
|
||||
cache: dict
|
||||
_now: datetime | None
|
||||
def __init__(self, pool: ConnectionPool, dbname: str, dsn: dict) -> None: ...
|
||||
def __build_dict(self, row: Sequence) -> dict[str, Any]: ...
|
||||
def dictfetchone(self) -> dict[str, Any] | None: ...
|
||||
def dictfetchmany(self, size) -> list[dict[str, Any]]: ...
|
||||
def dictfetchall(self) -> list[dict[str, Any]]: ...
|
||||
def __del__(self) -> None: ...
|
||||
def _format(self, query, params: Any | None = ...): ...
|
||||
def execute(self, query, params: Any | None = ..., log_exceptions: bool = ...): ...
|
||||
def split_for_in_conditions(
|
||||
self, ids: Iterable, size: int | None = ...
|
||||
) -> Iterator[tuple]: ...
|
||||
def print_log(self): ...
|
||||
def _enable_logging(self) -> Generator[None, None, None]: ...
|
||||
def close(self): ...
|
||||
def _close(self, leak: bool = ...) -> None: ...
|
||||
def commit(self): ...
|
||||
def rollback(self): ...
|
||||
def __getattr__(self, name: str): ...
|
||||
@@ -102,12 +73,6 @@ class Cursor(BaseCursor):
|
||||
def now(self) -> datetime: ...
|
||||
|
||||
class TestCursor(BaseCursor):
|
||||
_cursors_stack: list[TestCursor]
|
||||
_now: datetime | None
|
||||
_closed: bool
|
||||
_cursor: Cursor
|
||||
_lock: RLock
|
||||
_savepoint: Savepoint | None
|
||||
def __init__(self, cursor: Cursor, lock: RLock) -> None: ...
|
||||
def execute(self, *args, **kwargs): ...
|
||||
def close(self) -> None: ...
|
||||
@@ -119,24 +84,14 @@ class TestCursor(BaseCursor):
|
||||
class PsycoConnection(psycopg2.extensions.connection): ...
|
||||
|
||||
class ConnectionPool:
|
||||
_connections: list[tuple[psycopg2.extensions.connection, bool]]
|
||||
_maxconn: int
|
||||
_lock: Lock
|
||||
def __init__(self, maxconn: int = ...) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def _debug(self, msg, *args) -> None: ...
|
||||
def borrow(self, connection_info: dict) -> PsycoConnection: ...
|
||||
def give_back(
|
||||
self, connection: PsycoConnection, keep_in_pool: bool = ...
|
||||
) -> None: ...
|
||||
def close_all(self, dsn: dict | None = ...) -> None: ...
|
||||
def _dsn_equals(self, dsn1, dsn2) -> bool: ...
|
||||
def _dsn_to_dict(self, dsn) -> dict: ...
|
||||
|
||||
class Connection:
|
||||
__dbname: str
|
||||
__dsn: dict
|
||||
__pool: ConnectionPool
|
||||
def __init__(self, pool: ConnectionPool, dbname: str, dsn: dict) -> None: ...
|
||||
@property
|
||||
def dsn(self) -> dict: ...
|
||||
@@ -146,9 +101,6 @@ class Connection:
|
||||
def __bool__(self) -> NoReturn: ...
|
||||
|
||||
def connection_info_for(db_or_uri: str) -> tuple[str, dict]: ...
|
||||
|
||||
_Pool: ConnectionPool | None
|
||||
|
||||
def db_connect(to: str, allow_uri: bool = ...) -> Connection: ...
|
||||
def close_db(db_name: str) -> None: ...
|
||||
def close_all() -> None: ...
|
||||
|
||||
@@ -1,53 +1,16 @@
|
||||
from collections.abc import Generator
|
||||
from typing import Any
|
||||
from unittest import TestCase as _TestCase
|
||||
|
||||
__unittest: bool
|
||||
_subtest_msg_sentinel: object
|
||||
|
||||
class _Outcome:
|
||||
result: Any
|
||||
success: bool
|
||||
test: Any
|
||||
def __init__(self, test, result) -> None: ...
|
||||
def testPartExecutor(
|
||||
self, test_case, isTest: bool = ...
|
||||
) -> Generator[None, None, None]: ...
|
||||
def _complete_traceback(self, initial_tb): ...
|
||||
|
||||
class TestCase(_TestCase):
|
||||
_class_cleanups: list
|
||||
__unittest_skip__: bool
|
||||
__unittest_skip_why__: str
|
||||
_moduleSetUpFailed: bool
|
||||
_testMethodName: str
|
||||
_outcome: Any
|
||||
_cleanups: list
|
||||
_subtest: Any
|
||||
_type_equality_funcs: dict
|
||||
def __init__(self, methodName: str = ...) -> None: ...
|
||||
def addCleanup(self, function, *args, **kwargs) -> None: ...
|
||||
@classmethod
|
||||
def addClassCleanup(cls, function, *args, **kwargs) -> None: ...
|
||||
def shortDescription(self) -> None: ...
|
||||
def subTest(self, msg=..., **params) -> Generator[None, None, None]: ...
|
||||
def _addError(self, result, test, exc_info) -> None: ...
|
||||
def _callSetUp(self) -> None: ...
|
||||
def _callTestMethod(self, method) -> None: ...
|
||||
def _callTearDown(self) -> None: ...
|
||||
def _callCleanup(self, function, *args, **kwargs) -> None: ...
|
||||
def run(self, result): ...
|
||||
def doCleanups(self) -> None: ...
|
||||
@classmethod
|
||||
def doClassCleanups(cls) -> None: ...
|
||||
|
||||
class _SubTest(TestCase):
|
||||
_message: Any
|
||||
test_case: Any
|
||||
params: Any
|
||||
failureException: Any
|
||||
def __init__(self, test_case, message, params) -> None: ...
|
||||
def runTest(self) -> None: ...
|
||||
def _subDescription(self) -> str: ...
|
||||
def id(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import collections
|
||||
import logging
|
||||
from concurrent.futures import Future
|
||||
from itertools import count
|
||||
from subprocess import Popen
|
||||
from threading import Thread
|
||||
from typing import Any, Callable, Generator, Mapping, Match, TypeVar
|
||||
from xmlrpc import client as xmlrpclib
|
||||
|
||||
import requests
|
||||
from odoo.addons.base.models.res_users import Users
|
||||
from websocket import WebSocket
|
||||
|
||||
from ..api import Environment
|
||||
@@ -46,14 +44,10 @@ def new_test_user(
|
||||
groups: str = ...,
|
||||
context: dict | None = ...,
|
||||
**kwargs
|
||||
) -> "odoo.model.res_users": ...
|
||||
) -> "Users": ...
|
||||
|
||||
class RecordCapturer:
|
||||
_model: BaseModel
|
||||
_domain: list
|
||||
def __init__(self, model: BaseModel, domain: list) -> None: ...
|
||||
_before: BaseModel | None
|
||||
_after: BaseModel | None
|
||||
def __enter__(self: _T) -> _T: ...
|
||||
def __exit__(self, exc_type, exc_value, exc_traceback) -> None: ...
|
||||
@property
|
||||
@@ -62,15 +56,12 @@ class RecordCapturer:
|
||||
class MetaCase(type):
|
||||
def __init__(cls, name, bases, attrs) -> None: ...
|
||||
|
||||
def _normalize_arch_for_assert(arch_string: str, parser_method: str = ...) -> str: ...
|
||||
|
||||
class BaseCase(case.TestCase, metaclass=MetaCase):
|
||||
registry: Registry
|
||||
env: Environment
|
||||
cr: Cursor
|
||||
longMessage: bool
|
||||
warm: bool
|
||||
_python_version: tuple
|
||||
def __init__(self, methodName: str = ...) -> None: ...
|
||||
def run(self, result: OdooTestResult) -> None: ...
|
||||
def cursor(self) -> Cursor: ...
|
||||
@@ -88,9 +79,6 @@ class BaseCase(case.TestCase, metaclass=MetaCase):
|
||||
def startClassPatcher(cls, patcher): ...
|
||||
def with_user(self, login: str) -> None: ...
|
||||
def debug_mode(self) -> Generator[None, None, None]: ...
|
||||
def _assertRaises(
|
||||
self, exception, *, msg: Any | None = ...
|
||||
) -> Generator[Any, None, None]: ...
|
||||
def assertRaises(
|
||||
self, exception, func: Any | None = ..., *args, **kwargs
|
||||
) -> Generator[Any, None, None] | None: ...
|
||||
@@ -105,9 +93,6 @@ class BaseCase(case.TestCase, metaclass=MetaCase):
|
||||
) -> None: ...
|
||||
def assertItemsEqual(self, a, b, msg: str | None = ...) -> None: ...
|
||||
def assertTreesEqual(self, n1, n2, msg: str | None = ...) -> None: ...
|
||||
def _assertXMLEqual(
|
||||
self, original: str, expected: str, parser: str = ...
|
||||
) -> None: ...
|
||||
def assertXMLEqual(self, original: str, expected: str) -> None: ...
|
||||
def assertHTMLEqual(self, original: str, expected: str) -> None: ...
|
||||
profile_session: str
|
||||
@@ -120,10 +105,7 @@ class TransactionCase(BaseCase):
|
||||
env: Environment
|
||||
cr: Cursor
|
||||
@classmethod
|
||||
def _gc_filestore(cls) -> None: ...
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None: ...
|
||||
_savepoint_id: int
|
||||
def setUp(self): ...
|
||||
|
||||
class SingleTransactionCase(BaseCase):
|
||||
@@ -154,58 +136,23 @@ class ChromeBrowser:
|
||||
window_size: str
|
||||
touch_enabled: bool
|
||||
sigxcpu_handler: Any
|
||||
_request_id: count[int]
|
||||
_result: Future
|
||||
error_checker: Any
|
||||
had_failure: bool
|
||||
_responses: dict[int, Future]
|
||||
_frames: dict
|
||||
_handlers: dict
|
||||
_receiver: Thread
|
||||
def __init__(self, test_class: type[HttpCase]) -> None: ...
|
||||
def signal_handler(self, sig, frame) -> None: ...
|
||||
def stop(self) -> None: ...
|
||||
@property
|
||||
def executable(self) -> str | None: ...
|
||||
def _chrome_without_limit(self, cmd) -> Popen: ...
|
||||
def _spawn_chrome(self, cmd: list[str]) -> int | None: ...
|
||||
def _chrome_start(self) -> None: ...
|
||||
dev_tools_frontend_url: str
|
||||
def _find_websocket(self) -> None: ...
|
||||
def _json_command(
|
||||
self, command: str, timeout: int = ..., get_key: Any | None = ...
|
||||
): ...
|
||||
def _open_websocket(self) -> None: ...
|
||||
def _receive(self, dbname: str) -> None: ...
|
||||
def _websocket_request(
|
||||
self, method: str, *, params: Any | None = ..., timeout: float = ...
|
||||
): ...
|
||||
def _websocket_send(
|
||||
self, method: str, *, params: Any | None = ..., with_future: bool = ...
|
||||
) -> Future | None: ...
|
||||
def _handle_console(
|
||||
self, type, args: Any | None = ..., stackTrace: Any | None = ..., **kw
|
||||
) -> None: ...
|
||||
def _handle_exception(self, exceptionDetails: dict, timestamp) -> None: ...
|
||||
def _handle_frame_stopped_loading(self, frameId) -> None: ...
|
||||
def _handle_screencast_frame(self, sessionId, data, metadata) -> None: ...
|
||||
_TO_LEVEL: dict[str, int]
|
||||
def take_screenshot(
|
||||
self, prefix: str = ..., suffix: str | None = ...
|
||||
) -> Future: ...
|
||||
def _save_screencast(self, prefix: str = ...) -> None: ...
|
||||
def start_screencast(self) -> None: ...
|
||||
def set_cookie(self, name: str, value, path, domain) -> None: ...
|
||||
def delete_cookie(self, name: str, **kwargs) -> None: ...
|
||||
def _wait_ready(self, ready_code, timeout: int = ...) -> bool: ...
|
||||
def _wait_code_ok(
|
||||
self, code, timeout: float, error_checker: Any | None = ...
|
||||
) -> None: ...
|
||||
def navigate_to(self, url: str, wait_stop: bool = ...) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def _from_remoteobject(self, arg: Mapping): ...
|
||||
LINE_PATTERN: str
|
||||
def _format_stack(self, logrecord: Mapping) -> None: ...
|
||||
def console_formatter(self, args: list) -> Callable[[Match[str]], str]: ...
|
||||
|
||||
class Opener(requests.Session):
|
||||
@@ -224,7 +171,6 @@ class HttpCase(TransactionCase):
|
||||
browser_size: str
|
||||
touch_enabled: bool
|
||||
allow_end_on_form: bool
|
||||
_logger: logging.Logger
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None: ...
|
||||
xmlrpc_common: xmlrpclib.ServerProxy
|
||||
@@ -246,7 +192,6 @@ class HttpCase(TransactionCase):
|
||||
allow_redirects: bool = ...,
|
||||
head: bool = ...,
|
||||
) -> requests.Response: ...
|
||||
def _wait_remaining_requests(self, timeout: int = ...) -> None: ...
|
||||
def logout(self, keep_db: bool = ...) -> None: ...
|
||||
session: Session
|
||||
def authenticate(self, user, password) -> Session: ...
|
||||
|
||||
@@ -1,119 +1,51 @@
|
||||
import collections
|
||||
from typing import Any, Callable, Generic, Iterator, TypeVar
|
||||
from typing import Any, Generic, Iterator, TypeVar
|
||||
|
||||
from lxml.etree import _Element
|
||||
|
||||
from ..api import Environment
|
||||
from ..models import BaseModel
|
||||
|
||||
_ModelT = TypeVar("_ModelT", bound=BaseModel)
|
||||
_FormT = TypeVar("_FormT", bound=Form)
|
||||
|
||||
class Form(Generic[_ModelT]):
|
||||
_record: _ModelT
|
||||
_env: Environment
|
||||
_models_info: dict
|
||||
_view: Any
|
||||
_values: dict
|
||||
_changed: set
|
||||
def __init__(self, record: _ModelT, view: Any | None = ...) -> None: ...
|
||||
def _process_view(
|
||||
self, tree: _Element, model: BaseModel, level: int = ...
|
||||
) -> dict: ...
|
||||
def _get_one2many_edition_view(
|
||||
self, field_info: dict, node: _Element, level: int
|
||||
) -> dict: ...
|
||||
def __str__(self) -> str: ...
|
||||
def _init_from_defaults(self) -> None: ...
|
||||
def __getattr__(self, field_name: str): ...
|
||||
def __setattr__(self, field_name: str, value) -> None: ...
|
||||
def _get_modifier(
|
||||
self,
|
||||
field_name: str,
|
||||
modifier: str,
|
||||
*,
|
||||
view: Any | None = ...,
|
||||
vals: dict | None = ...
|
||||
): ...
|
||||
_OPS: dict[str, Callable]
|
||||
def _get_context(self, field_name: str): ...
|
||||
def _get_eval_context(self) -> dict: ...
|
||||
def __enter__(self: _FormT) -> _FormT: ...
|
||||
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
|
||||
def save(self) -> _ModelT: ...
|
||||
@property
|
||||
def record(self) -> _ModelT: ...
|
||||
def _values_to_save(self, all_fields: bool = ...) -> dict: ...
|
||||
def _values_to_save_(
|
||||
self,
|
||||
values: dict,
|
||||
fields: dict,
|
||||
view: dict,
|
||||
changed: set,
|
||||
all_fields: bool = ...,
|
||||
modifiers_values: dict | None = ...,
|
||||
parent_link: str | None = ...,
|
||||
) -> dict: ...
|
||||
def _perform_onchange(self, field_name: str | None = ...) -> dict: ...
|
||||
def _onchange_values(self) -> dict: ...
|
||||
def _onchange_values_(self, fields: dict, values: dict) -> dict: ...
|
||||
def _cleanup_onchange(self, field_info: dict, value, current): ...
|
||||
|
||||
class O2MForm(Form):
|
||||
_proxy: O2MProxy
|
||||
_index: int | None
|
||||
def __init__(self, proxy: O2MProxy, index: int | None = ...) -> None: ...
|
||||
def _get_modifier(
|
||||
self,
|
||||
field_name: str,
|
||||
modifier: str,
|
||||
*,
|
||||
view: Any | None = ...,
|
||||
vals: dict | None = ...
|
||||
): ...
|
||||
def _get_eval_context(self) -> dict: ...
|
||||
def _onchange_values(self) -> dict: ...
|
||||
def save(self) -> None: ...
|
||||
def _values_to_save(self, all_fields: bool = ...) -> dict: ...
|
||||
|
||||
class UpdateDict(dict):
|
||||
_changed: set
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def changed_items(self) -> Iterator[tuple]: ...
|
||||
def update(self, *args, **kw) -> None: ...
|
||||
|
||||
class X2MProxy:
|
||||
_form: Form
|
||||
_field: str
|
||||
_field_info: dict
|
||||
def __init__(self, form: Form, field_name: str) -> None: ...
|
||||
def _assert_editable(self) -> None: ...
|
||||
|
||||
class O2MProxy(X2MProxy):
|
||||
_records: list
|
||||
def __init__(self, form: Form, field_name: str) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
@property
|
||||
def _model(self) -> BaseModel: ...
|
||||
def new(self) -> O2MForm: ...
|
||||
def edit(self, index: int) -> O2MForm: ...
|
||||
def remove(self, index: int) -> None: ...
|
||||
def _command_index(self, for_record: int) -> int: ...
|
||||
|
||||
class M2MProxy(X2MProxy, collections.abc.Sequence):
|
||||
def __getitem__(self, index: int) -> BaseModel: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[BaseModel]: ...
|
||||
def __contains__(self, record: BaseModel) -> bool: ...
|
||||
def _get_ids(self) -> list: ...
|
||||
def add(self, record: BaseModel) -> None: ...
|
||||
def remove(self, id: int | None = ..., index: int | None = ...) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
|
||||
def read_record(record: BaseModel, fields: dict) -> dict: ...
|
||||
def _cleanup_from_default(type_: str, value): ...
|
||||
|
||||
class Dotter:
|
||||
__values: Any
|
||||
def __init__(self, values) -> None: ...
|
||||
def __getattr__(self, key): ...
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
from importlib.machinery import ModuleSpec
|
||||
from types import ModuleType
|
||||
from typing import Iterator
|
||||
|
||||
from .result import OdooTestResult
|
||||
from .suite import OdooSuite
|
||||
|
||||
def get_test_modules(module: str) -> list: ...
|
||||
def _get_tests_modules(mod: ModuleSpec) -> list: ...
|
||||
def _get_upgrade_test_modules(module) -> Iterator[ModuleType]: ...
|
||||
def make_suite(module_names: list[str], position: str = ...) -> OdooSuite: ...
|
||||
def run_suite(suite: OdooSuite, module_name: str | None = ...) -> OdooTestResult: ...
|
||||
def unwrap_suite(test) -> Iterator: ...
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
from collections.abc import Generator
|
||||
from logging import Logger
|
||||
from re import Pattern
|
||||
from typing import Any, NamedTuple
|
||||
|
||||
__unittest: bool
|
||||
STDOUT_LINE: str
|
||||
STDERR_LINE: str
|
||||
stats_logger: Logger
|
||||
@@ -13,11 +11,7 @@ class Stat(NamedTuple):
|
||||
queries: int
|
||||
def __add__(self, other: Stat) -> Stat: ...
|
||||
|
||||
_TEST_ID: Pattern
|
||||
|
||||
class OdooTestResult:
|
||||
_previousTestClass: Any
|
||||
_moduleSetUpFailed: bool
|
||||
failures_count: int
|
||||
errors_count: int
|
||||
testsRun: int
|
||||
@@ -25,7 +19,6 @@ class OdooTestResult:
|
||||
tb_locals: bool
|
||||
time_start: float | None
|
||||
queries_start: int | None
|
||||
_soft_fail: bool
|
||||
had_failure: bool
|
||||
stats: dict[str, Stat]
|
||||
def __init__(
|
||||
@@ -43,11 +36,6 @@ class OdooTestResult:
|
||||
def addSuccess(self, test) -> None: ...
|
||||
def addSkip(self, test, reason) -> None: ...
|
||||
def wasSuccessful(self) -> bool: ...
|
||||
def _exc_info_to_string(self, err, test) -> str: ...
|
||||
def _is_relevant_tb_level(self, tb) -> bool: ...
|
||||
def _count_relevant_tb_levels(self, tb) -> int: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def soft_fail(self) -> Generator[None, None, None]: ...
|
||||
def update(self, other) -> None: ...
|
||||
def log(
|
||||
|
||||
@@ -1,29 +1,7 @@
|
||||
from typing import Any
|
||||
from unittest import BaseTestSuite
|
||||
|
||||
__unittest: bool
|
||||
|
||||
class TestSuite(BaseTestSuite):
|
||||
def run(self, result, debug: bool = ...): ...
|
||||
def _handleClassSetUp(self, test, result) -> None: ...
|
||||
def _createClassOrModuleLevelException(
|
||||
self, result, exception, method_name, parent, info: Any | None = ...
|
||||
) -> None: ...
|
||||
def _tearDownPreviousClass(self, test, result) -> None: ...
|
||||
|
||||
class _ErrorHolder:
|
||||
failureException: Any
|
||||
description: str
|
||||
def __init__(self, description: str) -> None: ...
|
||||
def id(self) -> str: ...
|
||||
def shortDescription(self) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def run(self, result) -> None: ...
|
||||
def __call__(self, result) -> None: ...
|
||||
def countTestCases(self) -> int: ...
|
||||
|
||||
class OdooSuite(TestSuite):
|
||||
def _handleClassSetUp(self, test, result) -> None: ...
|
||||
def _tearDownPreviousClass(self, test, result) -> None: ...
|
||||
def has_http_case(self) -> bool: ...
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from re import Pattern
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
from werkzeug.datastructures import CallbackDict
|
||||
@@ -8,8 +7,6 @@ _ModificationTrackingDictT = TypeVar(
|
||||
)
|
||||
_SessionT = TypeVar("_SessionT", bound=Session)
|
||||
|
||||
_sha1_re: Pattern
|
||||
|
||||
def generate_key(salt: Any = ...) -> str: ...
|
||||
|
||||
class ModificationTrackingDict(CallbackDict):
|
||||
@@ -22,7 +19,6 @@ class Session(ModificationTrackingDict):
|
||||
sid: str
|
||||
new: bool
|
||||
def __init__(self, data, sid, new: bool = ...): ...
|
||||
def __repr__(self) -> str: ...
|
||||
@property
|
||||
def should_save(self) -> bool: ...
|
||||
|
||||
@@ -37,8 +33,6 @@ class SessionStore(Generic[_SessionT]):
|
||||
def delete(self, session: _SessionT) -> None: ...
|
||||
def get(self, sid: str) -> _SessionT: ...
|
||||
|
||||
_fs_transaction_suffix: str
|
||||
|
||||
class FilesystemSessionStore(SessionStore[_SessionT]):
|
||||
path: str | None
|
||||
filename_template: str
|
||||
|
||||
@@ -3,15 +3,12 @@ from re import Pattern
|
||||
class UserAgentParser(object):
|
||||
platforms: list[tuple[str, Pattern]]
|
||||
browsers: list[tuple[str, Pattern]]
|
||||
_browser_version_re: str
|
||||
_language_re: Pattern
|
||||
def __init__(self) -> None: ...
|
||||
def __call__(
|
||||
self, user_agent: str
|
||||
) -> tuple[str | None, str | None, str | None, str | None]: ...
|
||||
|
||||
class UserAgent(object):
|
||||
_parser: UserAgentParser
|
||||
string: str
|
||||
platform: str | None
|
||||
browser: str | None
|
||||
@@ -19,7 +16,5 @@ class UserAgent(object):
|
||||
language: str | None
|
||||
def __init__(self, environ_or_string: dict | str): ...
|
||||
def to_header(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __nonzero__(self) -> bool: ...
|
||||
__bool__ = __nonzero__
|
||||
def __repr__(self) -> str: ...
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
from typing import Callable
|
||||
|
||||
__version_info__: tuple
|
||||
__version__: str
|
||||
|
||||
def user_data_dir(
|
||||
appname: str | None = ...,
|
||||
@@ -66,9 +63,3 @@ class AppDirs:
|
||||
def user_cache_dir(self) -> str: ...
|
||||
@property
|
||||
def user_log_dir(self) -> str: ...
|
||||
|
||||
def _get_win_folder_from_registry(csidl_name: str) -> str: ...
|
||||
def _get_win_folder_with_pywin32(csidl_name: str) -> str: ...
|
||||
def _get_win_folder_with_ctypes(csidl_name: str) -> str: ...
|
||||
|
||||
_get_win_folder: Callable[[str], str]
|
||||
|
||||
@@ -11,33 +11,15 @@ class MyOption(Option):
|
||||
|
||||
DEFAULT_LOG_HANDLER: str
|
||||
|
||||
def _get_default_datadir() -> str: ...
|
||||
def _deduplicate_loggers(loggers) -> tuple[str, ...]: ...
|
||||
|
||||
class configmanager:
|
||||
options: dict[str, Any]
|
||||
blacklist_for_save: set[str]
|
||||
casts: dict
|
||||
misc: dict
|
||||
config_file: str
|
||||
_LOGLEVELS: dict
|
||||
parser: OptionParser
|
||||
def __init__(self, fname: str | None = ...) -> None: ...
|
||||
def parse_config(self, args: list | None = ...): ...
|
||||
rcfile: str
|
||||
def _parse_config(self, args: list | None = ...): ...
|
||||
def _warn_deprecated_options(self) -> None: ...
|
||||
def _is_addons_path(self, path: str) -> bool: ...
|
||||
def _check_addons_path(
|
||||
self, option: MyOption, opt, value, parser: OptionParser
|
||||
) -> None: ...
|
||||
def _check_upgrade_path(
|
||||
self, option: MyOption, opt, value, parser: OptionParser
|
||||
) -> None: ...
|
||||
def _is_upgrades_path(self, res: str) -> bool: ...
|
||||
def _test_enable_callback(
|
||||
self, option: MyOption, opt, value, parser: OptionParser
|
||||
) -> None: ...
|
||||
def load(self) -> None: ...
|
||||
def save(self, keys: Any | None = ...) -> None: ...
|
||||
def get(self, key, default: Any | None = ...): ...
|
||||
@@ -52,6 +34,5 @@ class configmanager:
|
||||
def filestore(self, dbname: str) -> str: ...
|
||||
def set_admin_password(self, new_password) -> None: ...
|
||||
def verify_admin_password(self, password) -> bool: ...
|
||||
def _normalize(self, path: str) -> str: ...
|
||||
|
||||
config: configmanager
|
||||
|
||||
6
odoo-stubs/tools/constants.pyi
Normal file
6
odoo-stubs/tools/constants.pyi
Normal file
@@ -0,0 +1,6 @@
|
||||
SCRIPT_EXTENSIONS: tuple[str, ...]
|
||||
STYLE_EXTENSIONS: tuple[str, ...]
|
||||
TEMPLATE_EXTENSIONS: tuple[str, ...]
|
||||
ASSET_EXTENSIONS: tuple[str, ...]
|
||||
SUPPORTED_DEBUGGER: set[str]
|
||||
EXTERNAL_ASSET: object
|
||||
@@ -4,16 +4,8 @@ from typing import Any, Callable, TextIO
|
||||
from lxml.etree import _Element
|
||||
|
||||
from ..api import Environment
|
||||
from ..sql_db import Cursor
|
||||
from .misc import ustr as ustr
|
||||
|
||||
__all__ = [
|
||||
"convert_file",
|
||||
"convert_sql_import",
|
||||
"convert_csv_import",
|
||||
"convert_xml_import",
|
||||
]
|
||||
|
||||
safe_eval: Callable
|
||||
|
||||
class ParseError(Exception): ...
|
||||
@@ -23,9 +15,6 @@ class RecordDictWrapper(dict):
|
||||
def __init__(self, record) -> None: ...
|
||||
def __getitem__(self, key): ...
|
||||
|
||||
def _get_idref(self, env: Environment, model_str: str, idref: dict) -> dict: ...
|
||||
def _fix_multiple_roots(node: _Element) -> None: ...
|
||||
def _eval_xml(self, node: _Element, env: Environment): ...
|
||||
def str2bool(value) -> bool: ...
|
||||
def nodeattr2bool(node: _Element, attr, default: bool = ...) -> bool: ...
|
||||
|
||||
@@ -34,19 +23,10 @@ class xml_import:
|
||||
self, node: _Element, eval_context: dict | None = ...
|
||||
) -> Environment: ...
|
||||
def make_xml_id(self, xml_id: str) -> str: ...
|
||||
def _test_xml_id(self, xml_id: str) -> None: ...
|
||||
def _tag_delete(self, rec: _Element) -> None: ...
|
||||
def _tag_function(self, rec: _Element) -> None: ...
|
||||
def _tag_menuitem(self, rec: _Element, parent: Any | None = ...) -> None: ...
|
||||
def _tag_record(
|
||||
self, rec: _Element, extra_vals: dict | None = ...
|
||||
) -> tuple[str, int] | None: ...
|
||||
def _tag_template(self, el: _Element) -> tuple[str, int] | None: ...
|
||||
def id_get(self, id_str: str, raise_if_not_found: bool = ...) -> int | None: ...
|
||||
def model_id_get(
|
||||
self, id_str: str, raise_if_not_found: bool = ...
|
||||
) -> tuple[Any, Any]: ...
|
||||
def _tag_root(self, el: _Element) -> None: ...
|
||||
@property
|
||||
def env(self) -> Environment: ...
|
||||
@property
|
||||
@@ -55,9 +35,7 @@ class xml_import:
|
||||
module: str
|
||||
envs: list[Environment]
|
||||
idref: dict
|
||||
_noupdate: list[bool]
|
||||
xml_filename: str
|
||||
_tags: dict[str, Callable]
|
||||
def __init__(
|
||||
self,
|
||||
env: Environment,
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
def round(f: float) -> float: ...
|
||||
def _float_check_precision(
|
||||
precision_digits: int | None = ..., precision_rounding: float | None = ...
|
||||
) -> float: ...
|
||||
def float_round(
|
||||
value: float,
|
||||
precision_digits: int | None = ...,
|
||||
@@ -20,9 +17,6 @@ def float_compare(
|
||||
precision_rounding: float | None = ...,
|
||||
) -> int: ...
|
||||
def float_repr(value: float, precision_digits: int) -> str: ...
|
||||
|
||||
_float_repr = float_repr
|
||||
|
||||
def float_split_str(value: float, precision_digits: int) -> tuple[str, str]: ...
|
||||
def float_split(value: float, precision_digits: int) -> tuple[int, int]: ...
|
||||
def json_float_round(
|
||||
|
||||
@@ -31,13 +31,9 @@ def classproperty(func: Callable[..., _T]) -> _ClassProperty[_T]: ...
|
||||
|
||||
class lazy:
|
||||
def __init__(self, func, *args, **kwargs) -> None: ...
|
||||
@property
|
||||
def _value(self): ...
|
||||
def __getattr__(self, name): ...
|
||||
def __setattr__(self, name, value): ...
|
||||
def __delattr__(self, name): ...
|
||||
def __repr__(self): ...
|
||||
def __str__(self): ...
|
||||
def __bytes__(self): ...
|
||||
def __format__(self, format_spec): ...
|
||||
def __lt__(self, other): ...
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
from collections import OrderedDict
|
||||
from threading import RLock
|
||||
from typing import Any
|
||||
|
||||
__all__ = ["LRU"]
|
||||
|
||||
class LRU:
|
||||
_lock: RLock
|
||||
count: int
|
||||
d: OrderedDict
|
||||
def __init__(self, count: int, pairs: tuple[Any, Any] = ...) -> None: ...
|
||||
|
||||
@@ -3,21 +3,11 @@ from re import Pattern
|
||||
from typing import Callable, Collection, FrozenSet, Literal
|
||||
|
||||
from lxml.etree import _Element
|
||||
from lxml.html import clean
|
||||
from markupsafe import Markup
|
||||
|
||||
safe_attrs: FrozenSet
|
||||
SANITIZE_TAGS: dict[str, Collection[str]]
|
||||
|
||||
class _Cleaner(clean.Cleaner):
|
||||
_style_re: Pattern
|
||||
_style_whitelist: list[str]
|
||||
strip_classes: bool
|
||||
sanitize_style: bool
|
||||
def __call__(self, doc: _Element) -> None: ...
|
||||
def strip_class(self, el: _Element) -> None: ...
|
||||
def parse_style(self, el: _Element) -> None: ...
|
||||
|
||||
def tag_quote(el: _Element) -> None: ...
|
||||
def html_normalize(
|
||||
src: str, filter_callback: Callable[[_Element], _Element] | None = ...
|
||||
|
||||
@@ -1,30 +1,3 @@
|
||||
import collections
|
||||
from re import Pattern
|
||||
from typing import Any, Literal
|
||||
|
||||
__all__ = ["guess_mimetype"]
|
||||
_ooxml_dirs: dict[str, str]
|
||||
|
||||
def _check_ooxml(data: bytes) -> str | Literal[False]: ...
|
||||
|
||||
_mime_validator: Pattern
|
||||
|
||||
def _check_open_container_format(data: bytes) -> str | Literal[False]: ...
|
||||
|
||||
_xls_pattern: Pattern
|
||||
_ppt_pattern: Pattern
|
||||
|
||||
def _check_olecf(data: bytes) -> str | Literal[False]: ...
|
||||
def _check_svg(data: bytes) -> str | None: ...
|
||||
|
||||
_Entry = collections.namedtuple("_Entry", ["mimetype", "signatures", "discriminants"])
|
||||
_mime_mappings: tuple[_Entry, ...]
|
||||
|
||||
def _odoo_guess_mimetype(bin_data: str, default: str = ...) -> str: ...
|
||||
|
||||
_guesser: Any
|
||||
ms: Any
|
||||
|
||||
def guess_mimetype(bin_data: str, default: str | None = ...) -> str: ...
|
||||
def neuter_mimetype(mimetype: str, user: "odoo.model.res_users") -> str: ...
|
||||
def neuter_mimetype(mimetype: str, user) -> str: ...
|
||||
def get_extension(filename: str) -> str: ...
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import datetime
|
||||
import pickle as pickle_
|
||||
from collections import deque
|
||||
from collections.abc import Mapping, MutableMapping, MutableSet
|
||||
from contextlib import ContextDecorator, suppress
|
||||
from logging import Handler, LogRecord
|
||||
@@ -24,6 +23,8 @@ import markupsafe
|
||||
import xlsxwriter
|
||||
import xlwt
|
||||
from babel.core import Locale
|
||||
from odoo.addons.base.models.res_currency import Currency
|
||||
from odoo.addons.base.models.res_lang import Lang
|
||||
from xlwt import Worksheet
|
||||
|
||||
from ..api import Environment
|
||||
@@ -44,9 +45,6 @@ SKIPPED_ELEMENT_TYPES: tuple
|
||||
NON_BREAKING_SPACE: str
|
||||
|
||||
def find_in_path(name: str) -> str: ...
|
||||
def _exec_pipe(
|
||||
prog, args, env: Mapping[str, str] | None = ...
|
||||
) -> tuple[IO[AnyStr] | None, IO[AnyStr] | None]: ...
|
||||
def exec_command_pipe(
|
||||
name: str, *args
|
||||
) -> tuple[IO[AnyStr] | None, IO[AnyStr] | None]: ...
|
||||
@@ -108,8 +106,7 @@ def attrgetter(*items): ...
|
||||
def discardattr(obj, key: str) -> None: ...
|
||||
def remove_accents(input_str: str) -> str: ...
|
||||
|
||||
class unquote(str):
|
||||
def __repr__(self) -> str: ...
|
||||
class unquote(str): ...
|
||||
|
||||
class mute_logger(Handler):
|
||||
loggers: tuple[str]
|
||||
@@ -141,8 +138,6 @@ class lower_logging(Handler):
|
||||
) -> None: ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
|
||||
_ph: Any
|
||||
|
||||
class CountingStream(Generic[_T]):
|
||||
stream: Iterator[_T]
|
||||
index: int
|
||||
@@ -155,7 +150,6 @@ class CountingStream(Generic[_T]):
|
||||
def stripped_sys_argv(*strip_args: str) -> list[str]: ...
|
||||
|
||||
class ConstantMapping(Mapping[_KT, _VT]):
|
||||
_value: _VT
|
||||
def __init__(self, val: _VT) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator: ...
|
||||
@@ -184,19 +178,16 @@ class Collector(dict[_KT, tuple[_T]]):
|
||||
def discard_keys_and_values(self, excludes: Collection): ...
|
||||
|
||||
class StackMap(MutableMapping):
|
||||
_maps: list[MutableMapping]
|
||||
def __init__(self, m: MutableMapping | None = ...) -> None: ...
|
||||
def __getitem__(self, key): ...
|
||||
def __setitem__(self, key, val) -> None: ...
|
||||
def __delitem__(self, key) -> None: ...
|
||||
def __iter__(self) -> Iterator: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __str__(self) -> str: ...
|
||||
def pushmap(self, m: MutableMapping | None = ...) -> None: ...
|
||||
def popmap(self) -> MutableMapping: ...
|
||||
|
||||
class OrderedSet(MutableSet):
|
||||
_map: dict
|
||||
def __init__(self, elems: Iterable = ...) -> None: ...
|
||||
def __contains__(self, elem) -> bool: ...
|
||||
def __iter__(self) -> Iterator: ...
|
||||
@@ -205,13 +196,11 @@ class OrderedSet(MutableSet):
|
||||
def discard(self, elem) -> None: ...
|
||||
def update(self, elems: Iterable) -> None: ...
|
||||
def difference_update(self, elems: Iterable) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
|
||||
class LastOrderedSet(OrderedSet):
|
||||
def add(self, elem) -> None: ...
|
||||
|
||||
class Callbacks:
|
||||
_funcs: deque
|
||||
data: dict
|
||||
def __init__(self) -> None: ...
|
||||
def add(self, func: Callable) -> None: ...
|
||||
@@ -251,7 +240,7 @@ class replace_exceptions(ContextDecorator):
|
||||
|
||||
html_escape = markupsafe.escape
|
||||
|
||||
def get_lang(env: Environment, lang_code: str = ...) -> "odoo.model.res_lang": ...
|
||||
def get_lang(env: Environment, lang_code: str = ...) -> "Lang": ...
|
||||
def babel_locale_parse(lang_code: str) -> Locale: ...
|
||||
def formatLang(
|
||||
env: Environment,
|
||||
@@ -260,7 +249,7 @@ def formatLang(
|
||||
grouping: bool = ...,
|
||||
monetary: bool = ...,
|
||||
dp: bool = ...,
|
||||
currency_obj: "odoo.model.res_currency" = ...,
|
||||
currency_obj: "Currency" = ...,
|
||||
) -> str: ...
|
||||
def format_date(
|
||||
env: Environment,
|
||||
@@ -279,34 +268,23 @@ def format_datetime(
|
||||
def format_time(
|
||||
env: Environment, value, tz: str = ..., time_format: str = ..., lang_code: str = ...
|
||||
) -> str: ...
|
||||
def _format_time_ago(
|
||||
env: Environment,
|
||||
time_delta: datetime.timedelta | int,
|
||||
lang_code: str = ...,
|
||||
add_direction: bool = ...,
|
||||
) -> str: ...
|
||||
def format_decimalized_number(number: float, decimal: int = ...) -> str: ...
|
||||
def format_decimalized_amount(
|
||||
amount: float, currency: "odoo.model.res_currency | None" = ...
|
||||
amount: float, currency: "Currency | None" = ...
|
||||
) -> str: ...
|
||||
def format_amount(
|
||||
env: Environment,
|
||||
amount: float,
|
||||
currency: "odoo.model.res_currency",
|
||||
currency: "Currency",
|
||||
lang_code: str = ...,
|
||||
) -> str: ...
|
||||
def format_duration(value: float) -> str: ...
|
||||
|
||||
consteq: Callable[[str, str], bool]
|
||||
_PICKLE_SAFE_NAMES: dict
|
||||
|
||||
class Unpickler(pickle_.Unpickler):
|
||||
def find_class(self, module_name: str, name: str): ...
|
||||
|
||||
def _pickle_load(
|
||||
stream: pickle_._ReadableFileobj, encoding: str = ..., errors: bool = ...
|
||||
): ...
|
||||
|
||||
pickle: ModuleType
|
||||
|
||||
class DotDict(dict):
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from re import Pattern
|
||||
from typing import Callable, Iterator
|
||||
from typing import Callable
|
||||
|
||||
component_re: Pattern
|
||||
replace: Callable
|
||||
|
||||
def _parse_version_parts(s: str) -> Iterator[str]: ...
|
||||
def parse_version(s: str) -> tuple[str]: ...
|
||||
|
||||
@@ -2,17 +2,15 @@ from io import BytesIO
|
||||
from re import Pattern
|
||||
from typing import Any, BinaryIO, Iterable
|
||||
|
||||
from odoo.addons.base.models.ir_attachment import IrAttachment
|
||||
from PyPDF2 import PdfFileReader, PdfFileWriter
|
||||
from PyPDF2.generic import ArrayObject as ArrayObject
|
||||
from PyPDF2.generic import IndirectObject
|
||||
from PyPDF2.utils import b_ as b_
|
||||
|
||||
DEFAULT_PDF_DATETIME_FORMAT: str
|
||||
REGEX_SUBTYPE_UNFORMATED: Pattern
|
||||
REGEX_SUBTYPE_FORMATED: Pattern
|
||||
|
||||
def _unwrapping_get(self, key, default: Any | None = ...): ...
|
||||
|
||||
class BrandedFileWriter(PdfFileWriter):
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@@ -20,7 +18,7 @@ PdfFileWriter = BrandedFileWriter
|
||||
|
||||
def merge_pdf(pdf_data: Iterable[bytes]) -> bytes: ...
|
||||
def rotate_pdf(pdf: bytes) -> bytes: ...
|
||||
def to_pdf_stream(attachment: "odoo.model.ir_attachment") -> BytesIO: ...
|
||||
def to_pdf_stream(attachment: "IrAttachment") -> BytesIO: ...
|
||||
def add_banner(
|
||||
pdf_stream: str | BinaryIO,
|
||||
text: str | None = ...,
|
||||
@@ -32,19 +30,13 @@ class OdooPdfFileReader(PdfFileReader):
|
||||
def getAttachments(self) -> Iterable[tuple[Any, Any]]: ...
|
||||
|
||||
class OdooPdfFileWriter(PdfFileWriter):
|
||||
_reader: PdfFileReader | None
|
||||
is_pdfa: bool
|
||||
_header: bytes
|
||||
_ID: Any
|
||||
def __init__(self, *args, **kwargs):
|
||||
None
|
||||
def addAttachment(self, fname: str, fdata, subtype: str | None = ...) -> None: ...
|
||||
def embed_odoo_attachment(
|
||||
self, attachment: "odoo.model.ir_attachment", subtype: str | None = ...
|
||||
self, attachment: "IrAttachment", subtype: str | None = ...
|
||||
) -> None: ...
|
||||
def cloneReaderDocumentRoot(self, reader: PdfFileReader) -> None: ...
|
||||
def convert_to_pdfa(self) -> None: ...
|
||||
def add_file_metadata(self, metadata_content: bytes) -> None: ...
|
||||
def _create_attachment_object(
|
||||
self, attachment: dict[str, Any]
|
||||
) -> IndirectObject: ...
|
||||
|
||||
@@ -10,25 +10,17 @@ _T = TypeVar("_T")
|
||||
real_datetime_now: Callable[..., datetime]
|
||||
real_time: Callable[[], float]
|
||||
|
||||
def _format_frame(frame: FrameType) -> tuple[str, int, str, str]: ...
|
||||
def _format_stack(stack: Iterable) -> list[list]: ...
|
||||
def get_current_frame(thread: Thread | None = ...) -> FrameType: ...
|
||||
def _get_stack_trace(
|
||||
frame: FrameType, limit_frame: FrameType | None = ...
|
||||
) -> list[tuple[str, int, str, str]]: ...
|
||||
def stack_size() -> int: ...
|
||||
def make_session(name: str = ...) -> str: ...
|
||||
def force_hook() -> None: ...
|
||||
|
||||
class Collector:
|
||||
name: str | None
|
||||
_registry: dict[str, Any]
|
||||
@classmethod
|
||||
def __init_subclass__(cls) -> None: ...
|
||||
@classmethod
|
||||
def make(cls, name: str, *args, **kwargs): ...
|
||||
_processed: bool
|
||||
_entries: list[dict]
|
||||
profiler: Profiler | None
|
||||
def __init__(self) -> None: ...
|
||||
def start(self) -> None: ...
|
||||
@@ -64,7 +56,6 @@ class SyncCollector(Collector):
|
||||
def start(self) -> None: ...
|
||||
def stop(self) -> None: ...
|
||||
def hook(self, _frame: FrameType, event: str, _arg: Any | None = ...): ...
|
||||
def _get_stack_trace(self, frame: FrameType | None = ...) -> None: ...
|
||||
def post_process(self) -> None: ...
|
||||
|
||||
class QwebTracker:
|
||||
@@ -88,7 +79,6 @@ class QwebCollector(Collector):
|
||||
events: list
|
||||
hook: Callable
|
||||
def __init__(self) -> None: ...
|
||||
def _get_directive_profiling_name(self, directive: str, attrib: dict) -> str: ...
|
||||
def start(self) -> None: ...
|
||||
def stop(self) -> None: ...
|
||||
def post_process(self) -> None: ...
|
||||
@@ -125,7 +115,6 @@ class Profiler:
|
||||
) -> None: ...
|
||||
def __enter__(self: _T) -> _T: ...
|
||||
def __exit__(self, *args) -> None: ...
|
||||
def _add_file_lines(self, stack: list[tuple[str, int, str, str]]) -> None: ...
|
||||
def entry_count(self) -> int: ...
|
||||
def format_path(self, path: str) -> str: ...
|
||||
def json(self) -> str: ...
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
from codecs import StreamReader, StreamWriter
|
||||
from csv import Dialect
|
||||
from typing import BinaryIO, Iterable, Iterator, Protocol
|
||||
|
||||
class _StreamReader(Protocol):
|
||||
def __call__(self, stream: BinaryIO, errors: str = ...) -> StreamReader: ...
|
||||
|
||||
class _StreamWriter(Protocol):
|
||||
def __call__(self, stream: BinaryIO, errors: str = ...) -> StreamWriter: ...
|
||||
from typing import BinaryIO, Iterable, Iterator
|
||||
|
||||
class _CsvReader(Iterator[list[str]]):
|
||||
dialect: Dialect
|
||||
@@ -18,9 +11,6 @@ class _CsvWriter:
|
||||
def writerow(self, row: Iterable): ...
|
||||
def writerows(self, rows: Iterable[Iterable]) -> None: ...
|
||||
|
||||
_reader: _StreamReader
|
||||
_writer: _StreamWriter
|
||||
|
||||
def csv_reader(stream: BinaryIO, **params) -> _CsvReader: ...
|
||||
def csv_writer(stream: BinaryIO, **params) -> _CsvWriter: ...
|
||||
def to_text(source) -> str: ...
|
||||
|
||||
@@ -5,19 +5,10 @@ from ..sql_db import Cursor
|
||||
|
||||
IDENT_RE: Pattern
|
||||
|
||||
def _from_table(table: str, alias: str) -> str: ...
|
||||
def _generate_table_alias(src_table_alias: str, link: str) -> str: ...
|
||||
|
||||
class Query:
|
||||
_cr: Cursor
|
||||
_tables: dict[str, str]
|
||||
_joins: dict[str, tuple]
|
||||
_where_clauses: list[str]
|
||||
_where_params: list
|
||||
order: str | None
|
||||
limit: int | None
|
||||
offset: int | None
|
||||
_ids: tuple[int, ...] | None
|
||||
def __init__(self, cr: Cursor, alias: str, table: str | None = ...) -> None: ...
|
||||
def add_table(self, alias: str, table: str | None = ...) -> None: ...
|
||||
def add_where(self, where_clause: str, where_params: Iterable = ...) -> None: ...
|
||||
@@ -41,24 +32,12 @@ class Query:
|
||||
extra: str | None = ...,
|
||||
extra_params: tuple = ...,
|
||||
) -> str: ...
|
||||
def _join(
|
||||
self,
|
||||
kind: str,
|
||||
lhs_alias: str,
|
||||
lhs_column: str,
|
||||
rhs_table: str,
|
||||
rhs_column: str,
|
||||
link: str,
|
||||
extra: str | None = ...,
|
||||
extra_params: tuple = ...,
|
||||
) -> str: ...
|
||||
def select(self, *args) -> tuple[str, list]: ...
|
||||
def subselect(self, *args) -> tuple[str, list]: ...
|
||||
def is_empty(self) -> bool: ...
|
||||
def get_sql(self) -> tuple[str, str, list]: ...
|
||||
def get_result_ids(self) -> tuple[int, ...]: ...
|
||||
def set_result_ids(self, ids, ordered: bool = ...) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[int]: ...
|
||||
|
||||
@@ -1,22 +1,13 @@
|
||||
from types import CodeType
|
||||
from typing import Any, Iterable, Iterator, Literal
|
||||
from typing import Iterable, Iterator, Literal
|
||||
|
||||
from opcode import HAVE_ARGUMENT as HAVE_ARGUMENT
|
||||
|
||||
unsafe_eval = eval
|
||||
_ALLOWED_MODULES: list[str]
|
||||
_UNSAFE_ATTRIBUTES: list[str]
|
||||
|
||||
def to_opcodes(
|
||||
opnames: Iterable[str], _opmap: dict[str, int] = ...
|
||||
) -> Iterator[int]: ...
|
||||
|
||||
_BLACKLIST: set[int]
|
||||
_CONST_OPCODES: set[int]
|
||||
_operations: list[str]
|
||||
_EXPR_OPCODES: set[int]
|
||||
_SAFE_OPCODES: set[int]
|
||||
|
||||
def assert_no_dunder_name(code_obj: CodeType, expr: str) -> None: ...
|
||||
def assert_valid_codeobj(
|
||||
allowed_codes: set[int], code_obj: CodeType, expr: str
|
||||
@@ -26,16 +17,6 @@ def test_expr(
|
||||
): ...
|
||||
def const_eval(expr: str): ...
|
||||
def expr_eval(expr: str): ...
|
||||
def _import(
|
||||
name: str,
|
||||
globals: dict | None = ...,
|
||||
locals: dict | None = ...,
|
||||
fromlist: list | None = ...,
|
||||
level: int = ...,
|
||||
): ...
|
||||
|
||||
_BUILTINS: dict[str, Any]
|
||||
|
||||
def safe_eval(
|
||||
expr: str,
|
||||
globals_dict: dict | None = ...,
|
||||
@@ -49,10 +30,7 @@ def test_python_expr(expr: str, mode: str = ...) -> str | Literal[False]: ...
|
||||
def check_values(d: dict): ...
|
||||
|
||||
class wrap_module:
|
||||
_repr: str
|
||||
def __init__(self, module, attributes) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __getattr__(self, item): ...
|
||||
|
||||
mods: list[str]
|
||||
datetime: wrap_module
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
from typing import Any
|
||||
|
||||
class SourceMapGenerator:
|
||||
_file: None
|
||||
_source_root: str | None
|
||||
_sources: dict[str, int]
|
||||
_mappings: list[dict[str, Any]]
|
||||
_sources_contents: dict[str, str]
|
||||
_version: int
|
||||
_cache: dict[tuple[int, int], str]
|
||||
def __init__(self, source_root: str | None = ...) -> None: ...
|
||||
def _serialize_mappings(self) -> str: ...
|
||||
def to_json(self) -> dict: ...
|
||||
def get_content(self) -> bytes: ...
|
||||
def add_source(
|
||||
|
||||
@@ -5,8 +5,6 @@ from typing import Iterable, Literal
|
||||
from ..models import BaseModel
|
||||
from ..sql_db import Cursor
|
||||
|
||||
_CONFDELTYPES: dict[str, str]
|
||||
|
||||
def existing_tables(cr: Cursor, tablenames: Iterable[str]) -> list[str]: ...
|
||||
def table_exists(cr: Cursor, tablename: str) -> bool: ...
|
||||
|
||||
@@ -43,9 +41,6 @@ def convert_column(
|
||||
def convert_column_translatable(
|
||||
cr: Cursor, tablename: str, columnname: str, columntype: str
|
||||
) -> None: ...
|
||||
def _convert_column(
|
||||
cr: Cursor, tablename: str, columnname: str, columntype: str, using: str
|
||||
) -> None: ...
|
||||
def drop_depending_views(cr: Cursor, table: str, column: str) -> None: ...
|
||||
def get_depending_views(cr: Cursor, table: str, column: str): ...
|
||||
def set_not_null(cr: Cursor, tablename: str, columnname: str) -> None: ...
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
import csv
|
||||
from collections import defaultdict, namedtuple
|
||||
from re import Match, Pattern
|
||||
from re import Pattern
|
||||
from tarfile import TarFile
|
||||
from types import FrameType
|
||||
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, NoReturn
|
||||
|
||||
from lxml.etree import HTMLParser, _Element
|
||||
from lxml.etree import _Element
|
||||
from polib import POFile
|
||||
|
||||
from ..api import Environment
|
||||
from ..fields import Field
|
||||
from ..models import BaseModel
|
||||
from ..sql_db import Connection, Cursor
|
||||
from ..sql_db import Cursor
|
||||
from .pycompat import _CsvWriter
|
||||
|
||||
PYTHON_TRANSLATION_COMMENT: str
|
||||
JAVASCRIPT_TRANSLATION_COMMENT: str
|
||||
WEB_TRANSLATION_COMMENT: str
|
||||
SKIPPED_ELEMENTS: tuple[str, ...]
|
||||
_LOCALE2WIN32: dict[str, str]
|
||||
|
||||
class UNIX_LINE_TERMINATOR(csv.excel):
|
||||
lineterminator: str
|
||||
@@ -40,9 +36,6 @@ def translate_xml_node(
|
||||
) -> _Element: ...
|
||||
def parse_xml(text: str) -> _Element: ...
|
||||
def serialize_xml(node: _Element) -> str: ...
|
||||
|
||||
_HTML_PARSER: HTMLParser
|
||||
|
||||
def parse_html(text: str) -> _Element: ...
|
||||
def serialize_html(node: _Element) -> str: ...
|
||||
def xml_translate(callback: Callable[[str], str | None], value: str) -> str: ...
|
||||
@@ -53,21 +46,10 @@ def get_text_content(term: str) -> str: ...
|
||||
def translate_sql_constraint(cr: Cursor, key: str, lang: str) -> str: ...
|
||||
|
||||
class GettextAlias:
|
||||
def _get_db(self) -> Connection | None: ...
|
||||
def _get_cr(
|
||||
self, frame: FrameType, allow_create: bool = ...
|
||||
) -> tuple[Cursor, bool]: ...
|
||||
def _get_uid(self, frame: FrameType) -> int: ...
|
||||
def _get_lang(self, frame: FrameType) -> str: ...
|
||||
def __call__(self, source: str, *args, **kwargs) -> str: ...
|
||||
def _get_translation(self, source: str, module: str | None = ...) -> str: ...
|
||||
|
||||
class _lt:
|
||||
_source: str
|
||||
_args: tuple
|
||||
_module: str
|
||||
def __init__(self, source: str, *args, **kwargs) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __eq__(self, other) -> NoReturn: ...
|
||||
def __lt__(self, other) -> NoReturn: ...
|
||||
def __add__(self, other: str | _lt) -> str: ...
|
||||
@@ -80,7 +62,6 @@ def quote(s: str) -> str: ...
|
||||
re_escaped_char: Pattern
|
||||
re_escaped_replacements: dict[str, str]
|
||||
|
||||
def _sub_replacement(match_obj: Match) -> str: ...
|
||||
def unquote(str: str) -> str: ...
|
||||
def TranslationFileReader(
|
||||
source: IO, fileformat: str = ...
|
||||
@@ -125,10 +106,6 @@ class TarFileWriter:
|
||||
def trans_export(
|
||||
lang: str, modules: list[str], buffer, format: str, cr: Cursor
|
||||
) -> None: ...
|
||||
def _push(callback: Callable[[str, int], Any], term: str, source_line: int) -> None: ...
|
||||
def _extract_translatable_qweb_terms(
|
||||
element: _Element, callback: Callable[[str, int], Any]
|
||||
) -> None: ...
|
||||
def babel_extract_qweb(fileobj: IO, keywords, comment_tags, options) -> list[tuple]: ...
|
||||
def extract_formula_terms(formula: str) -> Iterator[str]: ...
|
||||
def extract_spreadsheet_terms(
|
||||
@@ -138,47 +115,11 @@ def extract_spreadsheet_terms(
|
||||
ImdInfo = namedtuple("ExternalId", ["name", "model", "res_id", "module"])
|
||||
|
||||
class TranslationModuleReader:
|
||||
_cr: Cursor
|
||||
_modules: list[str]
|
||||
_lang: str | None
|
||||
env: Environment
|
||||
_to_translate: list[tuple]
|
||||
_path_list: list[tuple[str, Any]]
|
||||
_installed_modules: list[str]
|
||||
def __init__(
|
||||
self, cr: Cursor, modules: list[str] | None = ..., lang: str | None = ...
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterable[tuple]: ...
|
||||
def _push_translation(
|
||||
self,
|
||||
module: str,
|
||||
ttype: str,
|
||||
name: str,
|
||||
res_id: str,
|
||||
source: str,
|
||||
comments: Iterable[str] | None = ...,
|
||||
record_id: int | None = ...,
|
||||
value: Any | None = ...,
|
||||
) -> None: ...
|
||||
def _get_translatable_records(
|
||||
self, imd_records: Iterable[ImdInfo]
|
||||
) -> BaseModel: ...
|
||||
def _export_translatable_records(self) -> None: ...
|
||||
def _get_module_from_path(self, path: str) -> str: ...
|
||||
def _verified_module_filepaths(
|
||||
self, fname: str, path: str, root: str
|
||||
) -> tuple[str | None, str | None, str | None, str | None]: ...
|
||||
def _babel_extract_terms(
|
||||
self,
|
||||
fname: str,
|
||||
path: str,
|
||||
root: str,
|
||||
extract_method: str = ...,
|
||||
trans_type: str = ...,
|
||||
extra_comments: list[str] | None = ...,
|
||||
extract_keywords: dict = ...,
|
||||
) -> None: ...
|
||||
def _export_translatable_resources(self) -> None: ...
|
||||
|
||||
def DeepDefaultDict() -> defaultdict: ...
|
||||
|
||||
@@ -203,7 +144,6 @@ class TranslationImporter:
|
||||
lang: str,
|
||||
xmlids: Iterable[str] | None = ...,
|
||||
) -> None: ...
|
||||
def _load(self, reader, lang: str, xmlids: Iterable[str] | None = ...) -> None: ...
|
||||
def save(self, overwrite: bool = ..., force_overwrite: bool = ...) -> None: ...
|
||||
|
||||
def trans_load(
|
||||
@@ -225,19 +165,7 @@ class CodeTranslations:
|
||||
python_translations: dict[tuple[str, str], dict]
|
||||
web_translations: dict[tuple[str, str], dict]
|
||||
def __init__(self) -> None: ...
|
||||
@staticmethod
|
||||
def _get_po_paths(mod: str, lang: str) -> list[str]: ...
|
||||
@staticmethod
|
||||
def _read_code_translations_file(fileobj: IO, filter_func: Callable) -> dict: ...
|
||||
@staticmethod
|
||||
def _get_code_translations(
|
||||
module_name: str, lang: str, filter_func: Callable
|
||||
) -> dict: ...
|
||||
def _load_python_translations(self, module_name: str, lang: str): ...
|
||||
def _load_web_translations(self, module_name: str, lang: str): ...
|
||||
def get_python_translations(self, module_name: str, lang: str) -> dict: ...
|
||||
def get_web_translations(self, module_name: str, lang: str) -> dict: ...
|
||||
|
||||
code_translations: CodeTranslations
|
||||
|
||||
def _get_translation_upgrade_queries(cr: Cursor, field: Field) -> tuple[list, list]: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from ast import expr as _expr
|
||||
from collections import defaultdict
|
||||
from re import Pattern
|
||||
from typing import Callable, TypeVar
|
||||
|
||||
@@ -7,14 +6,10 @@ from lxml.etree import RelaxNG, _Element
|
||||
|
||||
_CallableT = TypeVar("_CallableT", bound=Callable)
|
||||
|
||||
_validators: defaultdict[str, list[Callable]]
|
||||
_relaxng_cache: dict[str, RelaxNG | None]
|
||||
READONLY: Pattern
|
||||
|
||||
def _get_attrs_symbols() -> set[str]: ...
|
||||
def get_variable_names(expr: str | _expr) -> set[str]: ...
|
||||
def get_dict_asts(expr: str | _expr) -> dict: ...
|
||||
def _check(condition: bool, explanation: str) -> None: ...
|
||||
def get_domain_identifiers(expr: str | _expr) -> tuple[set[str], set[str]]: ...
|
||||
def valid_view(arch: _Element, **kwargs) -> bool: ...
|
||||
def validate(*view_types: str) -> Callable[[_CallableT], _CallableT]: ...
|
||||
|
||||
@@ -3,7 +3,6 @@ from os import W_OK as W_OK
|
||||
from os.path import dirname as dirname
|
||||
from typing import Iterator
|
||||
|
||||
__docformat__: str
|
||||
ENOENT: int
|
||||
windows: bool
|
||||
seen: set
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from typing import IO, Callable, Iterable, Literal
|
||||
from typing import IO, Callable, Iterable, Literal, Union
|
||||
|
||||
from lxml import etree
|
||||
from lxml.etree import _Element
|
||||
from odoo.addons.base.models.ir_attachment import IrAttachment
|
||||
|
||||
from ..api import Environment
|
||||
|
||||
@@ -11,12 +12,6 @@ class odoo_resolver(etree.Resolver):
|
||||
def __init__(self, env: Environment, prefix: str | None) -> None: ...
|
||||
def resolve(self, url: str, id: str, context) -> str: ...
|
||||
|
||||
def _check_with_xsd(
|
||||
tree_or_str: str | _Element,
|
||||
stream: str | IO,
|
||||
env: Environment | None = ...,
|
||||
prefix: str | None = ...,
|
||||
) -> None: ...
|
||||
def create_xml_node_chain(
|
||||
first_parent_node: _Element,
|
||||
nodes_list: Iterable[str],
|
||||
@@ -41,7 +36,7 @@ def load_xsd_files_from_url(
|
||||
xsd_name_prefix: str = ...,
|
||||
xsd_names_filter: str | list[str] | None = ...,
|
||||
modify_xsd_content: Callable[[bytes], bytes] | None = ...,
|
||||
) -> "odoo.model.ir_attachment | Literal[False]": ...
|
||||
) -> "Union[IrAttachment, Literal[False]]": ...
|
||||
def validate_xml_from_attachment(
|
||||
env: Environment,
|
||||
xml_content,
|
||||
|
||||
Reference in New Issue
Block a user