This commit is contained in:
Trinh Anh Ngoc
2024-10-27 23:28:09 +07:00
parent 28277a4182
commit 96a37a4a79
82 changed files with 1 additions and 5289 deletions

View File

@@ -1,41 +1,4 @@
# Odoo Stubs # Odoo Stubs
> A stub file is a file containing a skeleton of the public interface of that Python module, These stubs are no longer needed for Odoo >= 19. Please checkout other branches for Odoo <= 18.
> including classes, variables, functions and most importantly, their types.
>
> https://mypy.readthedocs.io/en/stable/stubs.html
By using these stubs, IDEs will provide better code completion,
and static type checkers will provide better reports.
## Usage
If you are using the [PyCharm plugin for Odoo](https://plugins.jetbrains.com/plugin/13499-odoo) or
the [VSCode extension for Odoo](https://marketplace.visualstudio.com/items?itemName=trinhanhngoc.vscode-odoo),
then you don't need to setup Odoo Stubs manually as they already have built-in Odoo Stubs.
If not, you can follow these instructions for manually setup.
### 1. Clone the branch corresponding to the Odoo version
Example, for Odoo 16:
```
git clone -b 16.0 https://github.com/odoo-ide/odoo-stubs.git odoo-stubs16
```
### 2. Configure IDEs
#### PyCharm
First make sure you have attached the [Odoo source code](https://github.com/odoo/odoo)
to your project.
Then open `Settings > Project > Project Structure`,
select the project containing the Odoo source code and click `Add Content Root` to add the odoo-stubs folder.
![PyCharm](images/pycharm.png)
#### Visual Studio Code
Add the odoo-stubs folder to the `stubPath` or `extraPaths` settings as described in the
[import resolution documentation](https://microsoft.github.io/pyright/#/import-resolution).
![VSCode](images/vscode.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 KiB

View File

@@ -1,26 +0,0 @@
from codecs import CodecInfo
from re import Pattern
from . import addons as addons
from . import api as api
from . import conf as conf
from . import fields as fields
from . import http as http
from . import loglevels as loglevels
from . import models as models
from . import netsvc as netsvc
from . import osv as osv
from . import release as release
from . import service as service
from . import sql_db as sql_db
from . import tools as tools
from .api import Registry
from .fields import Command as Command
from .tools.translate import _ as _
from .tools.translate import _lt as _lt
MIN_PY_VERSION: tuple[int, ...]
MAX_PY_VERSION: tuple[int, ...]
SUPERUSER_ID: int
def registry(database_name: str | None = ...) -> Registry: ...

View File

@@ -1,209 +0,0 @@
from collections import defaultdict
from typing import (
Any,
Callable,
Collection,
Generator,
Iterable,
Iterator,
KeysView,
Mapping,
Optional,
Sequence,
TypeVar,
)
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 SQL, StackMap, frozendict
from .tools.translate import LazyGettext
_T = TypeVar("_T")
_ModelT = TypeVar("_ModelT", bound=BaseModel)
_CallableT = TypeVar("_CallableT", bound=Callable)
class NewId:
origin: int | None
ref: Any
def __init__(self, origin: int | None = ..., ref: Any | None = ...) -> None: ...
def __bool__(self) -> bool: ...
def __eq__(self, other) -> bool: ...
def __hash__(self) -> int: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
class Params:
args: tuple
kwargs: dict
def __init__(self, args: tuple, kwargs: dict) -> None: ...
class Meta(type):
def __new__(meta, name: str, bases: tuple, attrs: dict): ...
def attrsetter(attr, value) -> Callable[[_T], _T]: ...
def propagate(method1: Callable, method2: _CallableT) -> _CallableT: ...
def constrains(
*args: str | Callable[[_ModelT], Sequence[str]]
) -> Callable[[_T], _T]: ...
def ondelete(*, at_uninstall: bool) -> Callable[[_T], _T]: ...
def onchange(*args: str) -> Callable[[_T], _T]: ...
def depends(*args: str | Callable[[_ModelT], Sequence[str]]) -> Callable[[_T], _T]: ...
def depends_context(*args: str) -> Callable[[_T], _T]: ...
def returns(
model: str | None, downgrade: Callable | None = ..., upgrade: Callable | None = ...
) -> Callable[[_T], _T]: ...
def downgrade(method: Callable, value, self, args, kwargs): ...
def autovacuum(method: _CallableT) -> _CallableT: ...
def model(method: _CallableT) -> _CallableT: ...
def model_create_single(method: _CallableT) -> _CallableT: ...
def model_create_multi(method: _CallableT) -> _CallableT: ...
def call_kw(model: BaseModel, name: str, args, kwargs): ...
class Environment(Mapping[str, BaseModel]):
cr: Cursor = ...
uid: int = ...
context: dict[str, Any] = ...
su: bool = ...
def reset(self) -> None: ...
uid_origin: int | None
transaction: Transaction
registry: Registry
cache: Cache
def __new__(
cls,
cr: Cursor,
uid: int | None,
context: dict,
su: bool = ...,
uid_origin: int | None = ...,
) -> Environment: ...
def __contains__(self, model_name) -> bool: ...
def __getitem__(self, model_name: str) -> BaseModel: ...
def __iter__(self) -> Iterator[str]: ...
def __len__(self) -> int: ...
def __eq__(self, other) -> bool: ...
def __ne__(self, other) -> bool: ...
def __hash__(self) -> int: ...
def __call__(
self,
cr: Cursor | None = ...,
user: Users | int | None = ...,
context: dict | None = ...,
su: bool | None = ...,
) -> Environment: ...
def ref(
self, xml_id: str, raise_if_not_found: bool = ...
) -> Optional[BaseModel]: ...
def is_superuser(self) -> bool: ...
def is_admin(self) -> bool: ...
def is_system(self) -> bool: ...
@property
def user(self) -> Users: ...
@property
def company(self) -> Company: ...
@property
def companies(self) -> Company: ...
@property
def lang(self) -> str: ...
def _(self, source: str | LazyGettext, *args, **kwargs) -> str: ...
def clear(self) -> None: ...
def invalidate_all(self, flush: bool = ...) -> None: ...
def flush_all(self) -> None: ...
def is_protected(self, field: Field, record: BaseModel) -> bool: ...
def protected(self, field: Field) -> BaseModel: ...
def protecting(
self, what, records: Optional[BaseModel] = ...
) -> Generator[None, None, None]: ...
def fields_to_compute(self) -> KeysView[Field]: ...
def records_to_compute(self, field: Field) -> BaseModel: ...
def is_to_compute(self, field: Field, record: BaseModel) -> bool: ...
def not_to_compute(self, field: Field, records: _ModelT) -> _ModelT: ...
def add_to_compute(self, field: Field, records: BaseModel): ...
def remove_to_compute(self, field: Field, records: BaseModel) -> None: ...
def cache_key(self, field: Field): ...
def flush_query(self, query: SQL): ...
def execute_query(self, query: SQL) -> list[tuple]: ...
def execute_query_dict(self, query: SQL) -> list[dict]: ...
class Transaction:
registry: Registry
envs: WeakSet[Environment]
cache: Cache
protected: StackMap[Field, set[int]]
tocompute: defaultdict[Field, set[int]]
def __init__(self, registry: Registry) -> None: ...
def flush(self) -> None: ...
def clear(self) -> None: ...
def reset(self) -> None: ...
NOTHING: object
EMPTY_DICT: frozendict
class Cache:
def __init__(self) -> None: ...
def contains(self, record: BaseModel, field: Field) -> bool: ...
def contains_field(self, field: Field) -> bool: ...
def get(self, record: BaseModel, field: Field, default=...): ...
def set(
self,
record: BaseModel,
field: Field,
value,
dirty: bool = ...,
check_dirty: bool = ...,
) -> None: ...
def update(
self,
records: BaseModel,
field: Field,
values,
dirty: bool = ...,
check_dirty: bool = ...,
) -> None: ...
def update_raw(
self,
records: BaseModel,
field: Field,
values,
dirty: bool = ...,
check_dirty: bool = ...,
) -> None: ...
def insert_missing(self, records: BaseModel, field: Field, values) -> None: ...
def patch(self, records: BaseModel, field: Field, new_id) -> None: ...
def patch_and_set(self, record: BaseModel, field: Field, value): ...
def remove(self, record: BaseModel, field: Field) -> None: ...
def get_values(self, records: BaseModel, field: Field) -> Iterator: ...
def get_until_miss(self, records: BaseModel, field: Field) -> list: ...
def get_records_different_from(
self, records: _ModelT, field: Field, value
) -> _ModelT: ...
def get_fields(self, record: BaseModel) -> Iterator[Field]: ...
def get_records(
self, model: _ModelT, field: Field, all_contexts: bool = ...
) -> _ModelT: ...
def get_missing_ids(self, records: BaseModel, field: Field) -> Iterator[int]: ...
def get_dirty_fields(self) -> "set[Field]": ...
def get_dirty_records(self, model: _ModelT, field: Field) -> _ModelT: ...
def has_dirty_fields(
self, records: BaseModel, fields: Iterable[Field] | None = ...
) -> bool: ...
def clear_dirty_field(self, field: Field) -> Collection[int]: ...
def invalidate(
self, spec: list[tuple[Field, Iterable | None]] | None = ...
) -> None: ...
def clear(self) -> None: ...
def check(self, env: Environment) -> None: ...
class GroupedCompanyDependentFieldCache:
def __init__(self, company_field_cache) -> None: ...
def __getitem__(self, id_): ...
class Starred:
value: Any
def __init__(self, value) -> None: ...

View File

@@ -1,2 +0,0 @@
addons_paths: list[str]
server_wide_modules: list[str]

View File

@@ -1,26 +0,0 @@
from .fields import Field
from .models import BaseModel
class UserError(Exception):
def __init__(self, message: str) -> None: ...
class RedirectWarning(Exception):
def __init__(
self,
message: str,
action: int,
button_text: str,
additional_context: dict | None = ...,
) -> None: ...
class AccessDenied(UserError):
traceback: tuple[str, str, str]
def __init__(self, message: str = ...) -> None: ...
class AccessError(UserError): ...
class CacheMiss(KeyError):
def __init__(self, record: BaseModel, field: Field) -> None: ...
class MissingError(UserError): ...
class ValidationError(UserError): ...

View File

@@ -1,572 +0,0 @@
import datetime
import enum
from typing import (
Any,
Callable,
Container,
Generic,
Iterator,
Sequence,
Type,
TypeVar,
Union,
overload,
)
import psycopg2
from markupsafe import Markup
from . import SUPERUSER_ID as SUPERUSER_ID
from .api import Environment
from .models import BaseModel
from .modules.registry import Registry
from .tools import date_utils, float_utils
_FieldT = TypeVar("_FieldT", bound=Field)
_FieldValueT = TypeVar("_FieldValueT")
_ModelT = TypeVar("_ModelT", bound=BaseModel)
_SeqIntT = TypeVar("_SeqIntT", bound=Sequence[int])
DATE_LENGTH: int
DATETIME_LENGTH: int
NO_ACCESS: str
IR_MODELS: tuple[str, ...]
COMPANY_DEPENDENT_FIELDS: tuple[str, ...]
NoneType: type[None]
Default: object
def first(records: _ModelT) -> _ModelT: ...
def resolve_mro(model: BaseModel, name: str, predicate: Callable[..., bool]): ...
def determine(needle: str | Callable, records: BaseModel, *args): ...
class MetaField(type):
by_type: dict
def __init__(cls: type[Field], name, bases, attrs) -> None: ...
class Field(Generic[_FieldValueT], metaclass=MetaField):
type: str
relational: bool
translate: bool
write_sequence: int
args: dict[str, Any] | None
automatic: bool
inherited: bool
inherited_field: Field | None
name: str
model_name: str | None
comodel_name: str | None
store: bool
index: str | bool | None
manual: bool
copy: bool
recursive: bool
compute: str | Callable | None
compute_sudo: bool
precompute: bool
inverse: str | Callable | None
search: str | Callable | None
related: str | None
company_dependent: bool
default: Any
string: str | None
export_string_translation: bool
help: str | None
readonly: bool
required: bool
groups: str | None
change_default: bool
related_field: Field | None
aggregator: str | None
group_expand: str | None
prefetch: bool
default_export_compatible: bool
exportable: bool
related_attrs: list[tuple[str, str]]
description_attrs: list[tuple[str, str]]
def __init__(self, string: str = ..., **kwargs) -> None: ...
def __set_name__(self, owner: Type[BaseModel], name: str) -> None: ...
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]: ...
@property
def column_type(self) -> tuple[str, str] | None: ...
@property
def base_field(self) -> Field: ...
def get_company_dependent_fallback(self, records: BaseModel): ...
def resolve_depends(self, registry: Registry) -> Iterator[tuple]: ...
def get_description(
self, env: Environment, attributes: Container[str] | None = ...
) -> dict[str, Any]: ...
def is_editable(self) -> bool: ...
def is_accessible(self, env: Environment) -> bool: ...
def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...
def convert_to_column_insert(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...
def convert_to_column_update(self, value, record: BaseModel): ...
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): ...
def convert_to_read(
self, value, record: BaseModel, use_display_name: bool = ...
): ...
def convert_to_write(self, value, record: BaseModel): ...
def convert_to_onchange(self, value, record: BaseModel, names): ...
def convert_to_export(self, value, record: BaseModel): ...
def convert_to_display_name(self, value, record: BaseModel): ...
@property
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 update_db_notnull(self, model: BaseModel, column: dict | None) -> None: ...
def update_db_related(self, model: BaseModel) -> None: ...
def read(self, records: BaseModel) -> None: ...
def create(self, record_values: list[tuple[BaseModel, Any]]) -> None: ...
def write(self, records: _ModelT, value) -> None: ...
@overload
def __get__(self, record: BaseModel, owner: Any | None = ...) -> _FieldValueT: ...
@overload
def __get__(self: _FieldT, records: None, owner: Any | None = ...) -> _FieldT: ...
def mapped(self, records: BaseModel): ...
def __set__(self, records: BaseModel, value): ...
def recompute(self, records: BaseModel) -> None: ...
def compute_value(self, records: BaseModel) -> None: ...
def determine_inverse(self, records: BaseModel) -> None: ...
def determine_domain(self, records: BaseModel, operator: str, value) -> list: ...
class Boolean(Field[bool]):
type: str
def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> bool: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> bool: ...
def convert_to_export(self, value, record: BaseModel): ...
class Integer(Field[int]):
type: str
aggregator: str
def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> int: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> int | None: ...
def convert_to_record(self, value, record: BaseModel): ...
def convert_to_read(
self, value, record: BaseModel, use_display_name: bool = ...
): ...
def convert_to_export(self, value, record): ...
class Float(Field[float]):
type: str
aggregator: str
def __init__(
self, string: str = ..., digits: tuple[int, int] | str | None = ..., **kwargs
) -> None: ...
def get_digits(self, env: Environment) -> tuple[int, int]: ...
def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> float: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> float: ...
def convert_to_record(self, value, record: BaseModel): ...
def convert_to_export(self, value, record: BaseModel): ...
round = float_utils.float_round
is_zero = float_utils.float_is_zero
compare = float_utils.float_compare
class Monetary(Field[float]):
type: str
write_sequence: int
currency_field: str | None
aggregator: str
def __init__(
self, string: str = ..., currency_field: str = ..., **kwargs
) -> None: ...
def get_currency_field(self, model: BaseModel) -> str: ...
def setup_nonrelated(self, model: BaseModel) -> None: ...
def setup_related(self, model: BaseModel) -> None: ...
def convert_to_column_insert(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> float: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> float: ...
def convert_to_record(self, value, record: BaseModel): ...
def convert_to_read(
self, value, record: BaseModel, use_display_name: bool = ...
): ...
def convert_to_write(self, value, record: BaseModel): ...
def convert_to_export(self, value, record: BaseModel): ...
class _String(Field[str]):
translate: Callable | bool
size: int | None
def __init__(self, string: str = ..., **kwargs) -> 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_to_column_insert(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...
def convert_to_column_update(self, value, record: BaseModel): ...
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_translation_fallback_langs(self, env: Environment) -> tuple[str, ...]: ...
def write(self, records: _ModelT, value) -> None: ...
class Char(_String):
type: str
trim: bool
def update_db_column(self, model: BaseModel, column: dict | None) -> None: ...
def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> str | None: ...
class Text(_String):
type: str
class Html(_String):
type: str
sanitize: bool
sanitize_overridable: bool
sanitize_tags: bool
sanitize_attributes: bool
sanitize_style: bool
sanitize_form: bool
strip_style: bool
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_to_record(self, value, record: BaseModel) -> Markup | None: ...
def convert_to_read(
self, value, record: BaseModel, use_display_name: bool = ...
) -> Markup | None: ...
def get_trans_terms(self, value) -> list: ...
class Date(Field[datetime.date]):
type: str
start_of = date_utils.start_of
end_of = date_utils.end_of
add = date_utils.add
subtract = date_utils.subtract
@staticmethod
def today(*args) -> datetime.date: ...
@staticmethod
def context_today(
record: BaseModel, timestamp: datetime.datetime | None = ...
) -> datetime.date: ...
@staticmethod
def to_date(value) -> datetime.date | None: ...
from_string = to_date
@staticmethod
def to_string(value: datetime.datetime | datetime.date) -> str: ...
def convert_to_column_update(self, value, record: BaseModel): ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> datetime.date | None: ...
def convert_to_export(self, value, record: BaseModel): ...
def convert_to_display_name(self, value, record: BaseModel) -> str: ...
class Datetime(Field[datetime.datetime]):
type: str
start_of = date_utils.start_of
end_of = date_utils.end_of
add = date_utils.add
subtract = date_utils.subtract
@staticmethod
def now(*args) -> datetime.datetime: ...
@staticmethod
def today(*args) -> datetime.datetime: ...
@staticmethod
def context_timestamp(
record: BaseModel, timestamp: datetime.datetime
) -> datetime.datetime: ...
@staticmethod
def to_datetime(value) -> datetime.datetime | None: ...
from_string = to_datetime
@staticmethod
def to_string(value: datetime.datetime | datetime.date) -> str: ...
def convert_to_column_update(self, value, record: BaseModel): ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> datetime.datetime | None: ...
def convert_to_export(self, value, record: BaseModel): ...
def convert_to_display_name(self, value, record: BaseModel) -> str: ...
class Binary(Field[bytes]):
type: str
prefetch: bool
attachment: bool
@property
def column_type(self) -> tuple[str, str] | None: ...
def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> psycopg2.Binary | None: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> bytes | None: ...
def convert_to_record(self, value, record: BaseModel) -> bytes: ...
def compute_value(self, records: BaseModel) -> None: ...
def read(self, records: BaseModel) -> None: ...
def create(self, record_values: list[tuple[BaseModel, Any]]) -> None: ...
def write(self, records: _ModelT, value) -> None: ...
class Image(Binary):
max_width: int
max_height: int
verify_resolution: bool
def setup(self, model: BaseModel) -> None: ...
def create(self, record_values: list[tuple[BaseModel, Any]]) -> None: ...
def write(self, records: BaseModel, value) -> None: ...
class Selection(Field[str]):
type: str
selection: list | Callable | str
validate: bool
ondelete: dict[str, Any] | None
def __init__(
self, selection: list | Callable | str = ..., string: str = ..., **kwargs
) -> None: ...
def setup_nonrelated(self, model: BaseModel) -> None: ...
def setup_related(self, model: BaseModel): ...
def _description_selection(self, env: Environment) -> list[tuple[str, str]]: ...
def get_values(self, env: Environment) -> list[str]: ...
def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
def convert_to_export(self, value, record: BaseModel): ...
class Reference(Selection):
type: str
def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
) -> str | None: ...
def convert_to_cache(
self, value, record: BaseModel, validate: bool = ...
) -> str | None: ...
def convert_to_record(self, value, record: BaseModel) -> Union[BaseModel, None]: ...
def convert_to_read(
self, value, record: BaseModel, use_display_name: bool = ...
) -> str | bool: ...
def convert_to_export(self, value, record: BaseModel) -> str: ...
def convert_to_display_name(self, value, record: BaseModel) -> str: ...
class _Relational(Field[BaseModel]):
relational: bool
domain: list | Callable
context: dict
check_company: bool
comodel_name: str
def setup_nonrelated(self, model: BaseModel) -> None: ...
def get_domain_list(self, model: BaseModel) -> list: ...
class Many2one(_Relational):
type: str
ondelete: str | None
auto_join: bool
delegate: bool
def __init__(
self, comodel_name: str = ..., string: str = ..., **kwargs
) -> 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 convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...
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): ...
def convert_to_read(
self, value, record: BaseModel, use_display_name: bool = ...
): ...
def convert_to_write(self, value, record: BaseModel): ...
def convert_to_export(self, value, record: BaseModel) -> str: ...
def convert_to_display_name(self, value, record: BaseModel) -> str: ...
def write(self, records: _ModelT, value) -> None: ...
class Many2oneReference(Integer):
type: str
model_field: str | None
aggregator: str | None
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
class Json(Field):
type: str
def convert_to_record(self, value, record: BaseModel): ...
def convert_to_cache(self, value, record: BaseModel, validate: bool = ...): ...
def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...
def convert_to_export(self, value, record: BaseModel): ...
class Properties(Field):
type: str
copy: bool
prefetch: bool
write_sequence: int
store: bool
readonly: bool
precompute: bool
definition: str | None
definition_record: str | None
definition_record_field: str | None
ALLOWED_TYPES: tuple[str, ...]
compute: Callable
def setup_related(self, model: BaseModel) -> None: ...
def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...
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_display_name: bool = ...
): ...
def convert_to_read_multi(self, values, records: BaseModel): ...
def convert_to_write(self, value, record: BaseModel): ...
def write(self, records: _ModelT, value) -> None: ...
class PropertiesDefinition(Field):
type: str
copy: bool
readonly: bool
prefetch: bool
REQUIRED_KEYS: tuple[str, ...]
ALLOWED_KEYS: tuple[str, ...]
PROPERTY_PARAMETERS_MAP: dict[str, set[str]]
def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ...
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_display_name: bool = ...
): ...
class Command(enum.IntEnum):
CREATE: int
UPDATE: int
DELETE: int
UNLINK: int
LINK: int
CLEAR: int
SET: int
@classmethod
def create(cls, values: dict) -> tuple[int, int, dict]: ...
@classmethod
def update(cls, id: int, values: dict) -> tuple[int, int, dict]: ...
@classmethod
def delete(cls, id: int) -> tuple[int, int, int]: ...
@classmethod
def unlink(cls, id: int) -> tuple[int, int, int]: ...
@classmethod
def link(cls, id: int) -> tuple[int, int, int]: ...
@classmethod
def clear(cls) -> tuple[int, int, int]: ...
@classmethod
def set(cls, ids: _SeqIntT) -> tuple[int, int, _SeqIntT]: ...
class _RelationalMulti(_Relational):
write_sequence: int
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): ...
def convert_to_read(
self, value, record: BaseModel, use_display_name: bool = ...
): ...
def convert_to_write(self, value, record: BaseModel): ...
def convert_to_export(self, value, record: BaseModel) -> str: ...
def convert_to_display_name(self, value, record: BaseModel) -> None: ...
def get_depends(self, model: BaseModel): ...
def create(self, record_values: list[tuple[BaseModel, Any]]) -> None: ...
def write(self, records: BaseModel, value) -> None: ...
def write_batch(self, records_commands_list: list, create: bool = ...) -> None: ...
class One2many(_RelationalMulti):
type: str
inverse_name: str | None
auto_join: bool
copy: bool
def __init__(
self,
comodel_name: str = ...,
inverse_name: str = ...,
string: str = ...,
**kwargs
) -> None: ...
def setup_nonrelated(self, model: BaseModel) -> None: ...
def update_db(self, model: BaseModel, columns) -> None: ...
def get_domain_list(self, records: BaseModel): ...
def read(self, records: BaseModel): ...
def write_real(self, records_commands_list: list, create: bool = ...) -> None: ...
def write_new(self, records_commands_list: list): ...
class Many2many(_RelationalMulti):
type: str
relation: str | None
column1: str | None
column2: str | None
auto_join: bool
ondelete: str
def __init__(
self,
comodel_name: str = ...,
relation: str = ...,
column1: str = ...,
column2: str = ...,
string: str = ...,
**kwargs
) -> None: ...
def setup_nonrelated(self, model: BaseModel) -> None: ...
def update_db(self, model: BaseModel, columns) -> None: ...
def update_db_foreign_keys(self, model: BaseModel) -> None: ...
def read(self, records: BaseModel) -> None: ...
def write_real(self, records_commands_list: list, create: bool = ...) -> None: ...
def write_new(self, records_commands_list: list) -> None: ...
class Id(Field[int]):
type: str
column_type: tuple[str, str]
string: str
store: bool
readonly: bool
prefetch: bool
def update_db(self, model: BaseModel, columns) -> None: ...
def __set__(self, record: BaseModel, value) -> None: ...
class PrefetchMany2one:
record: BaseModel
field: Field
def __init__(self, record: BaseModel, field: Field) -> None: ...
def __iter__(self) -> Iterator[int]: ...
def __reversed__(self) -> Iterator[int]: ...
class PrefetchX2many:
record: BaseModel
field: Field
def __init__(self, record: BaseModel, field: Field) -> None: ...
def __iter__(self) -> Iterator[int]: ...
def __reversed__(self) -> Iterator[int]: ...
def apply_required(model: BaseModel, field_name: str) -> None: ...

View File

@@ -1,333 +0,0 @@
from abc import ABC, abstractmethod
from collections import defaultdict
from collections.abc import MutableMapping
from typing import Any, Callable, Generator, 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.middleware.proxy_fix import ProxyFix as ProxyFix_
from werkzeug.routing import Map, Rule
from werkzeug.urls import URL
from .api import Environment
from .models import BaseModel
from .modules.registry import Registry
from .sql_db import Cursor
from .tools._vendor import sessions
_T = TypeVar("_T")
ProxyFix: Callable[..., ProxyFix_]
CORS_MAX_AGE: int
CSRF_FREE_METHODS: tuple[str, ...]
CSRF_TOKEN_SALT: int
DEFAULT_LANG: str
def get_default_session() -> dict[str, Any]: ...
DEFAULT_MAX_CONTENT_LENGTH: int
GEOIP_EMPTY_COUNTRY: geoip2.models.Country
GEOIP_EMPTY_CITY: geoip2.models.City
JSON_MIMETYPES: tuple[str, ...]
MISSING_CSRF_WARNING: str
ROUTING_KEYS: set[str]
SESSION_LIFETIME: int
STATIC_CACHE: int
STATIC_CACHE_LONG: int
class RegistryError(RuntimeError): ...
class SessionExpiredException(Exception): ...
def content_disposition(filename: str) -> str: ...
def db_list(force: bool = ..., host: str | None = ...) -> list[str]: ...
def db_filter(dbs: Iterable[str], host: str | None = ...) -> list[str]: ...
def dispatch_rpc(service_name: str, method: str, params: Mapping): ...
def get_session_max_inactivity(env: Environment) -> int: ...
def is_cors_preflight(request: Request, endpoint) -> bool: ...
def serialize_exception(exception: Exception): ...
class Stream:
type: str
data: bytes | None
path: str | None
url: str | None
mimetype: str | None
as_attachment: bool
download_name: str | None
conditional: bool
etag: bool
last_modified: float | None
max_age: int | None
immutable: bool
size: int | None
public: bool
def __init__(self, **kwargs) -> None: ...
@classmethod
def from_path(
cls, path: str, filter_ext: tuple[str, ...] = ..., public: bool = ...
) -> Stream: ...
@classmethod
def from_binary_field(cls, record: BaseModel, field_name: str) -> Stream: ...
def read(self) -> bytes: ...
def get_response(
self,
as_attachment: bool | None = ...,
immutable: bool | None = ...,
content_security_policy: str = ...,
**send_file_kwargs
) -> werkzeug.Response: ...
class Controller:
children_classes: defaultdict[Any, list]
@classmethod
def __init_subclass__(cls) -> None: ...
def route(
route: str | list[str] | None = ...,
type: str = ...,
auth: str = ...,
methods: list[str] = ...,
cors: str = ...,
csrf: bool = ...,
**kw
): ...
class FilesystemSessionStore(sessions.FilesystemSessionStore):
def get_session_filename(self, sid: str) -> str: ...
def save(self, session: Session) -> None: ...
def get(self, sid: str) -> Session: ...
def rotate(self, session: Session, env: Environment) -> None: ...
def vacuum(self, max_lifetime=...) -> None: ...
def generate_key(self, salt: Any | None = ...): ...
def is_valid_key(self, key): ...
def delete_from_identifiers(self, identifiers) -> None: ...
class Session(MutableMapping):
can_save: bool
is_dirty: bool
is_new: bool
should_rotate: bool
sid: str
def __init__(self, data: dict, sid: str, new: bool = ...) -> None: ...
def __getitem__(self, item: str): ...
def __setitem__(self, item: str, value) -> None: ...
def __delitem__(self, item: str) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterable[str]: ...
def __getattr__(self, attr: str): ...
def __setattr__(self, key: str, val) -> None: ...
def clear(self) -> None: ...
uid: int | None
pre_login: str | None
pre_uid: int
def authenticate(self, dbname: str, credential: dict) -> int: ...
def finalize(self, env: Environment) -> None: ...
def logout(self, keep_db: bool = ...) -> None: ...
def touch(self) -> None: ...
def update_trace(self, request: Request) -> dict: ...
class GeoIP(Mapping):
ip: str
def __init__(self, ip: str) -> None: ...
@property
def country_name(self): ...
@property
def country_code(self): ...
def __getattr__(self, attr): ...
def __bool__(self) -> bool: ...
def __getitem__(self, item): ...
def __iter__(self): ...
def __len__(self) -> int: ...
request: Request
def borrow_request() -> Generator[Request, None, None]: ...
def make_request_wrap_methods(attr) -> tuple[Callable, Callable]: ...
class HTTPRequest:
environ: dict
def __init__(self, environ: dict) -> None: ...
def __enter__(self) -> HTTPRequest: ...
HTTPREQUEST_ATTRIBUTES: list[str]
class Response(werkzeug.Response):
default_mimetype: str
def __init__(self, *args, **kw) -> None: ...
@classmethod
def load(cls, result, fname: str = ...): ...
template: Any
qcontext: dict
uid: int
def set_default(
self,
template: Any | None = ...,
qcontext: dict | None = ...,
uid: int | None = ...,
) -> None: ...
@property
def is_qweb(self) -> bool: ...
def render(self): ...
def flatten(self) -> None: ...
def set_cookie(
self,
key: str,
value: str = ...,
max_age: Any | None = ...,
expires: int = ...,
path: str = ...,
domain: str | None = ...,
secure: bool = ...,
httponly: bool = ...,
samesite: str | None = ...,
cookie_type: str = ...,
) -> None: ...
class FutureResponse:
charset: str
max_cookie_size: int
headers: Headers
def __init__(self) -> None: ...
def set_cookie(
self,
key: str,
value: str = ...,
max_age: Any | None = ...,
expires: int = ...,
path: str = ...,
domain: str | None = ...,
secure: bool = ...,
httponly: bool = ...,
samesite: str | None = ...,
cookie_type: str = ...,
) -> None: ...
class Request:
httprequest: werkzeug.Request
future_response: FutureResponse
dispatcher: Dispatcher
params: dict
geoip: GeoIP
registry: Registry | None
session: Session
db: str | None
env: Environment | None
website: Website
website_routing: int
is_frontend: bool
is_frontend_multilang: bool
lang: Lang
def __init__(self, httprequest: werkzeug.Request) -> None: ...
def update_env(
self,
user=...,
context: dict[str, Any] | None = ...,
su: bool | None = ...,
) -> None: ...
def update_context(self, **overrides) -> None: ...
@property
def context(self) -> dict[str, Any]: ...
@context.setter
def context(self, value) -> None: ...
@property
def uid(self) -> int: ...
@uid.setter
def uid(self, value) -> None: ...
@property
def cr(self) -> Cursor: ...
@cr.setter
def cr(self, value) -> None: ...
@property
def best_lang(self) -> str | None: ...
@property
def cookies(self) -> dict: ...
def csrf_token(self, time_limit: int | None = ...) -> str: ...
def validate_csrf(self, csrf: str) -> bool: ...
def default_context(self) -> dict: ...
def default_lang(self) -> str: ...
def get_http_params(self) -> dict: ...
def get_json_data(self): ...
def make_response(
self,
data: str,
headers: list[tuple[str, Any]] | None = ...,
cookies: Mapping | None = ...,
status: int = ...,
) -> Response: ...
def make_json_response(
self,
data,
headers: list[tuple[str, Any]] | None = ...,
cookies: Mapping | None = ...,
status: int = ...,
) -> Response: ...
def not_found(self, description: str | None = ...) -> NotFound: ...
def redirect(
self, location: URL | str, code: int = ..., local: bool = ...
) -> werkzeug.Response: ...
def redirect_query(
self,
location: str,
query: Mapping[str, str] | Iterable[tuple[str, str]] | None = ...,
code: int = ...,
local: bool = ...,
) -> werkzeug.Response: ...
def render(
self, template: str, qcontext: dict | None = ..., lazy: bool = ..., **kw
): ...
def reroute(self, path, query_string: str | None = ...) -> None: ...
class Dispatcher(ABC):
routing_type: str
@classmethod
def __init_subclass__(cls) -> None: ...
request: Request
def __init__(self, request: Request) -> None: ...
@classmethod
@abstractmethod
def is_compatible_with(cls, request: Request) -> bool: ...
def pre_dispatch(self, rule: Rule, args) -> None: ...
@abstractmethod
def dispatch(self, endpoint, args): ...
def post_dispatch(self, response: werkzeug.Response) -> None: ...
@abstractmethod
def handle_error(self, exc: Exception) -> Callable: ...
class HttpDispatcher(Dispatcher):
routing_type: str
@classmethod
def is_compatible_with(cls, request: Request) -> Literal[True]: ...
def dispatch(self, endpoint, args): ...
def handle_error(self, exc: Exception) -> Callable: ...
class JsonRPCDispatcher(Dispatcher):
routing_type: str
jsonrequest: dict
request_id: object
def __init__(self, request: Request) -> None: ...
@classmethod
def is_compatible_with(cls, request: Request) -> bool: ...
def dispatch(self, endpoint, args): ...
def handle_error(self, exc: Exception) -> Callable: ...
class Application:
@property
def statics(self) -> dict[str, str]: ...
def get_static_file(self, url: str, host: str = ...) -> str | None: ...
@property
def nodb_routing_map(self) -> Map: ...
@property
def session_store(self) -> FilesystemSessionStore: ...
def get_db_router(self, db: str): ...
@property
def geoip_city_db(self) -> geoip2.database.Reader: ...
def geoip_country_db(self) -> geoip2.database.Reader: ...
def set_csp(self, response: werkzeug.Response) -> None: ...
def __call__(self, environ: dict, start_response: Callable): ...
root: Application

View File

@@ -1,12 +0,0 @@
from typing import Generator
LOG_NOTSET: str
LOG_DEBUG: str
LOG_INFO: str
LOG_WARNING: str
LOG_ERROR: str
LOG_CRITICAL: str
def get_encodings(hint_encoding: str = ...) -> Generator[str, None, None]: ...
def ustr(value, hint_encoding: str = ..., errors: str = ...) -> str: ...
def exception_to_unicode(e: BaseException) -> str: ...

View File

@@ -1,586 +0,0 @@
from collections import defaultdict
from re import Pattern
from typing import (
Any,
Callable,
Collection,
Container,
Iterable,
Iterator,
MutableMapping,
Sequence,
TypeVar,
overload,
)
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, NewId
from .fields import Field
from .modules.registry import Registry, TriggerTree
from .sql_db import Cursor
from .tools import SQL, Query
_T = TypeVar("_T")
_ModelT = TypeVar("_ModelT", bound=BaseModel)
_Model2T = TypeVar("_Model2T", bound=BaseModel)
regex_alphanumeric: Pattern[str]
regex_order: Pattern[str]
regex_object_name: Pattern[str]
regex_pg_name: Pattern[str]
regex_field_agg: Pattern[str]
regex_read_group_spec: Pattern[str]
AUTOINIT_RECALCULATE_STORED_FIELDS: int
INSERT_BATCH_SIZE: int
UPDATE_BATCH_SIZE: int
SQL_DEFAULT: psycopg2.extensions.AsIs
def parse_read_group_spec(spec: str) -> tuple: ...
def check_object_name(name: str) -> bool: ...
def raise_on_invalid_object_name(name: str) -> None: ...
def check_pg_name(name: str) -> None: ...
regex_private: Pattern[str]
def check_method_name(name: str) -> None: ...
def check_property_field_value_name(property_name) -> None: ...
def fix_import_export_id_paths(fieldname: str) -> list[str]: ...
def to_company_ids(companies): ...
def check_company_domain_parent_of(self, companies) -> list: ...
def check_companies_domain_parent_of(self, companies) -> list: ...
class MetaModel(api.Meta):
module_to_models: defaultdict[str, list[type[BaseModel]]]
def __new__(meta, name: str, bases: tuple, attrs: dict): ...
def __init__(
self: type[BaseModel], name: str, bases: tuple, attrs: dict
) -> None: ...
def origin_ids(ids: Iterable) -> Iterator[int]: ...
class OriginIds:
ids: Sequence[int]
def __init__(self, ids: Sequence[int]) -> None: ...
def __iter__(self) -> Iterator[int]: ...
def __reversed__(self) -> Iterator[int]: ...
def expand_ids(id0: _T, ids: Iterable) -> Iterator[_T]: ...
PREFETCH_MAX: int
LOG_ACCESS_COLUMNS: list[str]
MAGIC_COLUMNS: list[str]
READ_GROUP_TIME_GRANULARITY: dict[str, dateutil.relativedelta.relativedelta]
READ_GROUP_NUMBER_GRANULARITY: dict[str, str]
READ_GROUP_ALL_TIME_GRANULARITY: dict[str, Any]
READ_GROUP_AGGREGATE: dict[str, Callable[[str, str | SQL], SQL]]
READ_GROUP_DISPLAY_FORMAT: dict[str, str]
def is_definition_class(cls) -> bool: ...
def is_registry_class(cls) -> bool: ...
class BaseModel(metaclass=MetaModel):
_auto: bool
_register: bool
_abstract: bool
_transient: bool
_name: str
_description: str
_module: str
_custom: bool
_inherit: str | list[str]
_inherits: dict[str, str]
_table: str
_table_query: str | None
_sql_constraints: list[tuple[str, str, str]]
_rec_name: str | None
_rec_names_search: Sequence[str] | None
_order: str
_parent_name: str
_parent_store: bool
_active_name: str | None
_fold_name: str
_translate: bool
_check_company_auto: bool
_allow_sudo_commands: bool
_depends: dict[str, Iterable[str]]
_transient_max_count: int
_transient_max_hours: float
_original_module: str
_inherit_module: dict[str, str]
_inherit_children: set[str]
_inherits_children: set[str]
_fields: dict[str, Field]
_field_definitions: list[Field]
_log_access: bool
_ids: tuple[int | NewId]
_prefetch_ids: Iterable[int | NewId]
env: Environment = ...
pool: Registry
id = fields.Id()
display_name = fields.Char(string="Display Name")
create_uid = fields.Many2one("res.users", string="Created by")
create_date = fields.Datetime(string="Created on")
write_uid = fields.Many2one("res.users", string="Last Updated by")
write_date = fields.Datetime(string="Last Updated on")
def _valid_field_parameter(self, field: Field, name: str) -> bool: ...
def _add_field(self, name: str, field: Field) -> None: ...
def _pop_field(self, name: str) -> Field: ...
@classmethod
def _build_model(cls, pool: Registry, cr: Cursor) -> BaseModel: ...
@classmethod
def _build_model_check_base(model_class, cls: type[BaseModel]) -> None: ...
@classmethod
def _build_model_check_parent(
model_class, cls: type[BaseModel], parent_class: type[BaseModel]
) -> None: ...
@classmethod
def _build_model_attributes(cls, pool: Registry) -> None: ...
@classmethod
def _init_constraints_onchanges(cls) -> None: ...
@property
def _table_sql(self) -> SQL: ...
@property
def _constraint_methods(self) -> list: ...
@property
def _ondelete_methods(self) -> list: ...
@property
def _onchange_methods(self) -> dict[str, list]: ...
def _is_an_ordinary_table(self) -> bool: ...
def _export_rows(
self, fields: list[list[str]], *, _is_toplevel_call: bool = ...
) -> list[list]: ...
def export_data(self, fields_to_export: list[str]) -> dict[str, list[list]]: ...
def load(self, fields: list[str], data: list[list[str]]) -> dict[str, Any]: ...
def _extract_records(
self,
field_paths: Iterable[Sequence[str]],
data,
log: Callable = ...,
limit: float = ...,
) -> Iterator[tuple[BaseModel, dict[str, dict[str, int]]]]: ...
def _convert_records(
self, records, log: Callable = ...
) -> Iterator[tuple[Any, Any, Any, dict]]: ...
def _validate_fields(
self, field_names: Iterable[str], excluded_names: Iterable[str] = ...
) -> None: ...
def default_get(self, fields_list: list[str]) -> dict[str, Any]: ...
def _rec_name_fallback(self) -> str: ...
def search_count(self, domain: list, limit: int | None = ...) -> int: ...
def search(
self: _ModelT,
domain: list,
offset: int = ...,
limit: int | None = ...,
order: str | None = ...,
) -> _ModelT: ...
def search_fetch(
self: _ModelT,
domain: list,
field_names: Collection[str],
offset: int = ...,
limit: int | None = ...,
order: str | None = ...,
) -> _ModelT: ...
def _compute_display_name(self) -> None: ...
def _search_display_name(self, operator, value): ...
def name_create(self, name: str) -> tuple[int, str]: ...
def name_search(
self,
name: str = ...,
args: list | None = ...,
operator: str = ...,
limit: int = ...,
) -> list[tuple[int, str]]: ...
def _name_search(
self,
name: str = ...,
domain: list | None = ...,
operator: str = ...,
limit: int = ...,
order: str | None = ...,
) -> Query: ...
def _add_missing_default_values(self, values: dict[str, Any]) -> dict[str, Any]: ...
@classmethod
def clear_caches(cls) -> None: ...
def _read_group(
self,
domain: list,
groupby: Iterable[str] = ...,
aggregates: Iterable[str] = ...,
having: list = ...,
offset: int = ...,
limit: int | None = ...,
order: str | None = ...,
) -> list[tuple]: ...
def _read_group_select(self, aggregate_spec: str, query: Query) -> SQL: ...
def _read_group_groupby(self, groupby_spec: str, query: Query) -> SQL: ...
def _read_group_having(self, having_domain: list, query: Query) -> SQL: ...
def _read_group_orderby(
self, order: str, groupby_terms: dict[str, SQL], query: Query
) -> tuple[SQL, SQL]: ...
def _read_group_empty_value(self, spec: str) -> Any: ...
def _read_group_postprocess_groupby(
self, groupby_spec: str, raw_values
) -> Iterator: ...
def _read_group_postprocess_aggregate(
self, aggregate_spec: str, raw_values
) -> Iterator: ...
def _read_group_expand_full(
self, groups: _ModelT, domain: list | None
) -> _ModelT: ...
def _read_group_fill_results(
self,
domain: list,
groupby: str,
annoted_aggregates: dict[str, str],
read_group_result: list[dict],
read_group_order: str | None = ...,
) -> list: ...
def _read_group_fill_temporal(
self,
data: list,
groupby: list[str],
annoted_aggregates: dict[str, str],
fill_from: bool = ...,
fill_to: bool = ...,
min_groups: bool = ...,
) -> list: ...
def _read_group_format_result(
self, rows_dict: Iterable[dict], lazy_groupby: Iterable[str]
) -> None: ...
def _read_group_format_result_properties(
self, rows_dict: Iterable[dict], group: str
) -> None: ...
def _read_group_get_annotated_groupby(
self, groupby: str | list[str], lazy: bool
): ...
def read_group(
self,
domain: list,
fields: list[str],
groupby: str | list[str],
offset: int = ...,
limit: int | None = ...,
orderby: str | None = ...,
lazy: bool = ...,
) -> list[dict[str, Any]]: ...
def _traverse_related_sql(
self: _ModelT, alias: str, field: Field, query: Query
) -> tuple[_ModelT, Field, str]: ...
def _field_to_sql(
self, alias: str, fname: str, query: Query | None = ..., flush: bool = ...
) -> SQL: ...
def _read_group_groupby_properties(
self, fname: str, property_name: str, query: Query
) -> SQL: ...
def _condition_to_sql(
self, alias: str, fname: str, operator: str, value, query: Query
) -> SQL: ...
def get_property_definition(self, full_name: str) -> dict: ...
def _parent_store_compute(self): ...
def _check_removed_columns(self, log: bool = ...) -> None: ...
def _init_column(self, column_name: str) -> None: ...
def _table_has_rows(self) -> int: ...
def _auto_init(self): ...
def init(self) -> None: ...
def _check_parent_path(self) -> None: ...
def _add_sql_constraints(self) -> None: ...
def _add_inherited_fields(self) -> None: ...
def _inherits_check(self) -> None: ...
def _prepare_setup(self) -> None: ...
def _setup_base(self) -> None: ...
def _setup_fields(self) -> None: ...
def _setup_complete(self) -> None: ...
def fields_get(
self, allfields: list[str] | None = ..., attributes: list[str] | None = ...
) -> dict[str, dict[str, Any]]: ...
def check_field_access_rights(
self, operation: str, field_names: Collection[str]
): ...
def read(
self, fields: Collection[str] | None = ..., load: str = ...
) -> list[dict[str, Any]]: ...
def update_field_translations(
self,
field_name: str,
translations: dict[str, Any],
source_lang: str | None = ...,
) -> bool: ...
def _update_field_translations(
self,
field_name: str,
translations: dict[str, Any],
digest: Callable | None = ...,
source_lang: str | None = ...,
) -> bool: ...
def get_field_translations(
self, field_name: str, langs: list[str] | None = ...
) -> tuple[list[dict[str, Any]], dict[str, Any]]: ...
def _get_base_lang(self) -> str: ...
def _read_format(
self, fnames: Collection[str], load: str = ...
) -> list[dict[str, Any]]: ...
def _fetch_field(self, field: Field) -> None: ...
def fetch(self, field_names: Collection[str]) -> None: ...
def _determine_fields_to_fetch(
self, field_names, ignore_when_in_cache: bool = ...
) -> list[Field]: ...
def _fetch_query(
self: _ModelT, query: Query, fields: Iterable[Field]
) -> _ModelT: ...
def get_metadata(self) -> list[dict[str, Any]]: ...
def get_base_url(self) -> str: ...
def _check_company_domain(self, companies) -> list: ...
def _check_company(self, fnames: Collection[str] | None = ...) -> None: ...
def check_access(self, operation: str) -> None: ...
def has_access(self, operation: str) -> bool: ...
def _filtered_access(self, operation: str): ...
def _check_access(
self: _ModelT, operation: str
) -> tuple[_ModelT, Callable] | None: ...
def check_access_rights(
self, operation: str, raise_exception: bool = ...
) -> bool: ...
def check_access_rule(self, operation: str) -> None: ...
def _filter_access_rules(self: _ModelT, operation: str) -> _ModelT: ...
def _filter_access_rules_python(self, operation: str) -> _ModelT: ...
def unlink(self): ...
def write(self, vals: dict[str, Any]): ...
def _write(self, vals: dict[str, Any]) -> None: ...
def _write_multi(self, vals_list) -> None: ...
@overload
def create(self: _ModelT, vals_list: list[dict[str, Any]]) -> _ModelT: ...
@overload
def create(self: _ModelT, vals_list: dict[str, Any]) -> _ModelT: ...
def _prepare_create_values(
self, vals_list: list[dict[str, Any]]
) -> list[dict[str, Any]]: ...
def _add_precomputed_values(self, vals_list: list[dict[str, Any]]) -> None: ...
def _create(self: _ModelT, data_list: list[dict[str, Any]]) -> _ModelT: ...
def _compute_field_value(self, field: Field) -> None: ...
def _parent_store_create(self) -> None: ...
def _parent_store_update_prepare(self: _ModelT, vals_list) -> _ModelT: ...
def _parent_store_update(self) -> None: ...
def _clean_properties(self) -> None: ...
def _load_records_write(self, values: dict[str, Any]) -> None: ...
def _load_records_create(self, vals_list: list[dict[str, Any]]): ...
def _load_records(
self, data_list: list[dict], update: bool = ..., ignore_duplicates: bool = ...
) -> BaseModel: ...
def _where_calc(self, domain: list, active_test: bool = ...) -> Query: ...
def _check_qorder(self, word: str) -> bool: ...
def _apply_ir_rules(self, query: Query, mode: str = ...) -> None: ...
def _order_to_sql(
self, order: str, query: Query, alias: str | None = ..., reverse: bool = ...
) -> SQL: ...
def _order_field_to_sql(
self, alias: str, field_name: str, direction: SQL, nulls: SQL, query: Query
) -> SQL: ...
def _flush_search(
self,
domain: list,
fields: Sequence[str] | None = ...,
order: str | None = ...,
seen: set | None = ...,
) -> None: ...
def _search(
self: _ModelT,
domain: list,
offset: int = ...,
limit: int | None = ...,
order: str | None = ...,
) -> Query: ...
def _as_query(self, ordered: bool = ...) -> Query: ...
def copy_data(
self, default: dict[str, Any] | None = ...
) -> list[dict[str, Any]]: ...
def copy_translations(
self: _ModelT, new: _ModelT, excluded: Container[str] = ...
) -> None: ...
def copy(self: _ModelT, default: dict[str, Any] | None = ...) -> _ModelT: ...
def exists(self: _ModelT) -> _ModelT: ...
def _has_cycle(self, field_name: str | None = ...) -> bool: ...
def _check_recursion(self, parent: str | None = ...) -> bool: ...
def _check_m2m_recursion(self, field_name: str) -> bool: ...
def _get_external_ids(self) -> dict[int, list[str]]: ...
def get_external_id(self) -> dict[int, str]: ...
@classmethod
def is_transient(cls) -> bool: ...
def search_read(
self,
domain: list | None = ...,
fields: list[str] | None = ...,
offset: int = ...,
limit: int | None = ...,
order: str | None = ...,
**read_kwargs: str
) -> list[dict[str, Any]]: ...
def toggle_active(self) -> None: ...
def action_archive(self): ...
def action_unarchive(self): ...
def _register_hook(self) -> None: ...
def _unregister_hook(self) -> None: ...
def _get_redirect_suggested_company(self) -> Company: ...
def __init__(
self, env: Environment, ids: tuple, prefetch_ids: Iterable[int]
) -> None: ...
def browse(
self: _ModelT, ids: int | NewId | Iterable[int | NewId] | None = ...
) -> _ModelT: ...
@property
def ids(self) -> list[int]: ...
_cr: Cursor
_uid: int
_context: dict
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: Users | int) -> _ModelT: ...
def with_company(self: _ModelT, company: Company | int) -> _ModelT: ...
def with_context(self: _ModelT, *args, **kwargs) -> _ModelT: ...
def with_prefetch(
self: _ModelT, prefetch_ids: Iterable[int] | None = ...
) -> _ModelT: ...
def _update_cache(self, values: dict[str, Any], validate: bool = ...): ...
def _convert_to_record(self, values: dict[str, Any]): ...
def _convert_to_write(self, values: dict[str, Any]) -> dict[str, Any]: ...
def _mapped_func(self, func: Callable): ...
@overload
def mapped(self: _ModelT, func: Callable[[_ModelT], _Model2T]) -> _Model2T: ...
@overload
def mapped(self: _ModelT, func: Callable[[_ModelT], _T]) -> list[_T]: ...
@overload
def mapped(self, func: str) -> Any: ...
@overload
def filtered(self: _ModelT, func: Callable[[_ModelT], Any]) -> _ModelT: ...
@overload
def filtered(self: _ModelT, func: str) -> _ModelT: ...
@overload
def grouped(self: _ModelT, key: Callable[[_ModelT], _T]) -> dict[_T, _ModelT]: ...
@overload
def grouped(self: _ModelT, key: str) -> dict[Any, _ModelT]: ...
def filtered_domain(self: _ModelT, domain: list) -> _ModelT: ...
@overload
def sorted(
self: _ModelT, key: Callable[[_ModelT], Any] = ..., reverse: bool = ...
) -> _ModelT: ...
@overload
def sorted(
self: _ModelT, key: str | None = ..., reverse: bool = ...
) -> _ModelT: ...
def update(self, values: dict[str, Any]) -> None: ...
def flush_model(self, fnames: Iterable[str] | None = ...) -> None: ...
def flush_recordset(self, fnames: Iterable[str] | None = ...) -> None: ...
def _flush(self, fnames: Iterable[str] | None = ...) -> None: ...
def new(
self: _ModelT,
values: dict[str, Any] | None = ...,
origin: _ModelT | None = ...,
ref: Any | None = ...,
) -> _ModelT: ...
@property
def _origin(self: _ModelT) -> _ModelT: ...
def __bool__(self) -> bool: ...
def __len__(self) -> int: ...
def __iter__(self: _ModelT) -> Iterator[_ModelT]: ...
def __reversed__(self) -> Iterator[_ModelT]: ...
def __contains__(self: _ModelT, item: _ModelT | str) -> bool: ...
def __add__(self: _ModelT, other: _ModelT) -> _ModelT: ...
def concat(self: _ModelT, *args: _ModelT) -> _ModelT: ...
def __sub__(self: _ModelT, other: _ModelT) -> _ModelT: ...
def __and__(self: _ModelT, other: _ModelT) -> _ModelT: ...
def __or__(self: _ModelT, other: _ModelT) -> _ModelT: ...
def union(self: _ModelT, *args: _ModelT) -> _ModelT: ...
def __eq__(self: _ModelT, other: _ModelT) -> bool: ...
def __lt__(self: _ModelT, other: _ModelT) -> bool: ...
def __le__(self: _ModelT, other: _ModelT) -> bool: ...
def __gt__(self: _ModelT, other: _ModelT) -> bool: ...
def __ge__(self: _ModelT, other: _ModelT) -> bool: ...
def __int__(self) -> int: ...
def __repr__(self) -> str: ...
def __hash__(self) -> int: ...
@overload
def __getitem__(self: _ModelT, key: int | slice) -> _ModelT: ...
@overload
def __getitem__(self, key: str) -> Any: ...
def __setitem__(self, key: str, value): ...
@property
def _cache(self) -> RecordCache: ...
def _in_cache_without(self: _ModelT, field: Field, limit: int = ...) -> _ModelT: ...
def invalidate_model(
self, fnames: Iterable[str] | None = ..., flush: bool = ...
) -> None: ...
def invalidate_recordset(
self, fnames: Iterable[str] | None = ..., flush: bool = ...
) -> None: ...
def _invalidate_cache(
self, fnames: Iterable[str] | None = ..., ids: Iterable[int] | None = ...
) -> None: ...
def modified(
self, fnames: Collection[str], create: bool = ..., before: bool = ...
) -> None: ...
def _modified(
self, fields: list, create: bool
) -> Iterator[tuple[Field, _ModelT, bool]]: ...
def _modified_triggers(
self: _ModelT, tree: TriggerTree, create: bool = ...
) -> Iterator[tuple[Field, _ModelT, bool]]: ...
def _recompute_model(self, fnames: Iterable[str] | None = ...) -> None: ...
def _recompute_recordset(self, fnames: Iterable[str] | None = ...) -> None: ...
def _recompute_field(
self, field: Field, ids: Iterable[int] | None = ...
) -> None: ...
def _has_onchange(self, field: Field, other_fields: Container[Field]) -> bool: ...
def _apply_onchange_methods(self, field_name: str, result: dict) -> None: ...
def onchange(
self,
values: dict,
field_names: list[str],
fields_spec: dict,
) -> dict: ...
def _get_placeholder_filename(self, field: str) -> str | bool: ...
class RecordCache(MutableMapping):
def __init__(self, record: BaseModel) -> None: ...
def __contains__(self, name: str) -> bool: ...
def __getitem__(self, name: str) -> Any: ...
def __setitem__(self, name: str, value: Any) -> None: ...
def __delitem__(self, name: str) -> None: ...
def __iter__(self) -> Iterator[str]: ...
def __len__(self) -> int: ...
AbstractModel = BaseModel
class Model(AbstractModel):
_auto: bool
_register: bool
_abstract: bool
_transient: bool
class TransientModel(Model):
_auto: bool
_register: bool
_abstract: bool
_transient: bool
def _transient_vacuum(self) -> None: ...
def _transient_clean_old_rows(self, max_count: int) -> None: ...
def _transient_clean_rows_older_than(self, seconds) -> None: ...
def itemgetter_tuple(items) -> Callable[..., tuple]: ...
def convert_pgerror_not_null(
model: BaseModel, fields: dict[str, dict[str, Any]], info, e: psycopg2.Error
) -> dict[str, str]: ...
def convert_pgerror_unique(
model: BaseModel, fields: dict[str, dict[str, Any]], info, e: psycopg2.Error
) -> dict[str, str]: ...
def convert_pgerror_constraint(
model: BaseModel, fields: dict[str, dict[str, Any]], info, e: psycopg2.Error
) -> dict[str, str]: ...
PGERROR_TO_OE: dict[str, Callable]

