Update stubs

This commit is contained in:
Trinh Anh Ngoc
2025-03-26 16:13:43 +07:00
parent 204ed57ed8
commit 577e5f3583
16 changed files with 51 additions and 15 deletions

View File

@@ -53,6 +53,7 @@ def downgrade(method: Callable, value, self, args, kwargs): ...
def split_context(method: Callable, args, kwargs) -> tuple: ...
def autovacuum(method: _CallableT) -> _CallableT: ...
def model(method: _CallableT) -> _CallableT: ...
def private(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): ...

View File

@@ -270,10 +270,10 @@ class Html(_String):
class Date(Field[datetime.date]):
type: str
column_type: tuple[str, str]
start_of = date_utils.start_of
end_of = date_utils.end_of
add = date_utils.add
subtract = date_utils.subtract
start_of = staticmethod(date_utils.start_of)
end_of = staticmethod(date_utils.end_of)
add = staticmethod(date_utils.add)
subtract = staticmethod(date_utils.subtract)
@staticmethod
def today(*args) -> datetime.date: ...
@staticmethod
@@ -293,10 +293,10 @@ class Date(Field[datetime.date]):
class Datetime(Field[datetime.datetime]):
type: str
column_type: tuple[str, str]
start_of = date_utils.start_of
end_of = date_utils.end_of
add = date_utils.add
subtract = date_utils.subtract
start_of = staticmethod(date_utils.start_of)
end_of = staticmethod(date_utils.end_of)
add = staticmethod(date_utils.add)
subtract = staticmethod(date_utils.subtract)
@staticmethod
def now(*args) -> datetime.datetime: ...
@staticmethod

View File

@@ -6,14 +6,15 @@ 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 odoo.addons.base.models.res_lang import Lang
from odoo.addons.website.models.website import Website
from .api import Environment
from .models import BaseModel
from .modules.registry import Registry

View File

@@ -15,6 +15,7 @@ from typing import (
import dateutil.relativedelta
import psycopg2
from odoo.addons.base.models.res_company import Company
from odoo.addons.base.models.res_users import Users

View File

@@ -14,3 +14,12 @@ class MigrationManager:
migrations: dict
def __init__(self, cr: Cursor, graph: Graph) -> None: ...
def migrate_module(self, pkg: Node, stage: str) -> None: ...
def exec_script(
cr: Cursor,
installed_version: str,
pyfile: str,
addon,
stage,
version: str | None = ...,
) -> None: ...

View File

@@ -39,7 +39,7 @@ def get_modules() -> list[str]: ...
def get_modules_with_version() -> dict[str, Any]: ...
def adapt_version(version: str) -> str: ...
current_test: Any
current_test: bool
def check_python_external_dependency(pydep) -> None: ...
def check_manifest_dependencies(manifest) -> None: ...

View File

@@ -1,6 +1,7 @@
from typing import Any, Callable, TypeVar
from ..api import Environment
from ..models import BaseModel
from ..sql_db import Cursor
_CallableT = TypeVar("_CallableT", bound=Callable)
@@ -8,6 +9,7 @@ _CallableT = TypeVar("_CallableT", bound=Callable)
PG_CONCURRENCY_ERRORS_TO_RETRY: tuple[str, str, str]
MAX_TRIES_ON_CONCURRENCY_FAILURE: int
def get_public_method(model: BaseModel, name: str): ...
def dispatch(method: str, params): ...
def execute_cr(cr: Cursor, uid: int, obj: str, method: str, *args, **kw): ...
def execute_kw(

View File

@@ -14,3 +14,6 @@ class TestCase(_TestCase):
def doCleanups(self) -> None: ...
@classmethod
def doClassCleanups(cls) -> None: ...
@property
def canonical_tag(self) -> str: ...
def get_log_metadata(self) -> dict: ...

View File

@@ -7,10 +7,11 @@ from typing import Any, Callable, Generator, Mapping, Match, TypeVar
from xmlrpc import client as xmlrpclib
import requests
from odoo.addons.base.models.res_users import Users
from urllib3.util import Url
from websocket import WebSocket
from odoo.addons.base.models.res_users import Users
from ..api import Environment
from ..http import Session
from ..models import BaseModel
@@ -222,6 +223,7 @@ class HttpCase(TransactionCase):
cookies: Any | None = ...,
error_checker: Any | None = ...,
watch: bool = ...,
cpu_throttling: int | None = ...,
**kw
) -> None: ...
@classmethod

View File

@@ -5,5 +5,9 @@ from .suite import OdooSuite
def get_test_modules(module: str) -> list: ...
def make_suite(module_names: list[str], position: str = ...) -> OdooSuite: ...
def run_suite(suite: OdooSuite, module_name: str | None = ...) -> OdooTestResult: ...
def run_suite(
suite: OdooSuite,
module_name: str | None = ...,
global_report: OdooTestResult | None = ...,
) -> OdooTestResult: ...
def unwrap_suite(test) -> Iterator: ...

View File

@@ -4,6 +4,7 @@ from typing import Any, NamedTuple
STDOUT_LINE: str
STDERR_LINE: str
ODOO_TEST_MAX_FAILED_TESTS: int
stats_logger: Logger
class Stat(NamedTuple):
@@ -21,12 +22,16 @@ class OdooTestResult:
queries_start: int | None
had_failure: bool
stats: dict[str, Stat]
global_report: OdooTestResult | None
shouldStop: bool
def __init__(
self,
stream: Any | None = ...,
descriptions: Any | None = ...,
verbosity: Any | None = ...,
global_report: OdooTestResult | None = ...,
) -> None: ...
def total_errors_count(self) -> int: ...
def printErrors(self) -> None: ...
def startTest(self, test) -> None: ...
def stopTest(self, test) -> None: ...

View File

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

View File

@@ -1,6 +1,7 @@
import datetime
from typing import Iterator, Tuple, TypeVar
import babel
from dateutil.relativedelta import relativedelta
_DateTimeT = TypeVar("_DateTimeT", datetime.date, datetime.datetime)
@@ -21,3 +22,4 @@ 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

@@ -23,9 +23,10 @@ import markupsafe
import xlsxwriter
import xlwt
from babel.core import Locale
from xlwt import Worksheet
from odoo.addons.base.models.res_currency import Currency
from odoo.addons.base.models.res_lang import Lang
from xlwt import Worksheet
from ..api import Environment
from ..loglevels import exception_to_unicode as exception_to_unicode

View File

@@ -2,9 +2,10 @@ 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 odoo.addons.base.models.ir_attachment import IrAttachment
DEFAULT_PDF_DATETIME_FORMAT: str
REGEX_SUBTYPE_UNFORMATED: Pattern
REGEX_SUBTYPE_FORMATED: Pattern

View File

@@ -2,6 +2,7 @@ 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