diff --git a/odoo-stubs/api.pyi b/odoo-stubs/api.pyi index a683c47..06010e5 100644 --- a/odoo-stubs/api.pyi +++ b/odoo-stubs/api.pyi @@ -61,6 +61,8 @@ def returns( def downgrade(method: Callable, value, self, args, kwargs): ... def autovacuum(method: _CallableT) -> _CallableT: ... def model(method: _CallableT) -> _CallableT: ... +def readonly(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): ... diff --git a/odoo-stubs/fields.pyi b/odoo-stubs/fields.pyi index 9268a96..1bcd671 100644 --- a/odoo-stubs/fields.pyi +++ b/odoo-stubs/fields.pyi @@ -269,10 +269,10 @@ class Html(_String): 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 + 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 - 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 diff --git a/odoo-stubs/http.pyi b/odoo-stubs/http.pyi index 5e6a85c..416b019 100644 --- a/odoo-stubs/http.pyi +++ b/odoo-stubs/http.pyi @@ -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 diff --git a/odoo-stubs/models.pyi b/odoo-stubs/models.pyi index 15fa9d8..97a3186 100644 --- a/odoo-stubs/models.pyi +++ b/odoo-stubs/models.pyi @@ -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 diff --git a/odoo-stubs/modules/module.pyi b/odoo-stubs/modules/module.pyi index 38b9729..ef94e11 100644 --- a/odoo-stubs/modules/module.pyi +++ b/odoo-stubs/modules/module.pyi @@ -35,7 +35,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: ... diff --git a/odoo-stubs/service/model.pyi b/odoo-stubs/service/model.pyi index 11ea674..f6f5e2a 100644 --- a/odoo-stubs/service/model.pyi +++ b/odoo-stubs/service/model.pyi @@ -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) @@ -9,6 +10,7 @@ PG_CONCURRENCY_ERRORS_TO_RETRY: tuple[str, str, str] PG_CONCURRENCY_EXCEPTIONS_TO_RETRY: tuple[Exception, ...] 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( diff --git a/odoo-stubs/tests/case.pyi b/odoo-stubs/tests/case.pyi index 9f94eb9..9986dec 100644 --- a/odoo-stubs/tests/case.pyi +++ b/odoo-stubs/tests/case.pyi @@ -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: ... diff --git a/odoo-stubs/tests/common.pyi b/odoo-stubs/tests/common.pyi index 48e073c..73821c7 100644 --- a/odoo-stubs/tests/common.pyi +++ b/odoo-stubs/tests/common.pyi @@ -8,11 +8,12 @@ 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 odoo.addons.base.models.res_currency import Currency +from odoo.addons.base.models.res_users import Users + from ..api import Environment from ..http import Session from ..models import BaseModel @@ -262,6 +263,7 @@ class HttpCase(TransactionCase): watch: bool = ..., success_signal: str = ..., debug: bool = ..., + cpu_throttling: int | None = ..., **kw ) -> None: ... def start_tour( diff --git a/odoo-stubs/tests/loader.pyi b/odoo-stubs/tests/loader.pyi index ac320bf..0f945ea 100644 --- a/odoo-stubs/tests/loader.pyi +++ b/odoo-stubs/tests/loader.pyi @@ -6,4 +6,6 @@ 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: ... +def run_suite( + suite: OdooSuite, global_report: OdooTestResult | None = ... +) -> OdooTestResult: ... diff --git a/odoo-stubs/tests/result.pyi b/odoo-stubs/tests/result.pyi index 3b16cb1..4b8a24f 100644 --- a/odoo-stubs/tests/result.pyi +++ b/odoo-stubs/tests/result.pyi @@ -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: ... diff --git a/odoo-stubs/tests/tag_selector.pyi b/odoo-stubs/tests/tag_selector.pyi index bb07ca9..8262079 100644 --- a/odoo-stubs/tests/tag_selector.pyi +++ b/odoo-stubs/tests/tag_selector.pyi @@ -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: ... diff --git a/odoo-stubs/tools/mail.pyi b/odoo-stubs/tools/mail.pyi index 31b5b59..44cd359 100644 --- a/odoo-stubs/tools/mail.pyi +++ b/odoo-stubs/tools/mail.pyi @@ -67,6 +67,7 @@ def email_split_and_format(text: str) -> list[str]: ... def email_split_and_format_normalize(text: str) -> list[str]: ... def email_normalize(text: str, strict: bool = ...) -> str | Literal[False]: ... def email_normalize_all(text: str) -> list[str]: ... +def email_anonymize(normalized_email: str, *, redact_domain: bool = ...) -> 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]: ... diff --git a/odoo-stubs/tools/misc.pyi b/odoo-stubs/tools/misc.pyi index 1fbe76e..9e2a937 100644 --- a/odoo-stubs/tools/misc.pyi +++ b/odoo-stubs/tools/misc.pyi @@ -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 LangData -from xlwt import Worksheet from ..api import Environment from ..loglevels import exception_to_unicode as exception_to_unicode diff --git a/odoo-stubs/tools/pdf/__init__.pyi b/odoo-stubs/tools/pdf/__init__.pyi index c8b8ba9..d27f568 100644 --- a/odoo-stubs/tools/pdf/__init__.pyi +++ b/odoo-stubs/tools/pdf/__init__.pyi @@ -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 diff --git a/odoo-stubs/tools/query.pyi b/odoo-stubs/tools/query.pyi index 0c53b8c..89a284c 100644 --- a/odoo-stubs/tools/query.pyi +++ b/odoo-stubs/tools/query.pyi @@ -11,7 +11,8 @@ class Query: def __init__( self, env: Environment, alias: str, table: SQL | None = ... ) -> None: ... - def make_alias(self, alias: str, link: str) -> str: ... + @staticmethod + def make_alias(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 diff --git a/odoo-stubs/tools/xml_utils.pyi b/odoo-stubs/tools/xml_utils.pyi index 81b3c76..4e3a539 100644 --- a/odoo-stubs/tools/xml_utils.pyi +++ b/odoo-stubs/tools/xml_utils.pyi @@ -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