View File

@@ -1,21 +0,0 @@
from . import db as db
from . import graph as graph
from . import loading as loading
from . import migration as migration
from . import module as module
from . import neutralize as neutralize
from . import registry as registry
from .loading import load_modules as load_modules
from .loading import reset_modules_state as reset_modules_state
from .module import adapt_version as adapt_version
from .module import check_manifest_dependencies as check_manifest_dependencies
from .module import check_resource_path as check_resource_path
from .module import get_manifest as get_manifest
from .module import get_module_path as get_module_path
from .module import get_module_resource as get_module_resource
from .module import get_modules as get_modules
from .module import get_modules_with_version as get_modules_with_version
from .module import get_resource_from_path as get_resource_from_path
from .module import get_resource_path as get_resource_path
from .module import initialize_sys_path as initialize_sys_path
from .module import load_openerp_module as load_openerp_module

View File

@@ -1,15 +0,0 @@
from enum import IntEnum
from ..sql_db import Cursor
def is_initialized(cr: Cursor) -> bool: ...
def initialize(cr: Cursor) -> None: ...
def create_categories(cr: Cursor, categories: list[str]) -> int | None: ...
class FunctionStatus(IntEnum):
MISSING: int
PRESENT: int
INDEXABLE: int
def has_unaccent(cr: Cursor) -> bool: ...
def has_trigram(cr: Cursor) -> bool: ...

