Update stubs

This commit is contained in:
Trinh Anh Ngoc
2024-01-27 21:05:12 +07:00
parent 9259aad461
commit 6fb7559756
7 changed files with 19 additions and 3 deletions

View File

@@ -1,3 +1,6 @@
from codecs import CodecInfo
from re import Pattern
from . import addons as addons from . import addons as addons
from . import api as api from . import api as api
from . import conf as conf from . import conf as conf
@@ -18,6 +21,8 @@ from .tools.translate import _lt as _lt
evented: bool evented: bool
multi_process: bool multi_process: bool
iso8859_8: CodecInfo
iso8859_8ie_re: Pattern
SUPERUSER_ID: int SUPERUSER_ID: int
def registry(database_name: str | None = ...) -> Registry: ... def registry(database_name: str | None = ...) -> Registry: ...

View File

@@ -64,12 +64,18 @@ class Environment(Mapping[str, BaseModel]):
su: bool = ... su: bool = ...
args: tuple[Cursor, int, dict, bool] args: tuple[Cursor, int, dict, bool]
def reset(self) -> None: ... def reset(self) -> None: ...
uid_origin: int | None
all: Transaction all: Transaction
transaction: Transaction transaction: Transaction
registry: Registry registry: Registry
cache: Cache cache: Cache
def __new__( def __new__(
cls, cr: Cursor, uid: int | None, context: dict, su: bool = ... cls,
cr: Cursor,
uid: int | None,
context: dict,
su: bool = ...,
uid_origin: int | None = ...,
) -> Environment: ... ) -> Environment: ...
def __contains__(self, model_name) -> bool: ... def __contains__(self, model_name) -> bool: ...
def __getitem__(self, model_name: str) -> BaseModel: ... def __getitem__(self, model_name: str) -> BaseModel: ...

View File

@@ -16,6 +16,7 @@ from typing import (
import psycopg2 import psycopg2
from markupsafe import Markup from markupsafe import Markup
from . import SUPERUSER_ID as SUPERUSER_ID
from .api import Environment, Registry from .api import Environment, Registry
from .models import BaseModel from .models import BaseModel
from .tools import date_utils, float_utils from .tools import date_utils, float_utils
@@ -444,6 +445,7 @@ class Properties(Field):
definition_record_field: str | None definition_record_field: str | None
ALLOWED_TYPES: tuple[str, ...] ALLOWED_TYPES: tuple[str, ...]
compute: Callable compute: Callable
def setup_related(self, model: BaseModel) -> None: ...
def convert_to_column( def convert_to_column(
self, value, record: BaseModel, values: Any | None = ..., validate: bool = ... self, value, record: BaseModel, values: Any | None = ..., validate: bool = ...
): ... ): ...

View File

@@ -82,7 +82,7 @@ PREFETCH_MAX: int
LOG_ACCESS_COLUMNS: list[str] LOG_ACCESS_COLUMNS: list[str]
MAGIC_COLUMNS: list[str] MAGIC_COLUMNS: list[str]
READ_GROUP_TIME_GRANULARITY: dict[str, dateutil.relativedelta.relativedelta] READ_GROUP_TIME_GRANULARITY: dict[str, dateutil.relativedelta.relativedelta]
READ_GROUP_AGGREGATE: dict[str, Callable[[str, str], str]] READ_GROUP_AGGREGATE: dict[str, Callable[[str, str | SQL], SQL]]
READ_GROUP_DISPLAY_FORMAT: dict[str, str] READ_GROUP_DISPLAY_FORMAT: dict[str, str]
def is_definition_class(cls) -> bool: ... def is_definition_class(cls) -> bool: ...
@@ -111,6 +111,7 @@ class BaseModel(metaclass=MetaModel):
_fold_name: str _fold_name: str
_translate: bool _translate: bool
_check_company_auto: bool _check_company_auto: bool
_allow_sudo_commands: bool
_depends: dict[str, Iterable[str]] _depends: dict[str, Iterable[str]]
_transient_max_count: int _transient_max_count: int
_transient_max_hours: float _transient_max_hours: float

View File

@@ -47,6 +47,7 @@ def new_test_user(
context: dict | None = ..., context: dict | None = ...,
**kwargs **kwargs
) -> Users: ... ) -> Users: ...
def loaded_demo_data(env: Environment) -> bool: ...
class RecordCapturer: class RecordCapturer:
def __init__(self, model: BaseModel, domain: list) -> None: ... def __init__(self, model: BaseModel, domain: list) -> None: ...

View File

@@ -5,6 +5,7 @@ from dateutil.relativedelta import relativedelta
_DateTimeT = TypeVar("_DateTimeT", datetime.date, datetime.datetime) _DateTimeT = TypeVar("_DateTimeT", datetime.date, datetime.datetime)
def date_type(value: _DateTimeT) -> type[_DateTimeT]: ...
def get_month(date: _DateTimeT) -> Tuple[_DateTimeT, _DateTimeT]: ... def get_month(date: _DateTimeT) -> Tuple[_DateTimeT, _DateTimeT]: ...
def get_quarter_number(date: _DateTimeT) -> int: ... def get_quarter_number(date: _DateTimeT) -> int: ...
def get_quarter(date: _DateTimeT) -> Tuple[_DateTimeT, _DateTimeT]: ... def get_quarter(date: _DateTimeT) -> Tuple[_DateTimeT, _DateTimeT]: ...

View File

@@ -17,7 +17,7 @@ class BrandedFileWriter(PdfFileWriter):
PdfFileWriter = BrandedFileWriter PdfFileWriter = BrandedFileWriter
def merge_pdf(pdf_data: Iterable[bytes]) -> bytes: ... def merge_pdf(pdf_data: Iterable[bytes]) -> bytes: ...
def fill_form_fields_pdf(document: bytes, form_fields: dict | None = ...) -> bytes: ... def fill_form_fields_pdf(writer: PdfFileWriter, form_fields: dict) -> None: ...
def rotate_pdf(pdf: bytes) -> bytes: ... def rotate_pdf(pdf: bytes) -> bytes: ...
def to_pdf_stream(attachment: IrAttachment) -> BytesIO: ... def to_pdf_stream(attachment: IrAttachment) -> BytesIO: ...
def add_banner( def add_banner(