From 5312e133abb10f3494d50a48988d7a985a444ff0 Mon Sep 17 00:00:00 2001 From: Trinh Anh Ngoc Date: Wed, 17 May 2023 15:18:04 +0700 Subject: [PATCH] Update stubs --- odoo-stubs/models.pyi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/odoo-stubs/models.pyi b/odoo-stubs/models.pyi index abcf19a..f0d9d15 100644 --- a/odoo-stubs/models.pyi +++ b/odoo-stubs/models.pyi @@ -1,6 +1,6 @@ from collections import defaultdict from re import Pattern -from typing import Any, Callable, Collection, Container, Iterable, Iterator, MutableMapping, Sequence, TypeVar, Union +from typing import Any, Callable, Collection, Container, Iterable, Iterator, Literal, MutableMapping, Sequence, TypeVar, Union, overload import psycopg2 from lxml.etree import _Element @@ -157,7 +157,10 @@ class BaseModel(metaclass=MetaModel): def get_formview_action(self, access_uid: int | None = ...) -> dict[str, Any]: ... def get_access_action(self, access_uid: int | None = ...) -> dict[str, Any]: ... def search_count(self, args: _Domain) -> int: ... - def search(self: _ModelT, args: _Domain, offset: int = ..., limit: int | None = ..., order: str | None = ..., count: bool = ...) -> _ModelT | int: ... + @overload + def search(self: _ModelT, args: _Domain, offset: int = ..., limit: int | None = ..., order: str | None = ..., count: Literal[False] = ...) -> _ModelT: ... + @overload + def search(self: _ModelT, args: _Domain, offset: int = ..., limit: int | None = ..., order: str | None = ..., count: Literal[True] = ...) -> int: ... def _compute_display_name(self) -> None: ... def name_get(self) -> list[tuple[int, str]]: ... def name_create(self, name: str) -> tuple[int, str]: ...