View File

@@ -1,35 +0,0 @@
from typing import Any, Iterable, Iterator
from ..sql_db import Cursor
class Graph(dict[str, Node]):
def add_node(self, name: str, info: dict[str, Any]) -> Node: ...
def update_from_db(self, cr: Cursor) -> None: ...
def add_module(self, cr: Cursor, module: str, force: list | None = ...) -> None: ...
def add_modules(
self, cr: Cursor, module_list: list[str], force: list | None = ...
): ...
def __iter__(self) -> Iterator[Node]: ...
class Node:
def __new__(cls, name: str, graph: Graph, info: dict[str, Any]) -> Node: ...
id: int
name: str
graph: Graph
info: dict[str, Any]
children: list[Node]
depth: int
dbdemo: bool
state: str
installed_version: str
def __init__(
self, name: str, graph: Graph, info: dict[str, Any] | None
) -> None: ...
@property
def data(self) -> dict[str, Any]: ...
def add_child(self, name: str, info: dict[str, Any]): ...
def __setattr__(self, name: str, value) -> None: ...
def __iter__(self) -> Iterator[Node]: ...
def should_have_demo(self) -> bool: ...
@property
def parents(self) -> Iterable[Node]: ...

View File

@@ -1,39 +0,0 @@
from typing import Any
from ..api import Environment
from ..tests.result import OdooTestResult
from .graph import Graph, Node
from .registry import Registry
def load_data(
env: Environment, idref: dict, mode: str, kind: str, package: Node
) -> bool: ...
def load_demo(env: Environment, package: Node, idref: dict, mode: str) -> bool: ...
def force_demo(env: Environment) -> None: ...
def load_module_graph(
env: Environment,
graph: Graph,
status: Any | None = ...,
perform_checks: Any = ...,
skip_modules: list[str] | None = ...,
report: OdooTestResult | None = ...,
models_to_check: set[str] | None = ...,
) -> tuple[list[str], list[str]]: ...
def load_marked_modules(
env: Environment,
graph: Graph,
states: list[str],
force: list[str],
progressdict,
report: OdooTestResult,
loaded_modules: list[str],
perform_checks: Any,
models_to_check: set[str] | None = ...,
) -> list[str]: ...
def load_modules(
registry: Registry,
force_demo: bool = ...,
status: Any | None = ...,
update_module: Any = ...,
) -> Registry | None: ...
def reset_modules_state(db_name: str) -> None: ...

View File

@@ -1,16 +0,0 @@
from re import Pattern
from types import ModuleType
from ..sql_db import Cursor
from .graph import Graph, Node
VERSION_RE: Pattern
def load_script(path: str, module_name: str) -> ModuleType: ...
class MigrationManager:
cr: Cursor
graph: Graph
migrations: dict
def __init__(self, cr: Cursor, graph: Graph) -> None: ...
def migrate_module(self, pkg: Node, stage: str) -> None: ...

View File

@@ -1,41 +0,0 @@
from re import Pattern
from types import ModuleType
from typing import Any, Literal
from odoo.addons.base.models.ir_module import Module
MANIFEST_NAMES: tuple[str, ...]
README: list[str]
TYPED_FIELD_DEFINITION_RE: Pattern
class UpgradeHook:
def find_spec(
self, fullname: str, path: Any | None = ..., target: Any | None = ...
): ...
def load_module(self, name: str) -> ModuleType | None: ...
def initialize_sys_path() -> None: ...
def get_module_path(
module: str, downloaded: bool = ..., display_warning: bool = ...
) -> str | Literal[False]: ...
def get_resource_path(module: str, *args) -> str | Literal[False]: ...
get_module_resource = get_resource_path
check_resource_path = get_resource_path
def get_resource_from_path(path: str) -> tuple[str, str, str] | None: ...
def get_module_icon(module: str) -> str: ...
def get_module_icon_path(module: Module) -> str: ...
def module_manifest(path: str) -> str | None: ...
def get_module_root(path: str) -> str | None: ...
def load_manifest(module: str, mod_path: str | None = ...) -> dict[str, Any]: ...
def get_manifest(module: str, mod_path: str | None = ...) -> dict[str, Any]: ...
def load_openerp_module(module_name: str) -> None: ...
def get_modules() -> list[str]: ...
def get_modules_with_version() -> dict[str, Any]: ...
def adapt_version(version: str) -> str: ...
current_test: Any
def check_python_external_dependency(pydep) -> None: ...
def check_manifest_dependencies(manifest) -> None: ...

View File

@@ -1,7 +0,0 @@
from typing import Iterable, Iterator
from ..sql_db import Cursor
def get_installed_modules(cursor: Cursor) -> list[str]: ...
def get_neutralization_queries(modules: Iterable[str]) -> Iterator[str]: ...
def neutralize_database(cursor: Cursor) -> None: ...

