From 3a47ec80d04f45d7329b1d90ce317f25c2ff5de0 Mon Sep 17 00:00:00 2001 From: Trinh Anh Ngoc Date: Sat, 27 Jan 2024 21:05:02 +0700 Subject: [PATCH] Update stubs --- odoo-stubs/api.pyi | 8 +++++++- odoo-stubs/fields.pyi | 1 + odoo-stubs/models.pyi | 1 + odoo-stubs/tools/date_utils.pyi | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/odoo-stubs/api.pyi b/odoo-stubs/api.pyi index 657bc56..9bd1cbf 100644 --- a/odoo-stubs/api.pyi +++ b/odoo-stubs/api.pyi @@ -64,11 +64,17 @@ class Environment(Mapping[str, BaseModel]): def manage(cls) -> Generator[None, None, None]: ... @classmethod def reset(cls) -> None: ... + uid_origin: int | None all: Environments registry: Registry cache: Cache def __new__( - cls, cr: Cursor, uid: int, context: dict, su: bool = ... + 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: ... diff --git a/odoo-stubs/fields.pyi b/odoo-stubs/fields.pyi index 9e959c8..9db029c 100644 --- a/odoo-stubs/fields.pyi +++ b/odoo-stubs/fields.pyi @@ -14,6 +14,7 @@ from typing import ( import psycopg2 from markupsafe import Markup +from . import SUPERUSER_ID as SUPERUSER_ID from .api import Environment, Registry from .models import BaseModel from .tools import date_utils, float_utils diff --git a/odoo-stubs/models.pyi b/odoo-stubs/models.pyi index 500f8d4..b7d8f71 100644 --- a/odoo-stubs/models.pyi +++ b/odoo-stubs/models.pyi @@ -96,6 +96,7 @@ class BaseModel(metaclass=MetaModel): _needaction: bool _translate: bool _check_company_auto: bool + _allow_sudo_commands: bool _depends: dict[str, Iterable[str]] _transient_max_count: int _transient_max_hours: float diff --git a/odoo-stubs/tools/date_utils.pyi b/odoo-stubs/tools/date_utils.pyi index d7bef90..d9d531d 100644 --- a/odoo-stubs/tools/date_utils.pyi +++ b/odoo-stubs/tools/date_utils.pyi @@ -5,6 +5,7 @@ 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]: ...