diff --git a/odoo-stubs/fields.pyi b/odoo-stubs/fields.pyi index 46e2cce..a9e5665 100644 --- a/odoo-stubs/fields.pyi +++ b/odoo-stubs/fields.pyi @@ -97,6 +97,7 @@ class Field(Generic[_FieldValueT], metaclass=MetaField): 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 = ... ): ... diff --git a/odoo-stubs/models.pyi b/odoo-stubs/models.pyi index 3948ccd..6636b1f 100644 --- a/odoo-stubs/models.pyi +++ b/odoo-stubs/models.pyi @@ -179,7 +179,6 @@ class BaseModel(metaclass=MetaModel): ) -> None: ... def default_get(self, fields_list: list[str]) -> dict[str, Any]: ... def _rec_name_fallback(self) -> str: ... - def user_has_groups(self, groups: str) -> bool: ... def search_count(self, domain: list, limit: int | None = ...) -> int: ... def search( self: _ModelT, diff --git a/odoo-stubs/tests/common.pyi b/odoo-stubs/tests/common.pyi index c3dbce5..2b43390 100644 --- a/odoo-stubs/tests/common.pyi +++ b/odoo-stubs/tests/common.pyi @@ -31,6 +31,7 @@ ADMIN_USER_ID: int CHECK_BROWSER_SLEEP: float CHECK_BROWSER_ITERATIONS: int BROWSER_WAIT: float +DEFAULT_SUCCESS_SIGNAL: str def get_db_name() -> str: ... @@ -141,7 +142,7 @@ def save_test_file( class ChromeBrowser: remote_debugging_port: int test_case: HttpCase - success_signal: Callable[[str], bool] + success_signal: str chrome: Popen devtools_port: int | None ws: WebSocket | None @@ -154,7 +155,7 @@ class ChromeBrowser: def __init__( self, test_case: HttpCase, - success_signal: Callable[[str], bool], + success_signal: str, headless: bool = ..., debug: bool = ..., ) -> None: ... @@ -166,6 +167,7 @@ class ChromeBrowser: 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: ... @@ -222,7 +224,7 @@ class HttpCase(TransactionCase): cookies: Any | None = ..., error_checker: Any | None = ..., watch: bool = ..., - success_signal: Callable[[str], bool] | None = ..., + success_signal: str = ..., debug: bool = ..., **kw ) -> None: ... diff --git a/odoo-stubs/tests/loader.pyi b/odoo-stubs/tests/loader.pyi index db45040..ac320bf 100644 --- a/odoo-stubs/tests/loader.pyi +++ b/odoo-stubs/tests/loader.pyi @@ -3,7 +3,7 @@ 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, module_name: str | None = ...) -> OdooTestResult: ... -def unwrap_suite(test) -> Iterator: ... +def run_suite(suite: OdooSuite) -> OdooTestResult: ... diff --git a/odoo-stubs/tools/__init__.pyi b/odoo-stubs/tools/__init__.pyi index 5991594..baf99d7 100644 --- a/odoo-stubs/tools/__init__.pyi +++ b/odoo-stubs/tools/__init__.pyi @@ -9,6 +9,7 @@ from .convert import * from .date_utils import * from .float_utils import * from .func import * +from .i18n import * from .image import * from .js_transpiler import ODOO_MODULE_RE as ODOO_MODULE_RE from .js_transpiler import URL_RE as URL_RE diff --git a/odoo-stubs/tools/cache.pyi b/odoo-stubs/tools/cache.pyi index c3cdf19..3694b0d 100644 --- a/odoo-stubs/tools/cache.pyi +++ b/odoo-stubs/tools/cache.pyi @@ -12,6 +12,8 @@ class ormcache_counter: hit: int miss: int err: int + gen_time: int + cache_name: Any def __init__(self) -> None: ... @property def ratio(self) -> float: ... diff --git a/odoo-stubs/tools/i18n.pyi b/odoo-stubs/tools/i18n.pyi new file mode 100644 index 0000000..f959c54 --- /dev/null +++ b/odoo-stubs/tools/i18n.pyi @@ -0,0 +1,18 @@ +from typing import Literal, Sequence + +from ..api import Environment + +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: ... diff --git a/odoo-stubs/tools/mail.pyi b/odoo-stubs/tools/mail.pyi index d1607f8..f802ed5 100644 --- a/odoo-stubs/tools/mail.pyi +++ b/odoo-stubs/tools/mail.pyi @@ -23,6 +23,7 @@ def html_sanitize( strip_classes: bool = ..., ) -> Markup: ... +URL_SKIP_PROTOCOL_REGEX: str URL_REGEX: str TEXT_URL_REGEX: str HTML_TAG_URL_REGEX: str diff --git a/odoo-stubs/tools/misc.pyi b/odoo-stubs/tools/misc.pyi index 8e9c9c5..b8162ff 100644 --- a/odoo-stubs/tools/misc.pyi +++ b/odoo-stubs/tools/misc.pyi @@ -1,10 +1,9 @@ import datetime -import pickle as pickle_ 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, ModuleType +from types import FrameType from typing import ( IO, Any, @@ -23,7 +22,7 @@ import xlsxwriter import xlwt from babel.core import Locale from odoo.addons.base.models.res_currency import Currency -from odoo.addons.base.models.res_lang import Lang +from odoo.addons.base.models.res_lang import LangData from xlwt import Worksheet from ..api import Environment @@ -224,16 +223,18 @@ class replace_exceptions(ContextDecorator): html_escape = markupsafe.escape -def get_lang(env: Environment, lang_code: str = ...) -> Lang: ... +def get_lang(env: Environment, lang_code: str = ...) -> LangData: ... def babel_locale_parse(lang_code: str) -> Locale: ... def formatLang( env: Environment, value, - digits: int | None = ..., + digits: int = ..., grouping: bool = ..., monetary: bool = ..., - dp: bool = ..., + dp: str = ..., currency_obj: Currency = ..., + rounding_method: str = ..., + rounding_unit: str = ..., ) -> str: ... def format_date( env: Environment, @@ -266,11 +267,6 @@ def format_duration(value: float) -> str: ... consteq: Callable[[str, str], bool] -class Unpickler(pickle_.Unpickler): - def find_class(self, module_name: str, name: str): ... - -pickle: ModuleType - class ReadonlyDict(Mapping): ... class DotDict(dict): diff --git a/odoo-stubs/tools/pdf.pyi b/odoo-stubs/tools/pdf.pyi index 7c35675..2d136c3 100644 --- a/odoo-stubs/tools/pdf.pyi +++ b/odoo-stubs/tools/pdf.pyi @@ -34,6 +34,7 @@ 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 = ...