View File

@@ -1,117 +0,0 @@
from collections.abc import Mapping
from threading import RLock
from typing import Any, Callable, ClassVar, Iterable, Iterator
from ..fields import Field
from ..models import BaseModel
from ..sql_db import Cursor
from ..tools import Collector
from ..tools.lru import LRU
from .graph import Node
class Registry(Mapping[str, type[BaseModel]]):
registries: ClassVar[LRU]
def __new__(cls, db_name: str) -> Registry: ...
@classmethod
def new(
cls,
db_name: str,
force_demo: bool = ...,
status: Any | None = ...,
update_module: bool = ...,
) -> Registry: ...
models: dict[str, type[BaseModel]]
updated_modules: list[str]
loaded_xmlids: set
db_name: str
test_cr: Cursor | None
test_lock: RLock | None
loaded: bool
ready: bool
field_depends: Collector
field_depends_context: Collector
field_inverses: Collector
many2one_company_dependents: Collector
registry_sequence: int | None
cache_sequences: dict
has_unaccent: bool
has_trigram: bool
unaccent: Callable[[Any], str]
unaccent_python: Callable[[Any], str]
def init(self, db_name: str) -> None: ...
@classmethod
def delete(cls, db_name: str) -> None: ...
@classmethod
def delete_all(cls) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[str]: ...
def __getitem__(self, model_name: str) -> type[BaseModel]: ...
def __call__(self, model_name: str) -> type[BaseModel]: ...
def __setitem__(self, model_name: str, model: type[BaseModel]) -> None: ...
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]: ...
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 get_field_trigger_tree(self, field: Field) -> TriggerTree: ...
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: ...
def init_models(
self, cr: Cursor, model_names: Iterable[str], context: dict, install: bool = ...
) -> None: ...
def check_indexes(self, cr: Cursor, model_names: Iterable[str]) -> None: ...
def add_foreign_key(
self,
table1,
column1,
table2,
column2,
ondelete,
model,
module,
force: bool = ...,
) -> None: ...
def check_foreign_keys(self, cr: Cursor) -> None: ...
def check_tables_exist(self, cr: Cursor) -> None: ...
def clear_cache(self, *cache_names) -> None: ...
def clear_all_caches(self) -> None: ...
def is_an_ordinary_table(self, model: BaseModel) -> bool: ...
@property
def registry_invalidated(self) -> bool: ...
@registry_invalidated.setter
def registry_invalidated(self, value: bool) -> None: ...
@property
def cache_invalidated(self) -> set: ...
def setup_signaling(self) -> None: ...
def get_sequences(self, cr: Cursor) -> tuple[int, dict]: ...
def check_signaling(self, cr: Cursor) -> Registry: ...
def signal_changes(self) -> None: ...
def reset_changes(self) -> None: ...
def manage_changes(self) -> None: ...
def in_test_mode(self) -> bool: ...
test_readonly_enabled: bool
def enter_test_mode(
self, cr: Cursor, test_readonly_enabled: bool = ...
) -> None: ...
def leave_test_mode(self) -> None: ...
def cursor(self, readonly: bool = ...) -> Cursor: ...
class DummyRLock:
def acquire(self) -> None: ...
def release(self) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, type, value, traceback) -> None: ...
class TriggerTree(dict):
root: Any
def __init__(self, root: Any = ..., *args, **kwargs) -> None: ...
def __bool__(self) -> bool: ...
def increase(self, key) -> TriggerTree: ...
def depth_first(self) -> Iterator[TriggerTree]: ...
@classmethod
def merge(cls, trees: list[TriggerTree], select: Callable = ...) -> TriggerTree: ...

View File

@@ -1,64 +0,0 @@
import logging.handlers
from logging import Logger, LogRecord
from typing import TextIO
def log(
logger: Logger, level: int, prefix: str, msg, depth: int | None = ...
) -> None: ...
class WatchedFileHandler(logging.handlers.WatchedFileHandler):
errors: None
def __init__(self, filename: str) -> None: ...
class PostgreSQLHandler(logging.Handler):
def emit(self, record: LogRecord) -> None: ...
BLACK: int
RED: int
GREEN: int
YELLOW: int
BLUE: int
MAGENTA: int
CYAN: int
WHITE: int
DEFAULT: int
RESET_SEQ: str
COLOR_SEQ: str
BOLD_SEQ: str
COLOR_PATTERN: str
LEVEL_COLOR_MAPPING: dict[int, tuple[int, int]]
class PerfFilter(logging.Filter):
def format_perf(
self, query_count: int, query_time: float, remaining_time: float
): ...
def format_cursor_mode(self, cursor_mode): ...
def filter(self, record: LogRecord): ...
class ColoredPerfFilter(PerfFilter):
def format_perf(
self, query_count: int, query_time: float, remaining_time: float
): ...
def format_cursor_mode(self, cursor_mode): ...
class DBFormatter(logging.Formatter):
def format(self, record: LogRecord): ...
class ColoredFormatter(DBFormatter):
def format(self, record: LogRecord): ...
def init_logger(): ...
DEFAULT_LOG_CONFIGURATION: list[str]
PSEUDOCONFIG_MAPPER: dict[str, list[str]]
IGNORE: set[str]
def showwarning_with_traceback(
message: Warning | str,
category: type[Warning],
filename: str,
lineno: int,
file: TextIO | None = ...,
line: str | None = ...,
): ...
def runbot(self, message, *args, **kws) -> None: ...

View File

@@ -1,52 +0,0 @@
from typing import Any, Callable
from ..models import MAGIC_COLUMNS as MAGIC_COLUMNS
from ..models import BaseModel
from ..sql_db import Cursor
from ..tools import SQL, Query
NOT_OPERATOR: str
OR_OPERATOR: str
AND_OPERATOR: str
DOMAIN_OPERATORS: tuple[str, ...]
TERM_OPERATORS: tuple[str, ...]
NEGATIVE_TERM_OPERATORS: tuple[str, ...]
DOMAIN_OPERATORS_NEGATION: dict[str, str]
TERM_OPERATORS_NEGATION: dict[str, str]
WILDCARD_OPERATORS: tuple[str, ...]
ANY_IN: dict[str, str]
TRUE_LEAF: tuple
FALSE_LEAF: tuple
TRUE_DOMAIN: list[tuple]
FALSE_DOMAIN: list[tuple]
SQL_OPERATORS: dict[str, SQL]
def normalize_domain(domain: list) -> list: ...
def is_false(model, domain: list) -> bool: ...
def combine(operator: str, unit, zero, domains: list[list]) -> list: ...
def AND(domains: list[list]) -> list: ...
def OR(domains: list[list]) -> list: ...
def distribute_not(domain: list) -> list: ...
def domain_combine_anies(domain: list, model: BaseModel) -> list: ...
def prettify_domain(domain: list, pre_indent: int = ...) -> str: ...
def normalize_leaf(element): ...
def is_operator(element) -> bool: ...
def is_leaf(element) -> bool: ...
def is_boolean(element) -> bool: ...
def check_leaf(element) -> None: ...
def get_unaccent_wrapper(cr: Cursor) -> Callable[[Any], str]: ...
class expression:
root_model: BaseModel
root_alias: str | None
expression: list
query: Query | None
result: tuple[str, list]
def __init__(
self,
domain: list,
model: BaseModel,
alias: str | None = ...,
query: Query | None = ...,
) -> None: ...
def parse(self): ...

View File

@@ -1,20 +0,0 @@
RELEASE_LEVELS: list[str]
ALPHA: str
BETA: str
RELEASE_CANDIDATE: str
FINAL: str
RELEASE_LEVELS_DISPLAY: dict[str, str]
version_info: tuple
version: str
series: str
serie: str
major_version: str
product_name: str
description: str
long_desc: str
classifiers: str
url: str
author: str
author_email: str
license: str
nt_service_name: str

View File

@@ -1,4 +0,0 @@
from . import common as common
from . import db as db
from . import model as model
from . import server as server

View File

@@ -1,13 +0,0 @@
from logging import Logger
from typing import Any, Literal
RPC_VERSION_1: dict[str, Any]
def exp_login(db: str, login: str, password: str) -> int: ...
def exp_authenticate(
db: str, login: str, password: str, user_agent_env: dict | None
) -> int: ...
def exp_version() -> dict[str, Any]: ...
def exp_about(extended: bool = ...) -> str | tuple[str, str]: ...
def exp_set_loglevel(loglevel, logger: Logger | None = ...) -> Literal[True]: ...
def dispatch(method: str, params): ...

View File

@@ -1,44 +0,0 @@
from functools import wraps as wraps
from typing import IO, Any, Callable, Iterable, Literal, TypeVar
from ..sql_db import Cursor
from ..tools import SQL
_CallableT = TypeVar("_CallableT", bound=Callable)
class DatabaseExists(Warning): ...
def database_identifier(cr: Cursor, name: str) -> SQL: ...
def check_db_management_enabled(method: _CallableT) -> _CallableT: ...
def check_super(passwd: str) -> Literal[True]: ...
def exp_create_database(
db_name: str,
demo: bool,
lang: str,
user_password: str = ...,
login: str = ...,
country_code: str | None = ...,
phone: str | None = ...,
) -> Literal[True]: ...
def exp_duplicate_database(
db_original_name: str, db_name: str, neutralize_database: bool = ...
) -> Literal[True]: ...
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]: ...
def dump_db(db_name: str, stream, backup_format: str = ...) -> IO | None: ...
def exp_restore(db_name: str, data, copy: bool = ...) -> Literal[True]: ...
def restore_db(
db: str, dump_file: str, copy: bool = ..., neutralize_database: bool = ...
) -> None: ...
def exp_rename(old_name: str, new_name: str) -> Literal[True]: ...
def exp_change_admin_password(new_password: str) -> Literal[True]: ...
def exp_migrate_databases(databases: Iterable[str]) -> Literal[True]: ...
def exp_db_exist(db_name: str) -> bool: ...
def list_dbs(force: bool = ...) -> list[str]: ...
def list_db_incompatible(databases: Iterable[str]) -> list[str]: ...
def exp_list(document: bool = ...) -> list[str]: ...
def exp_list_lang() -> list[tuple[str, str]]: ...
def exp_list_countries() -> list[tuple[str, str]]: ...
def exp_server_version() -> str: ...
def dispatch(method: str, params): ...

View File

@@ -1,18 +0,0 @@
from typing import Any, Callable, TypeVar
from ..api import Environment
from ..sql_db import Cursor
_CallableT = TypeVar("_CallableT", bound=Callable)
PG_CONCURRENCY_ERRORS_TO_RETRY: tuple[str, str, str]
PG_CONCURRENCY_EXCEPTIONS_TO_RETRY: tuple[Exception, ...]
MAX_TRIES_ON_CONCURRENCY_FAILURE: int
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 retrying(func: Callable[[], Any], env: Environment): ...

View File

@@ -1,12 +0,0 @@
from typing import Literal
from ..api import Environment
from ..http import Request, Session
def check(db: str, uid: int, passwd: str) -> None: ...
def compute_session_token(
session: Session, env: Environment
) -> str | Literal[False]: ...
def check_session(
session: Session, env: Environment, request: Request | None = ...
) -> bool: ...

View File

@@ -1,193 +0,0 @@
from socket import socket as socket_
from threading import Semaphore, Thread
from typing import Any, Callable, Literal, TypeVar
import werkzeug.serving
from gevent.pywsgi import WSGIServer
from inotify.adapters import InotifyTrees
from psutil import Process
from watchdog.observers import Observer
from ..modules.registry import Registry
from ..sql_db import Cursor
_WorkerT = TypeVar("_WorkerT", bound=Worker)
INOTIFY_LISTEN_EVENTS: Any
SLEEP_INTERVAL: int
def memory_info(process: Process): ...
def set_limit_memory_hard() -> None: ...
def empty_pipe(fd: int) -> None: ...
class LoggingBaseWSGIServerMixIn:
def handle_error(self, request, client_address) -> None: ...
class BaseWSGIServerNoBind(LoggingBaseWSGIServerMixIn, werkzeug.serving.BaseWSGIServer):
def __init__(self, app) -> None: ...
def server_activate(self) -> None: ...
class RequestHandler(werkzeug.serving.WSGIRequestHandler):
def setup(self) -> None: ...
protocol_version: str
def make_environ(self) -> dict[str, Any]: ...
close_connection: bool
def send_header(self, keyword, value) -> None: ...
def end_headers(self, *a, **kw) -> None: ...
class ThreadedWSGIServerReloadable(
LoggingBaseWSGIServerMixIn, werkzeug.serving.ThreadedWSGIServer
):
max_http_threads: Any
http_threads_sem: Semaphore
daemon_threads: bool
def __init__(self, host: str, port: int, app) -> None: ...
reload_socket: bool
socket: socket_
def server_bind(self) -> None: ...
def server_activate(self) -> None: ...
def process_request(self, request, client_address) -> None: ...
def shutdown_request(self, request) -> None: ...
class FSWatcherBase:
def handle_file(self, path: str) -> Literal[True]: ...
class FSWatcherWatchdog(FSWatcherBase):
observer: Observer
def __init__(self) -> None: ...
def dispatch(self, event) -> None: ...
def start(self) -> None: ...
def stop(self) -> None: ...
class FSWatcherInotify(FSWatcherBase):
started: bool
watcher: InotifyTrees
def __init__(self) -> None: ...
def run(self) -> None: ...
thread: Thread
def start(self) -> None: ...
def stop(self) -> None: ...
class CommonServer:
app: Any
interface: str
port: int
pid: int
def __init__(self, app) -> None: ...
def close_socket(self, sock: socket_) -> None: ...
@classmethod
def on_stop(cls, func: Callable) -> None: ...
def stop(self) -> None: ...
class ThreadedServer(CommonServer):
main_thread_id: int | None
quit_signals_received: int
httpd: ThreadedWSGIServerReloadable | None
limits_reached_threads: set[Thread]
limit_reached_time: float | None
def __init__(self, app) -> None: ...
def signal_handler(self, sig, frame) -> None: ...
def process_limit(self) -> None: ...
def cron_thread(self, number) -> None: ...
def cron_spawn(self) -> None: ...
def http_spawn(self) -> None: ...
def start(self, stop: bool = ...): ...
def stop(self) -> None: ...
def run(self, preload: Any | None = ..., stop: bool = ...): ...
def reload(self) -> None: ...
class GeventServer(CommonServer):
port: int
httpd: WSGIServer | None
def __init__(self, app) -> None: ...
def process_limits(self) -> None: ...
ppid: int
def watchdog(self, beat: int = ...) -> None: ...
client_address: Any
response_use_chunked: bool
def start(self): ...
def stop(self) -> None: ...
def run(self, preload, stop: bool) -> None: ...
class PreforkServer(CommonServer):
population: int
timeout: int
limit_request: int
cron_timeout: int
beat: int
socket: socket_ | None
workers_http: dict[int, WorkerHTTP]
workers_cron: dict[int, WorkerCron]
workers: dict[int, Worker]
generation: int
queue: list
long_polling_pid: int | None
def __init__(self, app) -> None: ...
def pipe_new(self) -> tuple[int, int]: ...
def pipe_ping(self, pipe: tuple[int, int]) -> None: ...
def signal_handler(self, sig: int, frame) -> None: ...
def worker_spawn(
self, klass: Callable[..., _WorkerT], workers_registry: dict[int, _WorkerT]
) -> _WorkerT | None: ...
def long_polling_spawn(self) -> None: ...
def worker_pop(self, pid: int) -> None: ...
def worker_kill(self, pid: int, sig: int) -> None: ...
def process_signals(self) -> None: ...
def process_zombie(self) -> None: ...
def process_timeout(self) -> None: ...
def process_spawn(self) -> None: ...
def sleep(self) -> None: ...
pipe: tuple[int, int]
def start(self) -> None: ...
def stop(self, graceful: bool = ...) -> None: ...
def run(self, preload, stop: bool): ...
class Worker:
multi: PreforkServer
watchdog_time: float
watchdog_pipe: tuple[int, int]
eintr_pipe: tuple[int, int]
watchdog_timeout: Any
ppid: int
pid: int | None
alive: bool
request_max: Any
request_count: int
def __init__(self, multi: PreforkServer) -> None: ...
def setproctitle(self, title: str = ...) -> None: ...
def close(self) -> None: ...
def signal_handler(self, sig: int, frame) -> None: ...
def signal_time_expired_handler(self, n, stack) -> None: ...
def sleep(self) -> None: ...
def check_limits(self) -> None: ...
def process_work(self) -> None: ...
def start(self) -> None: ...
def stop(self) -> None: ...
def run(self) -> None: ...
class WorkerHTTP(Worker):
sock_timeout: float
def __init__(self, multi: PreforkServer) -> None: ...
def process_request(self, client: socket_, addr) -> None: ...
def process_work(self) -> None: ...
server: BaseWSGIServerNoBind
def start(self) -> None: ...
class WorkerCron(Worker):
db_index: int
watchdog_timeout: int
def __init__(self, multi: PreforkServer) -> None: ...
def sleep(self) -> None: ...
def process_work(self) -> None: ...
dbcursor: Cursor
def start(self) -> None: ...
def stop(self) -> None: ...
server: CommonServer | None
server_phoenix: bool
def load_server_wide_modules() -> 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 = ...): ...
def restart() -> None: ...

View File

@@ -1,125 +0,0 @@
from datetime import datetime
from re import Pattern
from threading import RLock
from typing import Any, Callable, Iterable, Iterator, NoReturn, TypeVar
import psycopg2.extensions
from .api import Transaction
from .tools import Callbacks
_T = TypeVar("_T")
_CursorT = TypeVar("_CursorT", bound=Cursor)
_SavepointT = TypeVar("_SavepointT", bound=Savepoint)
def undecimalize(symb, cr: Cursor) -> float | None: ...
DECIMAL_TO_FLOAT_TYPE: Any
real_time: Callable
re_from: Pattern
re_into: Pattern
def categorize_query(decoded_query: str) -> tuple[str, Any]: ...
sql_counter: int
MAX_IDLE_TIMEOUT: int
class Savepoint:
name: str
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: ...
class BaseCursor:
precommit: Callbacks
postcommit: Callbacks
prerollback: Callbacks
postrollback: Callbacks
transaction: Transaction | None
def __init__(self) -> None: ...
def execute(self, query, *args, **kwargs): ...
def commit(self): ...
def rollback(self): ...
def close(self): ...
def flush(self) -> None: ...
def clear(self) -> None: ...
def reset(self) -> None: ...
def savepoint(self, flush: bool = ...) -> Savepoint: ...
def __enter__(self: _CursorT) -> _CursorT: ...
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
class Cursor(BaseCursor):
IN_MAX: int
sql_from_log: dict
sql_into_log: dict
sql_log_count: int
dbname: str
cache: dict
def __init__(self, pool: ConnectionPool, dbname: str, dsn: dict) -> None: ...
def dictfetchone(self) -> dict[str, Any] | None: ...
def dictfetchmany(self, size) -> list[dict[str, Any]]: ...
def dictfetchall(self) -> list[dict[str, Any]]: ...
def fetchall(self) -> list[tuple]: ...
def __del__(self) -> None: ...
def mogrify(self, query, params: Any | None = ...) -> str: ...
def execute(self, query, params: Any | None = ..., log_exceptions: bool = ...): ...
def execute_values(
self,
query,
argslist,
template: Any | None = ...,
page_size: int = ...,
fetch: bool = ...,
): ...
def split_for_in_conditions(
self, ids: Iterable[_T], size: int = ...
) -> Iterator[tuple[_T, ...]]: ...
def print_log(self): ...
def close(self): ...
def commit(self): ...
def rollback(self): ...
def __getattr__(self, name: str): ...
@property
def closed(self) -> bool: ...
@property
def readonly(self) -> bool: ...
def now(self) -> datetime: ...
class TestCursor(BaseCursor):
readonly: bool
def __init__(self, cursor: Cursor, lock: RLock, readonly: bool) -> None: ...
def execute(self, *args, **kwargs): ...
def close(self) -> None: ...
def commit(self) -> None: ...
def rollback(self) -> None: ...
def __getattr__(self, name: str): ...
def now(self) -> datetime: ...
class PsycoConnection(psycopg2.extensions.connection): ...
class ConnectionPool:
def __init__(self, maxconn: int = ..., readonly: bool = ...) -> None: ...
@property
def readonly(self) -> bool: ...
def borrow(self, connection_info: dict) -> PsycoConnection: ...
def give_back(
self, connection: PsycoConnection, keep_in_pool: bool = ...
) -> None: ...
def close_all(self, dsn: dict | None = ...) -> None: ...
class Connection:
def __init__(self, pool: ConnectionPool, dbname: str, dsn: dict) -> None: ...
@property
def dsn(self) -> dict: ...
@property
def dbname(self) -> str: ...
def cursor(self) -> Cursor: ...
def __bool__(self) -> NoReturn: ...
def connection_info_for(db_or_uri: str, readonly: bool = ...) -> tuple[str, dict]: ...
def db_connect(to: str, allow_uri: bool = ..., readonly: bool = ...) -> Connection: ...
def close_db(db_name: str) -> None: ...
def close_all() -> None: ...

View File

@@ -1,5 +0,0 @@
from . import common as common
from .common import *
from .form import Form as Form
from .form import M2MProxy as M2MProxy
from .form import O2MProxy as O2MProxy

View File

@@ -1,16 +0,0 @@
from collections.abc import Generator
from unittest import TestCase as _TestCase
class TestCase(_TestCase):
__unittest_skip__: bool
__unittest_skip_why__: str
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 run(self, result): ...
def doCleanups(self) -> None: ...
@classmethod
def doClassCleanups(cls) -> None: ...

View File

@@ -1,287 +0,0 @@
import collections
from concurrent.futures import Future
from contextlib import contextmanager
from itertools import count
from subprocess import Popen
from typing import Any, Callable, Generator, Iterable, Mapping, Match, TypeVar
from xmlrpc import client as xmlrpclib
import requests
from freezegun.api import _freeze_time
from odoo.addons.base.models.res_currency import Currency
from odoo.addons.base.models.res_users import Users
from urllib3.util import Url
from websocket import WebSocket
from ..api import Environment
from ..http import Session
from ..models import BaseModel
from ..modules.registry import Registry
from ..sql_db import BaseCursor, Cursor
from ..tools import mute_logger, profiler
from ..tools._vendor.sessions import Session
from ..tools.profiler import Profiler
from . import case
from .form import Form as Form
from .result import OdooTestResult
_T = TypeVar("_T")
_CallableT = TypeVar("_CallableT", bound=Callable)
InvalidStateError = Any
ADDONS_PATH: str
HOST: str
ADMIN_USER_ID: int
CHECK_BROWSER_SLEEP: float
CHECK_BROWSER_ITERATIONS: int
BROWSER_WAIT: float
DEFAULT_SUCCESS_SIGNAL: str
def get_db_name() -> str: ...
standalone_tests: collections.defaultdict[str, list]
def standalone(*tags: str) -> Callable[[_CallableT], _CallableT]: ...
def test_xsd(url: str | None = ..., path: str | None = ..., skip: bool = ...): ...
DB: str
def new_test_user(
env: Environment,
login: str = ...,
groups: str = ...,
context: dict | None = ...,
**kwargs
) -> Users: ...
def loaded_demo_data(env: Environment) -> bool: ...
class RecordCapturer:
def __init__(self, model: BaseModel, domain: list) -> None: ...
def __enter__(self: _T) -> _T: ...
def __exit__(self, exc_type, exc_value, exc_traceback) -> None: ...
@property
def records(self) -> BaseModel: ...
class MetaCase(type):
def __init__(cls, name, bases, attrs) -> None: ...
class BlockedRequest(requests.exceptions.ConnectionError): ...
class BaseCase(case.TestCase, metaclass=MetaCase):
registry: Registry
env: Environment
cr: Cursor
longMessage: bool
warm: bool
def __init__(self, methodName: str = ...) -> None: ...
def run(self, result: OdooTestResult) -> None: ...
def cursor(self) -> Cursor: ...
@property
def uid(self) -> int: ...
@uid.setter
def uid(self, user) -> None: ...
def ref(self, xid: str) -> int: ...
def browse_ref(self, xid: str) -> BaseModel | None: ...
def patch(self, obj, key, val) -> None: ...
@classmethod
def classPatch(cls, obj, key, val) -> None: ...
def startPatcher(self, patcher): ...
@classmethod
def startClassPatcher(cls, patcher): ...
def with_user(self, login: str) -> None: ...
def debug_mode(self) -> Generator[None, None, None]: ...
@contextmanager
def assertRaises(
self, exception, func: Any | None = ..., *args, **kwargs
) -> Generator[Any, None, None] | None: ...
@contextmanager
def assertQueries(
self, expected, flush: bool = ...
) -> Generator[list, None, None]: ...
@contextmanager
def assertQueriesContain(
self, expected, flush: bool = ...
) -> Generator[list, None, None]: ...
@contextmanager
def assertQueryCount(
self, default: int = ..., flush: bool = ..., **counters
) -> Generator[None, None, None]: ...
def assertRecordValues(
self,
records: BaseModel,
expected_values: list[dict[str, Any]],
*,
field_names: Iterable[str] | None = ...
) -> 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) -> None: ...
def assertHTMLEqual(self, original: str, expected: str) -> None: ...
profile_session: str
def profile(self, description: str = ..., **kwargs) -> Profiler: ...
class Like:
pattern: str
regex: str
def __init__(self, pattern) -> None: ...
class Approx:
value: float
decorate: bool
cmp: Callable
def __init__(
self, value: float, rounding: int | float | Currency, decorate: bool
) -> None: ...
def __repr__(self) -> str: ...
def __eq__(self, other: object) -> bool | NotImplemented: ...
savepoint_seq: count[int]
class TransactionCase(BaseCase):
registry: Registry
env: Environment
cr: Cursor
muted_registry_logger: mute_logger
freeze_time: Any
@classmethod
def setUpClass(cls) -> None: ...
def setUp(self) -> None: ...
class SingleTransactionCase(BaseCase):
@classmethod
def __init_subclass__(cls) -> None: ...
@classmethod
def setUpClass(cls) -> None: ...
def setUp(self) -> None: ...
class ChromeBrowserException(Exception): ...
def run(gen_func) -> None: ...
def save_test_file(
test_name: str,
content,
prefix: str,
extension: str = ...,
logger=...,
document_type: str = ...,
date_format: str = ...,
) -> None: ...
class ChromeBrowser:
remote_debugging_port: int
test_case: HttpCase
success_signal: str
chrome: Popen
devtools_port: int | None
ws: WebSocket | None
user_data_dir: str
screencasts_dir: str | None
screencast_frames: list
sigxcpu_handler: Any
error_checker: Any
had_failure: bool
def __init__(
self,
test_case: HttpCase,
success_signal: str,
headless: bool = ...,
debug: bool = ...,
) -> None: ...
@property
def screencasts_frames_dir(self) -> str: ...
def signal_handler(self, sig, frame) -> None: ...
def stop(self) -> None: ...
@property
def executable(self) -> str | None: ...
def take_screenshot(self, prefix: str = ...) -> Future: ...
def start_screencast(self) -> None: ...
def stop_screencast(self) -> None: ...
def set_cookie(self, name: str, value, path, domain) -> None: ...
def delete_cookie(self, name: str, **kwargs) -> None: ...
def navigate_to(self, url: str, wait_stop: bool = ...) -> None: ...
LINE_PATTERN: str
def console_formatter(self, args: list) -> Callable[[Match[str]], str]: ...
class Opener(requests.Session):
cr: BaseCursor
def __init__(self, cr: BaseCursor) -> None: ...
def request(self, *args, **kwargs): ...
class Transport(xmlrpclib.Transport):
cr: BaseCursor
def __init__(self, cr: BaseCursor) -> None: ...
def request(self, *args, **kwargs): ...
class JsonRpcException(Exception):
code: Any
def __init__(self, code, message) -> None: ...
class HttpCase(TransactionCase):
registry_test_mode: bool
browser: ChromeBrowser | None
browser_size: str
touch_enabled: bool
allow_end_on_form: bool
@classmethod
def setUpClass(cls) -> None: ...
@classmethod
def base_url(cls) -> str: ...
@classmethod
def http_port(cls) -> int | None: ...
xmlrpc_common: xmlrpclib.ServerProxy
xmlrpc_db: xmlrpclib.ServerProxy
xmlrpc_object: xmlrpclib.ServerProxy
opener: Opener
def setUp(self) -> None: ...
def parse_http_location(self, location: str) -> Url: ...
def assertURLEqual(
self, test_url: str, truth_url: str, message: str | None = ...
) -> None: ...
def url_open(
self,
url: str,
data: Any | None = ...,
files: Mapping | None = ...,
timeout: int = ...,
headers: Mapping | None = ...,
allow_redirects: bool = ...,
head: bool = ...,
) -> requests.Response: ...
def logout(self, keep_db: bool = ...) -> None: ...
session: Session
def authenticate(self, user, password, browser: ChromeBrowser = ...) -> Session: ...
def browser_js(
self,
url_path: str,
code: str,
ready: str = ...,
login: str | None = ...,
timeout: int = ...,
cookies: Any | None = ...,
error_checker: Any | None = ...,
watch: bool = ...,
success_signal: str = ...,
debug: bool = ...,
**kw
) -> None: ...
def start_tour(
self, url_path: str, tour_name: str, step_delay: float | None = ..., **kwargs
) -> None: ...
def profile(self, **kwargs) -> profiler.Nested: ...
def make_jsonrpc_request(
self, route: str, params: dict | None = ..., headers: dict | None = ...
): ...
def no_retry(arg: _T) -> _T: ...
def users(*logins: str) -> Callable[[_CallableT], _CallableT]: ...
def warmup(func: _CallableT, *args, **kwargs) -> _CallableT: ...
def can_import(module: str) -> bool: ...
def tagged(*tags: str) -> Callable[[_CallableT], _CallableT]: ...
class freeze_time:
freezer: _freeze_time | None
time_to_freeze: Any
def __init__(self, time_to_freeze) -> None: ...
def __call__(self, func): ...
def __enter__(self): ...
def __exit__(self, *args) -> None: ...

View File

@@ -1,87 +0,0 @@
import collections
from typing import Any, Generic, Iterable, Iterator, TypeVar
from ..api import Environment
from ..models import BaseModel
_ModelT = TypeVar("_ModelT", bound=BaseModel)
_FormT = TypeVar("_FormT", bound=Form)
MODIFIER_ALIASES: dict
class Form(Generic[_ModelT]):
def __init__(self, record: _ModelT, view: Any | None = ...) -> None: ...
@classmethod
def from_action(cls, env: Environment, action: dict) -> Form: ...
def __getattr__(self, field_name: str): ...
def __getitem__(self, field_name: str): ...
def __setattr__(self, field_name: str, value) -> None: ...
def __setitem__(self, field_name: str, value): ...
def __enter__(self: _FormT) -> _FormT: ...
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
def save(self) -> _ModelT: ...
@property
def record(self) -> _ModelT: ...
class O2MForm(Form):
def __init__(self, proxy: O2MProxy, index: int | None = ...) -> None: ...
def save(self) -> None: ...
class UpdateDict(dict):
def __init__(self, *args, **kwargs) -> None: ...
def __repr__(self) -> str: ...
def changed_items(self) -> Iterator[tuple]: ...
def update(self, *args, **kw) -> None: ...
def clear(self) -> None: ...
class X2MValue(collections.abc.Sequence):
def __init__(self, iterable_of_vals: Iterable = ...) -> None: ...
def __repr__(self) -> str: ...
def __contains__(self, id_) -> bool: ...
def __getitem__(self, index): ...
def __iter__(self) -> Iterator: ...
def __len__(self) -> int: ...
def __eq__(self, other) -> bool: ...
def get_vals(self, id_): ...
def add(self, id_, vals) -> None: ...
def remove(self, id_) -> None: ...
def clear(self) -> None: ...
def create(self, vals) -> None: ...
def update(self, id_, changes, changed=...) -> None: ...
def to_list_of_vals(self) -> list: ...
class O2MValue(X2MValue):
def __init__(self, iterable_of_vals: Iterable = ...) -> None: ...
def to_commands(self, convert_values=...) -> list: ...
class M2MValue(X2MValue):
def __init__(self, iterable_of_vals: Iterable = ...) -> None: ...
def to_commands(self) -> list: ...
class X2MProxy:
def __init__(self, form: Form, field_name: str) -> None: ...
@property
def ids(self) -> list: ...
class O2MProxy(X2MProxy):
def __len__(self) -> int: ...
def new(self) -> O2MForm: ...
def edit(self, index: int) -> O2MForm: ...
def remove(self, index: int) -> None: ...
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 add(self, record: BaseModel) -> None: ...
def remove(self, id: int | None = ..., index: int | None = ...) -> None: ...
def set(self, records: BaseModel) -> None: ...
def clear(self) -> None: ...
def convert_read_to_form(values: dict, fields: dict) -> dict: ...
def get_static_context(context_str: str) -> dict: ...
class Dotter:
def __init__(self, values) -> None: ...
def __getattr__(self, key): ...

View File

@@ -1,9 +0,0 @@
from typing import Iterator
from .result import OdooTestResult
from .suite import OdooSuite
def get_module_test_cases(module) -> Iterator: ...
def get_test_modules(module: str) -> list: ...
def make_suite(module_names: list[str], position: str = ...) -> OdooSuite: ...
def run_suite(suite: OdooSuite) -> OdooTestResult: ...

View File

@@ -1,56 +0,0 @@
from collections.abc import Generator
from logging import Logger
from typing import Any, NamedTuple
STDOUT_LINE: str
STDERR_LINE: str
stats_logger: Logger
class Stat(NamedTuple):
time: float
queries: int
def __add__(self, other: Stat) -> Stat: ...
class OdooTestResult:
failures_count: int
errors_count: int
testsRun: int
skipped: int
tb_locals: bool
time_start: float | None
queries_start: int | None
had_failure: bool
stats: dict[str, Stat]
def __init__(
self,
stream: Any | None = ...,
descriptions: Any | None = ...,
verbosity: Any | None = ...,
) -> None: ...
def printErrors(self) -> None: ...
def startTest(self, test) -> None: ...
def stopTest(self, test) -> None: ...
def addError(self, test, err) -> None: ...
def addFailure(self, test, err) -> None: ...
def addSubTest(self, test, subtest, err) -> None: ...
def addSuccess(self, test) -> None: ...
def addSkip(self, test, reason) -> None: ...
def wasSuccessful(self) -> bool: ...
def soft_fail(self) -> Generator[None, None, None]: ...
def update(self, other) -> None: ...
def log(
self,
level,
msg,
*args,
test: Any | None = ...,
exc_info: Any | None = ...,
extra: Any | None = ...,
stack_info: bool = ...,
caller_infos: Any | None = ...
) -> None: ...
def log_stats(self) -> None: ...
def getDescription(self, test) -> str: ...
def collectStats(self, test_id) -> Generator[None, None, None]: ...
def logError(self, flavour, test, error) -> None: ...
def getErrorCallerInfo(self, error, test) -> tuple | None: ...

View File

@@ -1,7 +0,0 @@
from unittest import BaseTestSuite
class TestSuite(BaseTestSuite):
def run(self, result, debug: bool = ...): ...
class OdooSuite(TestSuite):
def has_http_case(self) -> bool: ...

View File

@@ -1,8 +0,0 @@
from re import Pattern
class TagsSelector:
filter_spec_re: Pattern
exclude: set
include: set
def __init__(self, spec: str) -> None: ...
def check(self, test) -> bool: ...

View File

@@ -1,39 +0,0 @@
from . import appdirs as appdirs
from . import cloc as cloc
from . import constants as constants
from . import osutil as osutil
from . import pdf as pdf
from . import pycompat as pycompat
from . import template_inheritance as template_inheritance
from .barcode import check_barcode_encoding as check_barcode_encoding
from .cache import ormcache as ormcache
from .cache import ormcache_context as ormcache_context
from .config import config as config
from .convert import convert_csv_import as convert_csv_import
from .convert import convert_file as convert_file
from .convert import convert_sql_import as convert_sql_import
from .convert import convert_xml_import as convert_xml_import
from .date_utils import *
from .float_utils import *
from .func import *
from .i18n import format_list as format_list
from .image import image_process as image_process
from .js_transpiler import ODOO_MODULE_RE as ODOO_MODULE_RE
from .js_transpiler import URL_RE as URL_RE
from .js_transpiler import is_odoo_module as is_odoo_module
from .js_transpiler import transpile_javascript as transpile_javascript
from .json import json_default as json_default
from .mail import *
from .misc import *
from .parse_version import parse_version as parse_version
from .query import Query as Query
from .set_expression import SetDefinitions as SetDefinitions
from .sourcemap_generator import SourceMapGenerator as SourceMapGenerator
from .sql import *
from .translate import LazyTranslate as LazyTranslate
from .translate import _ as _
from .translate import html_translate as html_translate
from .translate import xml_translate as xml_translate
from .xml_utils import cleanup_xml_node as cleanup_xml_node
from .xml_utils import load_xsd_files_from_url as load_xsd_files_from_url
from .xml_utils import validate_xml_from_attachment as validate_xml_from_attachment

View File

@@ -1,20 +0,0 @@
from datetime import datetime
from os import PathLike
from typing import IO, Callable
from werkzeug import Response
def send_file(
path_or_file: PathLike | str | IO[bytes],
environ: dict,
mimetype: str | None = ...,
as_attachment: bool = ...,
download_name: str | None = ...,
conditional: bool = ...,
etag: bool | str = ...,
last_modified: datetime | int | float | None = ...,
max_age: int | Callable[[str | None], int | None] | None = ...,
use_x_sendfile: bool = ...,
response_class: type[Response] = ...,
_root_path: PathLike | str | None = ...,
) -> Response: ...

View File

@@ -1,53 +0,0 @@
from typing import Any, Generic, TypeVar
from werkzeug.datastructures import CallbackDict
_ModificationTrackingDictT = TypeVar(
"_ModificationTrackingDictT", bound=ModificationTrackingDict
)
_SessionT = TypeVar("_SessionT", bound=Session)
def generate_key(salt: Any = ...) -> str: ...
class ModificationTrackingDict(CallbackDict):
modified: bool
def __init__(self, *args, **kwargs): ...
def copy(self: _ModificationTrackingDictT) -> _ModificationTrackingDictT: ...
def __copy__(self: _ModificationTrackingDictT) -> _ModificationTrackingDictT: ...
class Session(ModificationTrackingDict):
sid: str
new: bool
def __init__(self, data, sid, new: bool = ...): ...
@property
def should_save(self) -> bool: ...
class SessionStore(Generic[_SessionT]):
session_class: type[_SessionT]
def __init__(self, session_class: type[_SessionT] | None = ...): ...
def is_valid_key(self, key) -> bool: ...
def generate_key(self, salt: Any = ...) -> str: ...
def new(self) -> _SessionT: ...
def save(self, session: _SessionT) -> None: ...
def save_if_modified(self, session: _SessionT) -> None: ...
def delete(self, session: _SessionT) -> None: ...
def get(self, sid: str) -> _SessionT: ...
class FilesystemSessionStore(SessionStore[_SessionT]):
path: str | None
filename_template: str
renew_missing: bool
mode: int
def __init__(
self,
path: str | None = ...,
filename_template: str = ...,
session_class: type[_SessionT] | None = ...,
renew_missing: bool = ...,
mode: int = ...,
) -> None: ...
def get_session_filename(self, sid: str) -> str: ...
def save(self, session: _SessionT) -> None: ...
def delete(self, session: _SessionT) -> None: ...
def get(self, sid: str) -> _SessionT: ...
def list(self) -> list[str]: ...

View File

@@ -1,20 +0,0 @@
from re import Pattern
class UserAgentParser(object):
platforms: list[tuple[str, Pattern]]
browsers: list[tuple[str, Pattern]]
def __init__(self) -> None: ...
def __call__(
self, user_agent: str
) -> tuple[str | None, str | None, str | None, str | None]: ...
class UserAgent(object):
string: str
platform: str | None
browser: str | None
version: str | None
language: str | None
def __init__(self, environ_or_string: dict | str): ...
def to_header(self) -> str: ...
def __nonzero__(self) -> bool: ...
__bool__ = __nonzero__

View File

@@ -1,65 +0,0 @@
__version_info__: tuple
def user_data_dir(
appname: str | None = ...,
appauthor: str | None = ...,
version: str | None = ...,
roaming: bool = ...,
) -> str: ...
def site_data_dir(
appname: str | None = ...,
appauthor: str | None = ...,
version: str | None = ...,
multipath: bool = ...,
) -> str: ...
def user_config_dir(
appname: str | None = ...,
appauthor: str | None = ...,
version: str | None = ...,
roaming: bool = ...,
) -> str: ...
def site_config_dir(
appname: str | None = ...,
appauthor: str | None = ...,
version: str | None = ...,
multipath: bool = ...,
) -> str: ...
def user_cache_dir(
appname: str | None = ...,
appauthor: str | None = ...,
version: str | None = ...,
opinion: bool = ...,
) -> str: ...
def user_log_dir(
appname: str | None = ...,
appauthor: str | None = ...,
version: str | None = ...,
opinion: bool = ...,
) -> str: ...
class AppDirs:
appname: str
appauthor: str | None
version: str | None
roaming: bool
multipath: bool
def __init__(
self,
appname: str,
appauthor: str | None = ...,
version: str | None = ...,
roaming: bool = ...,
multipath: bool = ...,
) -> None: ...
@property
def user_data_dir(self) -> str: ...
@property
def site_data_dir(self) -> str: ...
@property
def user_config_dir(self) -> str: ...
@property
def site_config_dir(self) -> str: ...
@property
def user_cache_dir(self) -> str: ...
@property
def user_log_dir(self) -> str: ...

View File

@@ -1,2 +0,0 @@
def get_barcode_check_digit(numeric_barcode: str) -> int: ...
def check_barcode_encoding(barcode: str, encoding: str) -> bool: ...

View File

@@ -1,48 +0,0 @@
from collections import defaultdict
from typing import Any, Callable, TypeVar
from ..models import BaseModel
from .lru import LRU
_CallableT = TypeVar("_CallableT")
unsafe_eval = eval
class ormcache_counter:
hit: int
miss: int
err: int
gen_time: int
cache_name: Any
def __init__(self) -> None: ...
@property
def ratio(self) -> float: ...
STAT: defaultdict[Any, ormcache_counter]
class ormcache:
args: Any
skiparg: Any
cache_name: str
def __init__(self, *args, **kwargs) -> None: ...
method: Callable
def __call__(self, method: _CallableT) -> _CallableT: ...
def add_value(self, *args, cache_value: Any | None = ..., **kwargs) -> None: ...
key: Any
def determine_key(self): ...
def lru(
self, model: BaseModel
) -> tuple[LRU, tuple[str, Callable], ormcache_counter]: ...
def lookup(self, method: Callable, *args, **kwargs): ...
def clear(self, model: BaseModel, *args) -> None: ...
class ormcache_context(ormcache):
keys: Any
def __init__(self, *args, **kwargs) -> None: ...
key: Any
def determine_key(self) -> None: ...
def log_ormcache_stats(sig: Any | None = ..., frame: Any | None = ...): ...
def get_cache_key_counter(bound_method, *args, **kwargs): ...
cache = ormcache

View File

@@ -1,39 +0,0 @@
from typing import Any
from ..api import Environment
VERSION: int
DEFAULT_EXCLUDE: list[str]
STANDARD_MODULES: list[str]
MAX_FILE_SIZE: int
MAX_LINE_SIZE: int
VALID_EXTENSION: list[str]
class Cloc:
modules: dict
code: dict
total: dict
errors: dict
excluded: dict
max_width: int
def __init__(self) -> None: ...
def parse_c_like(self, s: str, regex: str) -> tuple[int, int]: ...
def parse_xml(self, s: str) -> tuple[int, int]: ...
def parse_py(self, s: str) -> tuple[int, int]: ...
def parse_js(self, s: str) -> tuple[int, int]: ...
def parse_scss(self, s: str) -> tuple[int, int]: ...
def parse_css(self, s: str) -> tuple[int, int]: ...
def parse(self, s: str, ext: str) -> tuple[int, int]: ...
def book(
self,
module: str,
item: str = ...,
count: tuple[Any, Any] = ...,
exclude: bool = ...,
) -> None: ...
def count_path(self, path: str, exclude: set[str] | None = ...) -> None: ...
def count_modules(self, env: Environment) -> None: ...
def count_customization(self, env: Environment) -> None: ...
def count_env(self, env: Environment) -> None: ...
def count_database(self, database) -> None: ...
def report(self, verbose: bool = ..., width: float | None = ...): ...

View File

@@ -1,40 +0,0 @@
from optparse import Option, OptionParser
from typing import Any
from passlib.context import CryptContext
crypt_context: CryptContext
class MyOption(Option):
my_default: Any
def __init__(self, *opts, **attrs) -> None: ...
DEFAULT_LOG_HANDLER: str
class configmanager:
options: dict[str, Any]
blacklist_for_save: set[str]
casts: dict
misc: dict
config_file: str
parser: OptionParser
def __init__(self, fname: str | None = ...) -> None: ...
def parse_config(
self, args: list[str] | None = ..., *, setup_logging: bool | None = ...
) -> None: ...
def load(self) -> None: ...
def save(self, keys: Any | None = ...) -> None: ...
def get(self, key, default: Any | None = ...): ...
def pop(self, key, default: Any | None = ...): ...
def get_misc(self, sect, key, default: Any | None = ...): ...
def __setitem__(self, key, value) -> None: ...
def __getitem__(self, key): ...
@property
def addons_data_dir(self) -> str: ...
@property
def session_dir(self) -> str: ...
def filestore(self, dbname: str) -> str: ...
def set_admin_password(self, new_password) -> None: ...
def verify_admin_password(self, password) -> bool: ...
config: configmanager

View File

@@ -1,6 +0,0 @@
SCRIPT_EXTENSIONS: tuple[str, ...]
STYLE_EXTENSIONS: tuple[str, ...]
TEMPLATE_EXTENSIONS: tuple[str, ...]
ASSET_EXTENSIONS: tuple[str, ...]
SUPPORTED_DEBUGGER: set[str]
EXTERNAL_ASSET: object

View File

@@ -1,74 +0,0 @@
from io import BufferedReader
from typing import Any, Callable, TextIO
from lxml.etree import _Element
from ..api import Environment
def safe_eval(expr, ctx: dict = ...): ...
class ParseError(Exception): ...
def str2bool(value) -> bool: ...
def nodeattr2bool(node: _Element, attr, default: bool = ...) -> bool: ...
class xml_import:
def get_env(
self, node: _Element, eval_context: dict | None = ...
) -> Environment: ...
def make_xml_id(self, xml_id: str) -> str: ...
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]: ...
@property
def env(self) -> Environment: ...
@property
def noupdate(self) -> bool: ...
def next_sequence(self) -> int: ...
mode: str
module: str
envs: list[Environment]
idref: dict
xml_filename: str
def __init__(
self,
env: Environment,
module: str,
idref: dict,
mode: str,
noupdate: bool = ...,
xml_filename: str | None = ...,
) -> None: ...
def parse(self, de: _Element) -> None: ...
DATA_ROOTS: list[str]
def convert_file(
env: Environment,
module: str,
filename: str,
idref: dict,
mode: str = ...,
noupdate: bool = ...,
kind: str | None = ...,
pathname: str | None = ...,
) -> None: ...
def convert_sql_import(env: Environment, fp: TextIO) -> None: ...
def convert_csv_import(
env: Environment,
module: str,
fname: str,
csvcontent: bytes,
idref: dict | None = ...,
mode: str = ...,
noupdate: bool = ...,
) -> None: ...
def convert_xml_import(
env: Environment,
module: str,
xmlfile: str | BufferedReader,
idref: dict | None = ...,
mode: str = ...,
noupdate: bool = ...,
report: Any | None = ...,
) -> None: ...

View File

@@ -1,30 +0,0 @@
import datetime
from typing import Iterator, Literal, Tuple, TypeVar
import babel
from dateutil.relativedelta import relativedelta
_DateTimeT = TypeVar("_DateTimeT", datetime.date, datetime.datetime)
def date_type(value: _DateTimeT) -> type[_DateTimeT]: ...
def get_month(date: _DateTimeT) -> Tuple[_DateTimeT, _DateTimeT]: ...
def get_quarter_number(date: _DateTimeT) -> int: ...
def get_quarter(date: _DateTimeT) -> Tuple[_DateTimeT, _DateTimeT]: ...
def get_fiscal_year(
date: _DateTimeT, day: int = ..., month: int = ...
) -> Tuple[_DateTimeT, _DateTimeT]: ...
def get_timedelta(
qty: int, granularity: Literal["hour", "day", "week", "month", "year"]
) -> relativedelta: ...
Granularity = Literal["year", "quarter", "month", "week", "day", "hour"]
def start_of(value: _DateTimeT, granularity: Granularity) -> _DateTimeT: ...
def end_of(value: _DateTimeT, granularity: Granularity) -> _DateTimeT: ...
def add(value: _DateTimeT, *args, **kwargs) -> _DateTimeT: ...
def subtract(value: _DateTimeT, *args, **kwargs) -> _DateTimeT: ...
def json_default(obj) -> str: ...
def date_range(
start: datetime.datetime, end: datetime.datetime, step: relativedelta = ...
) -> Iterator[datetime.datetime]: ...
def weeknumber(locale: babel.Locale, date: datetime.date) -> Tuple[int, int]: ...

View File

@@ -1,25 +0,0 @@
def round(f: float) -> float: ...
def float_round(
value: float,
precision_digits: int | None = ...,
precision_rounding: float | None = ...,
rounding_method: str = ...,
) -> float: ...
def float_is_zero(
value: float,
precision_digits: int | None = ...,
precision_rounding: float | None = ...,
) -> bool: ...
def float_compare(
value1: float,
value2: float,
precision_digits: int | None = ...,
precision_rounding: float | None = ...,
) -> int: ...
def float_repr(value: float, precision_digits: int) -> str: ...
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(
value: float, precision_digits: int, rounding_method: str = ...
) -> float: ...
def float_invert(value: float) -> float: ...

View File

@@ -1,118 +0,0 @@
from typing import Any, Callable, Generic, TypeVar, overload
_T = TypeVar("_T")
class lazy_property(Generic[_T]):
fget: Callable[[Any], _T]
def __init__(self, fget: Callable[[Any], _T]) -> None: ...
@overload
def __get__(self, obj: None, cls: Any) -> Any: ...
@overload
def __get__(self, obj: object, cls: Any) -> _T: ...
@property
def __doc__(self): ...
@staticmethod
def reset_all(obj) -> None: ...
def conditional(condition, decorator): ...
def filter_kwargs(func: Callable, kwargs: dict[str, Any]) -> dict[str, Any]: ...
def synchronized(lock_attr: str = ...) -> Callable[[_T], _T]: ...
locked: Callable[[_T], _T]
def frame_codeinfo(fframe, back: int = ...) -> tuple[str | None, str | None]: ...
class classproperty(Generic[_T]):
fget: ...
def __init__(self, fget: Callable[[Any], _T]) -> None: ...
def __get__(self, cls, owner: type | None = ...) -> _T: ...
@property
def __doc__(self): ...
class lazy_classproperty(classproperty[_T], Generic[_T]):
def __get__(self, cls, owner: type | None = ...) -> _T: ...
class lazy:
def __init__(self, func, *args, **kwargs) -> None: ...
def __getattr__(self, name): ...
def __setattr__(self, name, value): ...
def __delattr__(self, name): ...
def __bytes__(self): ...
def __format__(self, format_spec): ...
def __lt__(self, other): ...
def __le__(self, other): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __gt__(self, other): ...
def __ge__(self, other): ...
def __hash__(self): ...
def __bool__(self): ...
def __call__(self, *args, **kwargs): ...
def __len__(self): ...
def __getitem__(self, key): ...
def __missing__(self, key): ...
def __setitem__(self, key, value) -> None: ...
def __delitem__(self, key) -> None: ...
def __iter__(self): ...
def __reversed__(self): ...
def __contains__(self, key): ...
def __add__(self, other): ...
def __sub__(self, other): ...
def __mul__(self, other): ...
def __matmul__(self, other): ...
def __truediv__(self, other): ...
def __floordiv__(self, other): ...
def __mod__(self, other): ...
def __divmod__(self, other): ...
def __pow__(self, other): ...
def __lshift__(self, other): ...
def __rshift__(self, other): ...
def __and__(self, other): ...
def __xor__(self, other): ...
def __or__(self, other): ...
def __radd__(self, other): ...
def __rsub__(self, other): ...
def __rmul__(self, other): ...
def __rmatmul__(self, other): ...
def __rtruediv__(self, other): ...
def __rfloordiv__(self, other): ...
def __rmod__(self, other): ...
def __rdivmod__(self, other): ...
def __rpow__(self, other): ...
def __rlshift__(self, other): ...
def __rrshift__(self, other): ...
def __rand__(self, other): ...
def __rxor__(self, other): ...
def __ror__(self, other): ...
def __iadd__(self, other): ...
def __isub__(self, other): ...
def __imul__(self, other): ...
def __imatmul__(self, other): ...
def __itruediv__(self, other): ...
def __ifloordiv__(self, other): ...
def __imod__(self, other): ...
def __ipow__(self, other): ...
def __ilshift__(self, other): ...
def __irshift__(self, other): ...
def __iand__(self, other): ...
def __ixor__(self, other): ...
def __ior__(self, other): ...
def __neg__(self): ...
def __pos__(self): ...
def __abs__(self): ...
def __invert__(self): ...
def __complex__(self): ...
def __int__(self): ...
def __float__(self): ...
def __index__(self): ...
def __round__(self): ...
def __trunc__(self): ...
def __floor__(self): ...
def __ceil__(self): ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_value, traceback): ...
def __await__(self): ...
def __aiter__(self): ...
def __anext__(self): ...
def __aenter__(self): ...
def __aexit__(self, exc_type, exc_value, traceback): ...

View File

@@ -1,22 +0,0 @@
from re import Pattern
from typing import Literal, Sequence
from ..api import Environment
XPG_LOCALE_RE: Pattern
def format_list(
env: Environment,
lst: Sequence[str],
style: Literal[
"standard",
"standard-short",
"or",
"or-short",
"unit",
"unit-short",
"unit-narrow",
] = ...,
lang_code: str | None = ...,
) -> str: ...
def py_to_js_locale(locale: str) -> str: ...

View File

@@ -1,59 +0,0 @@
from typing import Any, Iterable, Literal
from PIL import IcoImagePlugin as IcoImagePlugin
from PIL import ImageOps as ImageOps
from PIL.Image import Image
FILETYPE_BASE64_MAGICWORD: dict[bytes, str]
EXIF_TAG_ORIENTATION: int
EXIF_TAG_ORIENTATION_TO_TRANSPOSE_METHODS: dict[int, list]
IMAGE_MAX_RESOLUTION: float
class ImageProcess:
source: bytes
operationsCount: int
image: Image | Literal[False]
original_format: str
def __init__(self, source: bytes, verify_resolution: bool = ...) -> None: ...
def image_quality(
self, quality: int = ..., output_format: str = ...
) -> bytes | Literal[False]: ...
def resize(
self, max_width: int = ..., max_height: int = ..., expand: bool = ...
) -> ImageProcess: ...
def crop_resize(
self,
max_width: int,
max_height: int,
center_x: float = ...,
center_y: float = ...,
) -> ImageProcess: ...
def colorize(self, color: tuple | None = ...) -> ImageProcess: ...
def add_padding(self, padding: int) -> ImageProcess: ...
def image_process(
source: bytes,
size: tuple[int, int] = ...,
verify_resolution: bool = ...,
quality: int = ...,
expand: bool = ...,
crop: str | None = ...,
colorize: bool = ...,
output_format: str = ...,
) -> bytes: ...
def average_dominant_color(
colors: list[tuple[Any, Any]], mitigate: int = ..., max_margin: int = ...
) -> tuple[Any, Any]: ...
def image_fix_orientation(image: Image) -> Image: ...
def binary_to_image(source: bytes) -> Image: ...
def base64_to_image(base64_source: str | bytes) -> Image: ...
def image_apply_opt(image: Image, output_format: str, **params) -> bytes: ...
def image_to_base64(image: Image, output_format: str, **params) -> bytes: ...
def get_webp_size(source: bytes) -> tuple[float, float] | None: ...
def is_image_size_above(base64_source_1: bytes, base64_source_2: bytes) -> bool: ...
def image_guess_size_from_field_name(field_name: str) -> tuple[int, int]: ...
def image_data_uri(base64_source: bytes) -> str: ...
def get_saturation(rgb: Iterable[int]) -> float: ...
def get_lightness(rgb: Iterable[int]) -> float: ...
def hex_to_rgb(hx: str) -> tuple[int, int, int]: ...
def rgb_to_hex(rgb: Iterable[int]) -> str: ...

View File

@@ -1,100 +0,0 @@
from re import Pattern
from typing import Iterable, MutableSet
def transpile_javascript(url: str, content: str) -> str: ...
URL_RE: Pattern
def url_to_module_path(url: str) -> str: ...
def wrap_with_qunit_module(url: str, content: str) -> str: ...
def wrap_with_odoo_define(
module_path: str, dependencies: Iterable[str], content: str
) -> str: ...
EXPORT_FCT_RE: Pattern
def convert_export_function(content: str) -> str: ...
EXPORT_CLASS_RE: Pattern
def convert_export_class(content: str) -> str: ...
EXPORT_FCT_DEFAULT_RE: Pattern
def convert_export_function_default(content: str):
str: ...
EXPORT_CLASS_DEFAULT_RE: Pattern
def convert_export_class_default(content: str) -> str: ...
EXPORT_VAR_RE: Pattern
def convert_variable_export(content: str) -> str: ...
EXPORT_DEFAULT_VAR_RE: Pattern
def convert_variable_export_default(content: str) -> str: ...
EXPORT_OBJECT_RE: Pattern
def convert_object_export(content: str) -> str: ...
EXPORT_FROM_RE: Pattern
def convert_from_export(content: str) -> str: ...
EXPORT_STAR_FROM_RE: Pattern
def convert_star_from_export(content: str) -> str: ...
EXPORT_DEFAULT_RE: Pattern
def convert_default_export(content: str) -> str: ...
IMPORT_BASIC_RE: Pattern
def convert_basic_import(content: str) -> str: ...
IMPORT_LEGACY_DEFAULT_RE: Pattern
def convert_legacy_default_import(content: str) -> str: ...
IMPORT_DEFAULT: Pattern
def convert_default_import(content: str) -> str: ...
IS_PATH_LEGACY_RE: Pattern
IMPORT_DEFAULT_AND_NAMED_RE: Pattern
def convert_default_and_named_import(content: str) -> str: ...
RELATIVE_REQUIRE_RE: Pattern
def convert_relative_require(
url: str, dependencies: MutableSet[str], content: str
) -> str: ...
IMPORT_STAR: Pattern
def convert_star_import(content: str) -> str: ...
IMPORT_DEFAULT_AND_STAR: Pattern
def convert_default_and_star_import(content: str) -> str: ...
IMPORT_UNNAMED_RELATIVE_RE: Pattern
def convert_unnamed_relative_import(content: str) -> str: ...
URL_INDEX_RE: Pattern
def remove_index(content: str) -> str: ...
def relative_path_to_module_path(url: str, path_rel: str) -> str: ...
ODOO_MODULE_RE: Pattern
def is_odoo_module(url: str, content: str) -> str: ...
def get_aliased_odoo_define_content(module_path: str, content: str) -> str: ...
def convert_as(val: str) -> list[str] | str: ...
def remove_as(val: str) -> list[str] | str: ...

View File

@@ -1,14 +0,0 @@
from markupsafe import Markup
JSON_SCRIPTSAFE_MAPPER: dict[str, str]
class _ScriptSafe(str):
def __html__(self) -> Markup: ...
class JSON:
def loads(self, *args, **kwargs): ...
def dumps(self, *args, **kwargs) -> _ScriptSafe: ...
scriptsafe: JSON
def json_default(obj): ...

View File

@@ -1,18 +0,0 @@
from collections import OrderedDict
from typing import Generic, Iterable, Iterator, MutableMapping, TypeVar
_K = TypeVar("_K")
_V = TypeVar("_V")
class LRU(MutableMapping[_K, _V], Generic[_K, _V]):
count: int
d: OrderedDict
def __init__(self, count: int, pairs: Iterable[tuple[_K, _V]] = ...) -> None: ...
def __contains__(self, obj: _K) -> bool: ...
def __getitem__(self, obj: _K) -> _V: ...
def __setitem__(self, obj: _K, val: _V): ...
def __delitem__(self, obj: _K): ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_K]: ...
def pop(self, key: _K) -> _V: ...
def clear(self) -> None: ...

View File

@@ -1,70 +0,0 @@
from email.message import Message
from re import Pattern
from typing import Callable, Collection, FrozenSet, Literal
from lxml.etree import _Element
from markupsafe import Markup
safe_attrs: FrozenSet
SANITIZE_TAGS: dict[str, Collection[str]]
def tag_quote(el: _Element) -> None: ...
def html_normalize(
src: str, filter_callback: Callable[[_Element], _Element] | None = ...
) -> str: ...
def html_sanitize(
src: str,
silent: bool = ...,
sanitize_tags: bool = ...,
sanitize_attributes: bool = ...,
sanitize_style: bool = ...,
sanitize_form: bool = ...,
strip_style: bool = ...,
strip_classes: bool = ...,
) -> Markup: ...
URL_SKIP_PROTOCOL_REGEX: str
URL_REGEX: str
TEXT_URL_REGEX: str
HTML_TAG_URL_REGEX: str
HTML_TAGS_REGEX: Pattern
HTML_NEWLINES_REGEX: Pattern
def validate_url(url: str) -> str: ...
def is_html_empty(html_content: str) -> bool: ...
def html_keep_url(text: str) -> str: ...
def html_to_inner_content(html: str) -> str: ...
def html2plaintext(
html: str, body_id: str | None = ..., encoding: str = ...
) -> str: ...
def plaintext2html(text: str, container_tag: str = ...) -> Markup: ...
def append_content_to_html(
html: str,
content: str,
plaintext: bool = ...,
preserve: bool = ...,
container_tag: str = ...,
) -> Markup: ...
def prepend_html_content(html_body: str, html_content: str) -> str: ...
email_re: Pattern
single_email_re: Pattern
mail_header_msgid_re: Pattern
email_addr_escapes_re: Pattern
def generate_tracking_message_id(res_id: str) -> str: ...
def email_split_tuples(text: str) -> list[str]: ...
def email_split(text: str) -> list[str]: ...
def email_split_and_format(text: str) -> list[str]: ...
def email_normalize(text: str, strict: bool = ...) -> str | Literal[False]: ...
def email_normalize_all(text: str) -> list[str]: ...
def email_domain_extract(email: str) -> str | Literal[False]: ...
def email_domain_normalize(domain: str) -> str | Literal[False]: ...
def url_domain_extract(url: str) -> str | Literal[False]: ...
def email_escape_char(email_address: str) -> str: ...
def decode_message_header(
message: Message, header: str, separator: str = ...
) -> str: ...
def formataddr(pair: tuple[str, str], charset: str = ...) -> str: ...
def encapsulate_email(old_email: str, new_email: str) -> str: ...
def parse_contact_from_email(text: str) -> tuple[str, str]: ...

View File

@@ -1,4 +0,0 @@
def guess_mimetype(bin_data: str, default: str | None = ...) -> str: ...
def neuter_mimetype(mimetype: str, user) -> str: ...
def get_extension(filename: str) -> str: ...
def fix_filename_extension(filename: str, mimetype: str) -> str: ...

View File

@@ -1,299 +0,0 @@
import datetime
from collections.abc import Mapping, MutableMapping, MutableSet
from contextlib import ContextDecorator, suppress
from logging import Handler, LogRecord
from re import Pattern
from types import FrameType
from typing import (
IO,
Any,
Callable,
Collection,
Generic,
Iterable,
Iterator,
NoReturn,
Reversible,
Sequence,
TypeVar,
overload,
)
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 LangData
from xlwt import Worksheet
from ..api import Environment
from ..loglevels import exception_to_unicode as exception_to_unicode
from ..loglevels import get_encodings as get_encodings
_T = TypeVar("_T")
_T1 = TypeVar("_T1")
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_CallableT = TypeVar("_CallableT", bound=Callable)
_LowerLoggingT = TypeVar("_LowerLoggingT", bound=lower_logging)
_ReplaceExceptionsT = TypeVar("_ReplaceExceptionsT", bound=replace_exceptions)
SKIPPED_ELEMENT_TYPES: tuple
NON_BREAKING_SPACE: str
def find_in_path(name: str) -> str: ...
def find_pg_tool(name: str) -> str: ...
def exec_pg_environ() -> dict[str, str]: ...
def file_path(
file_path: str, filter_ext: tuple[str, ...] = ..., env: Environment | None = ...
) -> str: ...
def file_open(
name: str,
mode: str = ...,
filter_ext: tuple[str, ...] | None = ...,
env: Environment | None = ...,
) -> IO: ...
def file_open_temporary_directory(env: Environment) -> Iterator[str]: ...
def flatten(list) -> list: ...
def reverse_enumerate(lst: Sequence[_T]) -> Iterator[tuple[int, _T]]: ...
def partition(
pred: Callable[[_T], bool], elems: Iterable[_T]
) -> tuple[list[_T], list[_T]]: ...
def topological_sort(elems: Mapping[_T, Collection[_T]]) -> list[_T]: ...
def merge_sequences(*iterables: Iterable[_T]) -> list[_T]: ...
class PatchedWorkbook(xlwt.Workbook):
def add_sheet(self, name: str, cell_overwrite_ok: bool = ...) -> Worksheet: ...
class PatchedXlsxWorkbook(xlsxwriter.Workbook):
def add_worksheet(self, name: str | None = ..., **kw) -> Worksheet: ...
def get_iso_codes(lang: str) -> str: ...
def scan_languages() -> list[tuple[str, str]]: ...
def mod10r(number: str) -> str: ...
def str2bool(s: str, default: bool | None = ...) -> bool: ...
def human_size(sz) -> str: ...
DEFAULT_SERVER_DATE_FORMAT: str
DEFAULT_SERVER_TIME_FORMAT: str
DEFAULT_SERVER_DATETIME_FORMAT: str
DATE_LENGTH: int
DATETIME_FORMATS_MAP: dict[str, str]
POSIX_TO_LDML: dict[str, str]
def posix_to_ldml(fmt: str, locale: Locale) -> str: ...
@overload
def split_every(n: int, iterable: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ...
@overload
def split_every(
n: int, iterable: Iterable[_T], piece_maker: type[Collection[_T]]
) -> Iterator[Collection[_T]]: ...
@overload
def split_every(
n: int, iterable: Iterable[_T], piece_maker: Callable[[Iterable[_T]], _T1]
) -> Iterator[_T1]: ...
def discardattr(obj, key: str) -> None: ...
def remove_accents(input_str: str) -> str: ...
class unquote(str): ...
class mute_logger(Handler):
loggers: tuple[str]
old_params: dict[str, tuple[list[Handler], bool]]
def __init__(self, *loggers: str) -> None: ...
def __enter__(self) -> None: ...
def __exit__(
self,
exc_type: Any | None = ...,
exc_val: Any | None = ...,
exc_tb: Any | None = ...,
) -> None: ...
def __call__(self, func: _CallableT) -> _CallableT: ...
def emit(self, record: LogRecord) -> None: ...
class lower_logging(Handler):
old_handlers: list[Handler] | None
old_propagate: bool | None
had_error_log: bool
max_level: int | None
to_level: int | None
def __init__(self, max_level: int, to_level: int | None = ...) -> None: ...
def __enter__(self: _LowerLoggingT) -> _LowerLoggingT: ...
def __exit__(
self,
exc_type: Any | None = ...,
exc_val: Any | None = ...,
exc_tb: Any | None = ...,
) -> None: ...
def emit(self, record: LogRecord) -> None: ...
def stripped_sys_argv(*strip_args: str) -> list[str]: ...
class ConstantMapping(Mapping[Any, _VT], Generic[_VT]):
def __init__(self, val: _VT) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator: ...
def __getitem__(self, item) -> _VT: ...
def dumpstacks(
sig: Any | None = ..., frame: Any | None = ..., thread_idents: Any | None = ...
) -> None: ...
def freehash(arg) -> int: ...
def clean_context(context: dict[str, Any]) -> dict[str, Any]: ...
class frozendict(dict[_KT, _VT], Generic[_KT, _VT]):
def __delitem__(self, key) -> NoReturn: ...
def __setitem__(self, key, val) -> NoReturn: ...
def clear(self) -> NoReturn: ...
def pop(self, key, default: Any | None = ...) -> NoReturn: ...
def popitem(self) -> NoReturn: ...
def setdefault(self, key, default: Any | None = ...) -> NoReturn: ...
def update(self, *args, **kwargs) -> NoReturn: ...
def __hash__(self) -> int: ...
class Collector(dict[_KT, tuple[_T, ...]], Generic[_KT, _T]):
def __getitem__(self, key: _KT) -> tuple[_T, ...]: ...
def __setitem__(self, key: _KT, val: Iterable[_T]): ...
def add(self, key: _KT, val: _T): ...
def discard_keys_and_values(self, excludes: Collection[_KT | _T]) -> None: ...
class StackMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __init__(self, m: MutableMapping[_KT, _VT] | None = ...) -> None: ...
def __getitem__(self, key: _KT) -> _VT: ...
def __setitem__(self, key: _KT, val: _VT): ...
def __delitem__(self, key: _KT): ...
def __iter__(self) -> Iterator[_KT]: ...
def __len__(self) -> int: ...
def __str__(self) -> str: ...
def pushmap(self, m: MutableMapping[_KT, _VT] | None = ...): ...
def popmap(self) -> MutableMapping[_KT, _VT]: ...
class OrderedSet(MutableSet[_T], Generic[_T]):
def __init__(self, elems: Iterable = ...) -> None: ...
def __contains__(self, elem) -> bool: ...
def __iter__(self) -> Iterator: ...
def __len__(self) -> int: ...
def add(self, elem) -> None: ...
def discard(self, elem) -> None: ...
def update(self, elems: Iterable) -> None: ...
def difference_update(self, elems: Iterable) -> None: ...
class LastOrderedSet(OrderedSet[_T], Generic[_T]):
def add(self, elem) -> None: ...
class Callbacks:
data: dict
def __init__(self) -> None: ...
def add(self, func: Callable) -> None: ...
def run(self) -> None: ...
def clear(self) -> None: ...
class ReversedIterable(Reversible[_T], Generic[_T]):
iterable: Reversible[_T]
def __init__(self, iterable: Reversible[_T]) -> None: ...
def __iter__(self) -> Iterator[_T]: ...
def __reversed__(self) -> Iterator[_T]: ...
def groupby(
iterable: Iterable[_T], key: Callable[[_T], _T1] = ...
) -> Iterable[tuple[_T1, list[_T]]]: ...
def unique(it: Iterable[_T]) -> Iterator[_T]: ...
def submap(mapping: Mapping[_KT, _VT], keys: Iterable[_KT]) -> Mapping[_KT, _VT]: ...
class Reverse:
val: Any
def __init__(self, val) -> None: ...
def __eq__(self, other) -> bool: ...
def __ne__(self, other) -> bool: ...
def __ge__(self, other) -> bool: ...
def __gt__(self, other) -> bool: ...
def __le__(self, other) -> bool: ...
def __lt__(self, other) -> bool: ...
def ignore(*exc) -> suppress: ...
class replace_exceptions(ContextDecorator):
exceptions: tuple[type[Exception], ...]
by: Exception
def __init__(self, *exceptions: type[Exception], by: Exception) -> None: ...
def __enter__(self: _ReplaceExceptionsT) -> _ReplaceExceptionsT: ...
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
html_escape = markupsafe.escape
def get_lang(env: Environment, lang_code: str = ...) -> LangData: ...
def babel_locale_parse(lang_code: str) -> Locale: ...
def formatLang(
env: Environment,
value,
digits: int = ...,
grouping: bool = ...,
monetary: bool = ...,
dp: str = ...,
currency_obj: Currency = ...,
rounding_method: str = ...,
rounding_unit: str = ...,
) -> str: ...
def format_date(
env: Environment,
value: datetime.date | datetime.datetime | str,
lang_code: str = ...,
date_format: str = ...,
) -> str: ...
def parse_date(env: Environment, value: str, lang_code: str = ...) -> datetime.date: ...
def format_datetime(
env: Environment,
value: str | datetime.datetime,
tz: str = ...,
dt_format: str = ...,
lang_code: str = ...,
) -> str: ...
def format_time(
env: Environment, value, tz: str = ..., time_format: str = ..., lang_code: str = ...
) -> str: ...
def format_decimalized_number(number: float, decimal: int = ...) -> str: ...
def format_decimalized_amount(
amount: float, currency: Currency | None = ...
) -> str: ...
def format_amount(
env: Environment,
amount: float,
currency: Currency,
lang_code: str = ...,
) -> str: ...
def format_duration(value: float) -> str: ...
consteq: Callable[[str, str], bool]
class ReadonlyDict(Mapping[_KT, _VT], Generic[_KT, _VT]): ...
class DotDict(dict):
def __getattr__(self, attrib): ...
def get_diff(
data_from: tuple[str, str],
data_to: tuple[str, str],
custom_style: bool = ...,
dark_color_scheme: bool = ...,
) -> str: ...
def hmac(env: Environment, scope, message, hash_function=...) -> str: ...
def hash_sign(
env: Environment,
scope,
message_values,
expiration: Any | None = ...,
expiration_hours: int | None = ...,
) -> str: ...
def verify_hash_signed(env: Environment, scope, payload): ...
ADDRESS_REGEX: Pattern
def street_split(street: str) -> dict[str, str]: ...
def is_list_of(values: list | tuple, type_: type | tuple[type, ...]) -> bool: ...
def has_list_types(
values: list | tuple, types: Collection[type | tuple[type, ...]]
) -> bool: ...
def get_flag(country_code: str) -> str: ...
def format_frame(frame: FrameType) -> str: ...
def named_to_positional_printf(string: str, args: Mapping) -> tuple[str, tuple]: ...

View File

@@ -1,14 +0,0 @@
from re import Pattern
from typing import BinaryIO, Callable
WINDOWS_RESERVED: Pattern
def clean_filename(name: str, replacement: str = ...) -> str: ...
def zip_dir(
path: str,
stream: str | BinaryIO,
include_dir: bool = ...,
fnct_sort: Callable | None = ...,
) -> None: ...
is_running_as_nt_service: Callable[[], bool]

View File

@@ -1,7 +0,0 @@
from re import Pattern
from typing import Callable
component_re: Pattern
replace: Callable
def parse_version(s: str) -> tuple[str, ...]: ...

View File

@@ -1,43 +0,0 @@
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.utils import b_ as b_
DEFAULT_PDF_DATETIME_FORMAT: str
REGEX_SUBTYPE_UNFORMATED: Pattern
REGEX_SUBTYPE_FORMATED: Pattern
class BrandedFileWriter(PdfFileWriter):
def __init__(self) -> None: ...
PdfFileWriter = BrandedFileWriter
def merge_pdf(pdf_data: Iterable[bytes]) -> bytes: ...
def fill_form_fields_pdf(writer: PdfFileWriter, form_fields: dict) -> None: ...
def rotate_pdf(pdf: bytes) -> bytes: ...
def to_pdf_stream(attachment: IrAttachment) -> BytesIO: ...
def add_banner(
pdf_stream: str | BinaryIO,
text: str | None = ...,
logo: bool = ...,
thickness: float = ...,
) -> BytesIO: ...
def reshape_text(text: str) -> str: ...
class OdooPdfFileReader(PdfFileReader):
def getAttachments(self) -> Iterable[tuple[Any, Any]]: ...
class OdooPdfFileWriter(PdfFileWriter):
is_pdfa: bool
def __init__(self, *args, **kwargs) -> None: ...
def addAttachment(self, fname: str, fdata, subtype: str | None = ...) -> None: ...
def embed_odoo_attachment(
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: ...

View File

@@ -1,50 +0,0 @@
import datetime
from ..api import Environment
from ..fields import Field, Many2one
from ..models import Model
from . import SQL
MIN_DATETIME: datetime.datetime
MAX_DATETIME: datetime.datetime
def get_field_variation_date(
model: Model, field: Field, factor: int, series_alias: str
) -> SQL: ...
def get_field_variation_char(field: Field, postfix: str | SQL | None = ...) -> SQL: ...
def ignore_indexes(model: Model): ...
def ignore_fkey_constraints(model: Model): ...
def field_needs_variation(model: Model, field: Field) -> bool: ...
def get_field_variation(
model: Model, field: Field, factor: int, series_alias: str
) -> SQL: ...
def fetch_last_id(model: Model) -> int: ...
def populate_field(
model: Model,
field: Field,
populated: dict[Model, int],
factors: dict[Model, int],
table_alias: str = ...,
series_alias: str = ...,
) -> SQL | None: ...
def populate_model(
model: Model,
populated: dict[Model, int],
factors: dict[Model, int],
separator_code: str,
) -> None: ...
class Many2oneFieldWrapper(Many2one):
def __init__(self, model, field_name, comodel_name) -> None: ...
class Many2manyModelWrapper:
env: Environment
def __init__(self, env, field) -> None: ...
def __repr__(self) -> str: ...
def __eq__(self, other): ...
def __hash__(self): ...
def infer_many2many_model(
env: Environment, field: Field
) -> Model | Many2manyModelWrapper: ...
def populate_models(model_factors: dict[Model, int], separator_code: int) -> None: ...

View File

@@ -1,134 +0,0 @@
from datetime import datetime
from threading import Thread
from types import FrameType
from typing import Any, Callable, ContextManager, Generic, Iterable, TypeVar
from ..sql_db import Cursor
_T = TypeVar("_T")
real_datetime_now: Callable[..., datetime]
real_time: Callable[[], float]
def get_current_frame(thread: Thread | None = ...) -> FrameType: ...
def stack_size() -> int: ...
def make_session(name: str = ...) -> str: ...
def force_hook() -> None: ...
class Collector:
name: str | None
@classmethod
def __init_subclass__(cls) -> None: ...
@classmethod
def make(cls, name: str, *args, **kwargs): ...
profiler: Profiler | None
def __init__(self) -> None: ...
def start(self) -> None: ...
def stop(self) -> None: ...
def add(self, entry: dict | None = ..., frame: FrameType | None = ...) -> None: ...
def _get_stack_trace(
self, frame: FrameType | None = ...
) -> list[tuple[str, int, str, str]]: ...
def post_process(self) -> None: ...
@property
def entries(self) -> list[dict]: ...
def summary(self) -> str: ...
class SQLCollector(Collector):
name: str
def start(self) -> None: ...
def stop(self) -> None: ...
def hook(self, cr: Cursor, query, params, query_start, query_time) -> None: ...
def summary(self) -> str: ...
class PeriodicCollector(Collector):
name: str
active: bool
frame_interval: float
last_frame: FrameType | None
def __init__(self, interval: float = ...) -> None: ...
def run(self) -> None: ...
def start(self) -> None: ...
def stop(self) -> None: ...
def add(self, entry: dict | None = ..., frame: FrameType | None = ...) -> None: ...
class SyncCollector(Collector):
name: str
def start(self) -> None: ...
def stop(self) -> None: ...
def hook(self, _frame: FrameType, event: str, _arg: Any | None = ...): ...
def post_process(self) -> None: ...
class QwebTracker:
@classmethod
def wrap_render(cls, method_render: _T) -> _T: ...
@classmethod
def wrap_compile(cls, method_compile: _T) -> _T: ...
@classmethod
def wrap_compile_directive(cls, method_compile_directive: _T) -> _T: ...
execution_context_enabled: Any
qweb_hooks: Iterable[Callable]
context_stack: list[ExecutionContext]
cr: Cursor
view_id: Any
def __init__(self, view_id, arch, cr) -> None: ...
def enter_directive(self, directive, attrib, xpath) -> None: ...
def leave_directive(self, directive, attrib, xpath) -> None: ...
class QwebCollector(Collector):
name: str
events: list
hook: Callable
def __init__(self) -> None: ...
def start(self) -> None: ...
def stop(self) -> None: ...
def post_process(self) -> None: ...
class ExecutionContext:
context: dict
previous_context: tuple | None
def __init__(self, **context) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, *_args) -> None: ...
class Profiler:
start_time: int
duration: int
profile_session: Any
description: str | None
init_frame: FrameType | None
init_stack_trace: list[tuple[str, int, str, str]] | None
init_thread: Thread | None
disable_gc: bool
filecache: dict
params: Any
profile_id: Any
log: bool
sub_profilers: list[Profiler]
db: str | None
collectors: list[Collector]
def __init__(
self,
collectors: list[str | Collector] | None = ...,
db: str | None = ...,
profile_session: Any | None = ...,
description: str | None = ...,
disable_gc: bool = ...,
params: Any | None = ...,
log: bool = ...,
) -> None: ...
def __enter__(self: _T) -> _T: ...
def __exit__(self, *args) -> None: ...
def entry_count(self) -> int: ...
def format_path(self, path: str) -> str: ...
def json(self) -> str: ...
def summary(self) -> str: ...
class Nested(Generic[_T]):
profiler: Profiler
context_manager: ContextManager[_T]
def __init__(
self, profiler: Profiler, context_manager: ContextManager[_T]
) -> None: ...
def __enter__(self) -> _T: ...
def __exit__(self, exc_type, exc_value, traceback): ...

View File

@@ -1,16 +0,0 @@
from csv import Dialect
from typing import BinaryIO, Iterable, Iterator
class _CsvReader(Iterator[list[str]]):
dialect: Dialect
line_num: int
def __next__(self) -> list[str]: ...
class _CsvWriter:
dialect: Dialect
def writerow(self, row: Iterable): ...
def writerows(self, rows: Iterable[Iterable]) -> None: ...
def csv_reader(stream: BinaryIO, **params) -> _CsvReader: ...
def csv_writer(stream: BinaryIO, **params) -> _CsvWriter: ...
def to_text(source) -> str: ...

View File

@@ -1,53 +0,0 @@
from typing import Iterable, Iterator
from ..api import Environment
from . import SQL
class Query:
limit: int | None
offset: int | None
def __init__(
self, env: Environment, alias: str, table: SQL | None = ...
) -> None: ...
def make_alias(self, alias: str, link: str) -> str: ...
def add_table(self, alias: str, table: SQL | None = ...) -> None: ...
def add_join(
self, kind: str, alias: str, table: str | SQL | None, condition: SQL
) -> None: ...
def add_where(
self, where_clause: str | SQL, where_params: Iterable = ...
) -> None: ...
def join(
self,
lhs_alias: str,
lhs_column: str,
rhs_table: str | SQL,
rhs_column: str,
link: str,
) -> str: ...
def left_join(
self,
lhs_alias: str,
lhs_column: str,
rhs_table: str,
rhs_column: str,
link: str,
) -> str: ...
@property
def order(self) -> SQL | None: ...
@order.setter
def order(self, value: SQL | str | None): ...
@property
def table(self) -> str: ...
@property
def from_clause(self) -> SQL: ...
@property
def where_clause(self) -> SQL: ...
def is_empty(self) -> bool: ...
def select(self, *args: str | SQL) -> SQL: ...
def subselect(self, *args: str | SQL) -> SQL: ...
def get_result_ids(self) -> tuple[int, ...]: ...
def set_result_ids(self, ids: Iterable[int], ordered: bool = ...) -> None: ...
def __bool__(self) -> bool: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[int]: ...

View File

@@ -1,16 +0,0 @@
from re import Pattern
from typing import Any, Iterable
from markupsafe import Markup
INLINE_TEMPLATE_REGEX: Pattern
def relativedelta_proxy(*args, **kwargs): ...
template_env_globals: dict[str, Any]
def parse_inline_template(text: str) -> list[tuple[str, str]]: ...
def convert_inline_template_to_qweb(template: str) -> Markup: ...
def render_inline_template(
template_instructions: Iterable[tuple[str, str]], variables: dict
) -> str: ...

View File

@@ -1,37 +0,0 @@
from types import CodeType
from typing import Iterable, Iterator, Literal
unsafe_eval = eval
def to_opcodes(
opnames: Iterable[str], _opmap: dict[str, int] = ...
) -> Iterator[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
) -> None: ...
def test_expr(
expr: str, allowed_codes: set[int], mode: str = ..., filename: str | None = ...
): ...
def const_eval(expr: str): ...
def expr_eval(expr: str): ...
def safe_eval(
expr: str,
globals_dict: dict | None = ...,
locals_dict: dict | None = ...,
mode: str = ...,
nocopy: bool = ...,
locals_builtins: bool = ...,
filename: str | None = ...,
): ...
def test_python_expr(expr: str, mode: str = ...) -> str | Literal[False]: ...
def check_values(d: dict): ...
class wrap_module:
def __init__(self, module, attributes) -> None: ...
mods: list[str]
datetime: wrap_module
json: wrap_module
time: wrap_module
pytz: wrap_module

View File

@@ -1,109 +0,0 @@
from abc import ABC, abstractmethod
from collections.abc import Iterable
from typing import Any, Collection, Literal
class SetDefinitions:
def __init__(self, definitions: dict[int, dict]) -> None: ...
@property
def empty(self) -> SetExpression: ...
@property
def universe(self) -> SetExpression: ...
def parse(self, refs: str, raise_if_not_found: bool = ...) -> SetExpression: ...
def from_ids(
self, ids: Iterable[int], keep_subsets: bool = ...
) -> SetExpression: ...
def from_key(self, key: str) -> SetExpression: ...
def get_id(self, ref: LeafIdType) -> LeafIdType | None: ...
class SetExpression(ABC):
@abstractmethod
def is_empty(self) -> bool: ...
@abstractmethod
def is_universal(self) -> bool: ...
@abstractmethod
def invert_intersect(self, factor: SetExpression) -> SetExpression | None: ...
@abstractmethod
def matches(self, user_group_ids: Iterable[int]) -> bool: ...
@property
@abstractmethod
def key(self) -> str: ...
@abstractmethod
def __and__(self, other: SetExpression) -> SetExpression: ...
@abstractmethod
def __or__(self, other: SetExpression) -> SetExpression: ...
@abstractmethod
def __invert__(self) -> SetExpression: ...
@abstractmethod
def __eq__(self, other) -> bool: ...
@abstractmethod
def __le__(self, other: SetExpression) -> bool: ...
@abstractmethod
def __lt__(self, other: SetExpression) -> bool: ...
@abstractmethod
def __hash__(self): ...
class Union(SetExpression):
def __init__(self, inters: Iterable[Inter] = ..., optimal: bool = ...) -> None: ...
@property
def key(self) -> str: ...
def is_empty(self) -> bool: ...
def is_universal(self) -> bool: ...
def invert_intersect(self, factor: SetExpression) -> Union | None: ...
def __and__(self, other: SetExpression) -> Union: ...
def __or__(self, other: SetExpression) -> Union: ...
def __invert__(self) -> Union: ...
def matches(self, user_group_ids) -> bool: ...
def __bool__(self) -> bool: ...
def __eq__(self, other) -> bool: ...
def __le__(self, other: SetExpression) -> bool: ...
def __lt__(self, other: SetExpression) -> bool: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __hash__(self): ...
class Inter:
leaves: list
key: tuple
def __init__(self, leaves: Iterable[Leaf] = ..., optimal: bool = ...) -> None: ...
def is_empty(self) -> bool: ...
def is_universal(self) -> bool: ...
def matches(self, user_group_ids) -> bool: ...
def __and__(self, other: Inter) -> Inter: ...
def __eq__(self, other) -> bool: ...
def __le__(self, other: Inter) -> bool: ...
def __lt__(self, other: Inter) -> bool: ...
def __hash__(self): ...
class Leaf:
id: LeafIdType
ref: str | int
negative: bool
key: tuple[LeafIdType, bool]
subsets: set[LeafIdType]
supersets: set[LeafIdType]
disjoints: set[LeafIdType]
inverse: Leaf | None
def __init__(
self, leaf_id: LeafIdType, ref: str | int | None = ..., negative: bool = ...
) -> None: ...
def __invert__(self) -> Leaf: ...
def is_empty(self) -> bool: ...
def is_universal(self) -> bool: ...
def isdisjoint(self, other: Leaf) -> bool: ...
def matches(self, user_group_ids: Collection[int]) -> bool: ...
def __eq__(self, other) -> bool: ...
def __le__(self, other: Leaf) -> bool: ...
def __lt__(self, other: Leaf) -> bool: ...
def __hash__(self): ...
class UnknownId(str):
def __lt__(self, other) -> bool: ...
def __gt__(self, other) -> bool: ...
LeafIdType: int | Literal["*"] | UnknownId
UNIVERSAL_LEAF: Leaf
EMPTY_LEAF: Leaf
EMPTY_INTER: Inter
UNIVERSAL_INTER: Inter
EMPTY_UNION: Union
UNIVERSAL_UNION: Union

View File

@@ -1,18 +0,0 @@
class SourceMapGenerator:
def __init__(self, source_root: str | None = ...) -> None: ...
def to_json(self) -> dict: ...
def get_content(self) -> bytes: ...
def add_source(
self,
source_name: str,
source_content: str,
last_index: int,
start_offset: int = ...,
) -> None: ...
B64CHARS: bytes
SHIFTSIZE: int
FLAG: int
MASK: int
def base64vlq_encode(*values) -> str: ...

View File

@@ -1,45 +0,0 @@
from reprlib import Repr
from typing import Any, Callable, Iterable, Sequence, TypeVar
_SpeedscopeT = TypeVar("_SpeedscopeT", bound=Speedscope)
shortener: Repr
shorten: Callable[[Any], str]
class Speedscope:
init_stack_trace: list[Sequence]
init_stack_trace_level: int
caller_frame: Sequence | None
init_caller_frame: Sequence | None
profiles_raw: dict
name: str
frames_indexes: dict[Any, int]
frame_count: int
profiles: list
def __init__(
self, name: str = ..., init_stack_trace: list | None = ...
) -> None: ...
def add(self, key, profile) -> None: ...
def convert_stack(self, stack: list[Sequence]) -> None: ...
def add_output(
self: _SpeedscopeT,
names: Iterable[str],
complete: bool = ...,
display_name: str | None = ...,
use_context: bool = ...,
**params
) -> _SpeedscopeT: ...
def add_default(self: _SpeedscopeT) -> _SpeedscopeT: ...
def make(self) -> dict: ...
def get_frame_id(self, frame) -> int: ...
def stack_to_ids(
self, stack: list, context: Iterable[tuple[int, dict]], stack_offset: int = ...
) -> list[int]: ...
def process(
self,
entries: list[dict],
continuous: bool = ...,
hide_gaps: bool = ...,
use_context: bool = ...,
constant_time: bool = ...,
) -> list[dict]: ...

View File

@@ -1,125 +0,0 @@
import enum
from collections import defaultdict
from re import Pattern
from typing import Iterable, Literal
from ..fields import Field
from ..models import BaseModel
from ..sql_db import Cursor
IDENT_RE: Pattern
class SQL:
def __init__(
self, code: str | SQL = ..., *args, to_flush: Field | None = ..., **kwargs
) -> None: ...
@property
def to_flush(self) -> Iterable[Field]: ...
@property
def code(self) -> str: ...
@property
def params(self) -> list: ...
def __repr__(self) -> str: ...
def __bool__(self) -> bool: ...
def __eq__(self, other) -> bool: ...
def __iter__(self): ...
def join(self, args: Iterable) -> SQL: ...
@classmethod
def identifier(
cls, name: str, subname: str | None = ..., to_flush: Field | None = ...
) -> SQL: ...
def existing_tables(cr: Cursor, tablenames: Iterable[str]) -> list[str]: ...
def table_exists(cr: Cursor, tablename: str) -> bool: ...
class TableKind(enum.Enum):
Regular: str
Temporary: str
View: str
Materialized: str
Foreign: str
Other: None
def table_kind(cr: Cursor, tablename: str) -> TableKind | None: ...
SQL_ORDER_BY_TYPE: defaultdict
def create_model_table(
cr: Cursor, tablename: str, comment: str | None = ..., columns: Iterable = ...
) -> None: ...
def table_columns(cr: Cursor, tablename: str) -> dict: ...
def column_exists(cr: Cursor, tablename: str, columnname: str) -> int: ...
def create_column(
cr: Cursor,
tablename: str,
columnname: str,
columntype: str,
comment: str | None = ...,
) -> None: ...
def rename_column(
cr: Cursor, tablename: str, columnname1: str, columnname2: str
) -> None: ...
def convert_column(
cr: Cursor, tablename: str, columnname: str, columntype: str
) -> None: ...
def convert_column_translatable(
cr: Cursor, tablename: str, columnname: str, columntype: 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: ...
def drop_not_null(cr: Cursor, tablename: str, columnname: str) -> None: ...
def constraint_definition(
cr: Cursor, tablename: str, constraintname: str
) -> str | None: ...
def add_constraint(
cr: Cursor, tablename: str, constraintname: str, definition: str
) -> None: ...
def drop_constraint(cr: Cursor, tablename: str, constraintname: str) -> None: ...
def add_foreign_key(
cr: Cursor,
tablename1: str,
columnname1: str,
tablename2: str,
columnname2: str,
ondelete,
) -> Literal[True]: ...
def get_foreign_keys(
cr: Cursor,
tablename1: str,
columnname1: str,
tablename2: str,
columnname2: str,
ondelete,
) -> list[str]: ...
def fix_foreign_key(
cr: Cursor,
tablename1: str,
columnname1: str,
tablename2: str,
columnname2: str,
ondelete,
) -> list[str]: ...
def index_exists(cr: Cursor, indexname: str) -> int: ...
def check_index_exist(cr: Cursor, indexname: str) -> None: ...
def create_index(
cr: Cursor,
indexname: str,
tablename: str,
expressions: Iterable[str],
method: str = ...,
where: str = ...,
) -> None: ...
def create_unique_index(
cr: Cursor, indexname: str, tablename: str, expressions: Iterable[str]
) -> None: ...
def drop_index(cr: Cursor, indexname: str, tablename: str) -> None: ...
def drop_view_if_exists(cr: Cursor, viewname: str) -> None: ...
def escape_psql(to_escape: str) -> str: ...
def pg_varchar(size: int = ...) -> str: ...
def reverse_order(order: str) -> str: ...
def increment_fields_skiplock(records: BaseModel, *fields: str) -> bool: ...
def value_to_translated_trigram_pattern(value: str) -> str: ...
def pattern_to_translated_trigram_pattern(pattern: str) -> str: ...
def make_identifier(identifier: str) -> str: ...
def make_index_name(table_name: str, column_name: str) -> str: ...

View File

@@ -1,20 +0,0 @@
from re import Pattern
from typing import Any, Callable
from lxml.etree import _Element
RSTRIP_REGEXP: Pattern
PYTHON_ATTRIBUTES: set[str]
def add_stripped_items_before(
node: _Element, spec: _Element, extract: Callable[[_Element], _Element]
) -> None: ...
def add_text_before(node: _Element, text: str | None) -> None: ...
def remove_element(node: _Element) -> None: ...
def locate_node(arch: _Element, spec: _Element) -> _Element: ...
def apply_inheritance_specs(
source: _Element,
specs_tree: _Element,
inherit_branding: bool = ...,
pre_locate: Callable[[_Element], Any] = ...,
) -> _Element: ...

View File

@@ -1,26 +0,0 @@
from typing import Any, Literal
from ..sql_db import Cursor
from . import config as config
def try_report(
cr: Cursor,
uid: int,
rname: str,
ids,
data: Any | None = ...,
context: dict | None = ...,
our_module: Any | None = ...,
report_type: Any | None = ...,
) -> bool: ...
def try_report_action(
cr: Cursor,
uid: int,
action_id: int,
active_model: str | None = ...,
active_ids: list[int] | None = ...,
wiz_data: dict | None = ...,
wiz_buttons: list[str] | None = ...,
context: dict | None = ...,
our_module: str | None = ...,
) -> Literal[True]: ...

View File

@@ -1,193 +0,0 @@
import csv
from collections import defaultdict, namedtuple
from re import Pattern
from tarfile import TarFile
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, NoReturn
from lxml.etree import _Element
from polib import POFile
from ..api import Environment
from ..sql_db import Cursor
from .pycompat import _CsvWriter
PYTHON_TRANSLATION_COMMENT: str
JAVASCRIPT_TRANSLATION_COMMENT: str
SKIPPED_ELEMENTS: tuple[str, ...]
class UNIX_LINE_TERMINATOR(csv.excel):
lineterminator: str
TRANSLATED_ELEMENTS: set[str]
TRANSLATED_ATTRS: dict[str, Any]
def translate_attrib_value(node: _Element) -> bool: ...
avoid_pattern: Pattern
space_pattern: Pattern
def translate_xml_node(
node: _Element,
callback: Callable[[str], str | None],
parse: Callable[[str], _Element],
serialize: Callable[[_Element], str],
) -> _Element: ...
def parse_xml(text: str) -> _Element: ...
def serialize_xml(node: _Element) -> str: ...
MODIFIER_ATTRS: set[str]
def xml_term_adapter(term_en: str) -> Callable[[str], str]: ...
def parse_html(text: str) -> _Element: ...
def serialize_html(node: _Element) -> str: ...
def xml_translate(callback: Callable[[str], str | None], value: str) -> str: ...
def xml_term_converter(value: str) -> str: ...
def html_translate(callback: Callable[[str], str | None], value: str) -> str: ...
def html_term_converter(value: str) -> str: ...
def get_text_content(term: str) -> str: ...
def is_text(term: str) -> bool: ...
def translate_sql_constraint(cr: Cursor, key: str, lang: str) -> str: ...
def get_translation(module: str, lang: str, source: str, args: tuple | dict) -> str: ...
def get_translated_module(arg) -> str: ...
def get_text_alias(source: str, *args, **kwargs): ...
class LazyGettext:
def __init__(
self, source, *args, _module: str = ..., _default_lang: str = ..., **kwargs
) -> None: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def __eq__(self, other): ...
def __hash__(self): ...
def __lt__(self, other): ...
def __add__(self, other): ...
def __radd__(self, other): ...
class LazyTranslate:
module: str
default_lang: str
def __init__(self, module: str, *, default_lang: str = ...) -> None: ...
def __call__(self, source: str, *args, **kwargs) -> LazyGettext: ...
_ = get_text_alias
_lt = LazyGettext
def quote(s: str) -> str: ...
re_escaped_char: Pattern
re_escaped_replacements: dict[str, str]
def unquote(str: str) -> str: ...
def TranslationFileReader(
source: IO, fileformat: str = ...
) -> CSVFileReader | PoFileReader: ...
class CSVFileReader:
source: csv.DictReader
prev_code_src: str
def __init__(self, source: IO) -> None: ...
def __iter__(self) -> Iterator[csv.DictReader]: ...
class PoFileReader:
pofile: POFile
def __init__(self, source: str | IO): ...
def __iter__(self) -> Iterator[dict[str, Any]]: ...
def TranslationFileWriter(
target, fileformat: str = ..., lang: str | None = ...
) -> CSVFileWriter | PoFileWriter | TarFileWriter: ...
class CSVFileWriter:
writer: _CsvWriter
def __init__(self, target: BinaryIO) -> None: ...
def write_rows(self, rows: Iterable) -> None: ...
class PoFileWriter:
buffer: IO
lang: str
po: POFile
def __init__(self, target: IO, lang: str) -> None: ...
def write_rows(self, rows: Iterable) -> None: ...
def add_entry(
self, modules, tnrs, source, trad, comments: Iterable[str] | None = ...
) -> None: ...
class TarFileWriter:
tar: TarFile
lang: str
def __init__(self, target: IO, lang: str) -> None: ...
def write_rows(self, rows: Iterable) -> None: ...
def trans_export(
lang: str, modules: list[str], buffer, format: str, cr: Cursor
) -> None: ...
def trans_export_records(
lang: str, model_name: str, ids, buffer, format: str, cr: Cursor
) -> 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(
fileobj, keywords, comment_tags, options
) -> Iterator[tuple[int, str, str, list]]: ...
ImdInfo = namedtuple("ExternalId", ["name", "model", "res_id", "module"])
class TranslationReader:
env: Environment
def __init__(self, cr: Cursor, lang: str | None = ...) -> None: ...
def __iter__(self) -> Iterable[tuple]: ...
class TranslationRecordReader(TranslationReader): ...
class TranslationModuleReader(TranslationReader): ...
def DeepDefaultDict() -> defaultdict: ...
class TranslationImporter:
cr: Cursor
verbose: bool
env: Environment
model_translations: defaultdict[
str, defaultdict[str, defaultdict[str, defaultdict]]
]
model_terms_translations: defaultdict[
str, defaultdict[str, defaultdict[str, defaultdict]]
]
def __init__(self, cr: Cursor, verbose: bool = ...) -> None: ...
def load_file(
self, filepath: str, lang: str, xmlids: Iterable[str] | None = ...
) -> None: ...
def load(
self,
fileobj: IO,
fileformat: str,
lang: str,
xmlids: Iterable[str] | None = ...,
) -> None: ...
def save(self, overwrite: bool = ..., force_overwrite: bool = ...) -> None: ...
def trans_load(
cr: Cursor, filepath: str, lang: str, verbose: bool = ..., overwrite: bool = ...
) -> None: ...
def trans_load_data(
cr: Cursor,
fileobj: IO,
fileformat: str,
lang: str,
verbose: bool = ...,
overwrite: bool = ...,
) -> None: ...
def get_locales(lang: str | None = ...) -> None: ...
def resetlocale() -> str: ...
def load_language(cr: Cursor, lang: str) -> None: ...
def get_po_paths(
module_name: str, lang: str, env: Environment | None = ...
) -> Iterator[str]: ...
class CodeTranslations:
python_translations: dict[tuple[str, str], dict]
web_translations: dict[tuple[str, str], dict]
def __init__(self) -> None: ...
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

View File

@@ -1,17 +0,0 @@
from ast import expr as _expr
from re import Pattern
from typing import Callable, TypeVar
from lxml.etree import RelaxNG, _Element
_CallableT = TypeVar("_CallableT", bound=Callable)
READONLY: Pattern
def get_domain_value_names(domain) -> tuple[set[str], set[str]]: ...
def get_expression_field_names(expression) -> set[str]: ...
def get_dict_asts(expr: str | _expr) -> dict: ...
def valid_view(arch: _Element, **kwargs) -> bool: ...
def validate(*view_types: str) -> Callable[[_CallableT], _CallableT]: ...
def relaxng(view_type: str) -> RelaxNG: ...
def schema_valid(arch: _Element, **kwargs) -> bool: ...

View File

@@ -1,16 +0,0 @@
from os import R_OK as R_OK
from os import W_OK as W_OK
from os.path import dirname as dirname
from typing import Iterator
ENOENT: int
windows: bool
seen: set
defpathext: list[str]
def which_files(
file: str, mode: int = ..., path: str | None = ..., pathext: str | None = ...
) -> Iterator[str]: ...
def which(
file: str, mode: int = ..., path: str | None = ..., pathext: str | None = ...
) -> str: ...

View File

@@ -1,49 +0,0 @@
from typing import Callable, Iterable, Literal
from lxml import etree
from lxml.etree import _Element
from odoo.addons.base.models.ir_attachment import IrAttachment
from ..api import Environment
def remove_control_characters(byte_node) -> str: ...
class odoo_resolver(etree.Resolver):
env: Environment
prefix: str | None
def __init__(self, env: Environment, prefix: str | None) -> None: ...
def resolve(self, url: str, id: str, context) -> str: ...
def create_xml_node_chain(
first_parent_node: _Element,
nodes_list: Iterable[str],
last_node_value: str | None = ...,
) -> list[_Element]: ...
def create_xml_node(
parent_node: _Element, node_name: str, node_value: str | None = ...
) -> _Element: ...
def cleanup_xml_node(
xml_node_or_string: _Element | str,
remove_blank_text: bool = ...,
remove_blank_nodes: bool = ...,
indent_level: int = ...,
indent_space: str = ...,
) -> _Element: ...
def load_xsd_files_from_url(
env: Environment,
url: str,
file_name: str | None = ...,
force_reload: bool = ...,
request_max_timeout: int = ...,
xsd_name_prefix: str = ...,
xsd_names_filter: str | list[str] | None = ...,
modify_xsd_content: Callable[[bytes], bytes] | None = ...,
) -> IrAttachment | Literal[False]: ...
def validate_xml_from_attachment(
env: Environment,
xml_content,
xsd_name: str,
reload_files_function: Callable | None = ...,
prefix: str | None = ...,
) -> None: ...
def find_xml_value(xpath, xml_element: _Element, namespaces=...) -> str | None: ...

View File

@@ -1,21 +0,0 @@
import os
from setuptools import setup
def find_stubs(package):
stubs = []
for root, dirs, files in os.walk(package):
for f in files:
stubs.append(os.path.relpath(os.path.join(root, f), package))
return {package: stubs}
setup(
name="odoo-stubs",
url="https://github.com/odoo-ide/odoo-stubs",
author="Trinh Anh Ngoc",
author_email="atw1990@gmail.com",
version="0.0.1",
package_data=find_stubs("odoo-stubs"),
packages=["odoo-stubs"]
)