Update stubs

This commit is contained in:
Trinh Anh Ngoc
2023-05-24 21:29:04 +07:00
parent 32f840613a
commit 62418a2375
7 changed files with 17 additions and 19 deletions

View File

@@ -11,7 +11,6 @@ from typing import (
Optional,
Sequence,
TypeVar,
Union,
)
from weakref import WeakSet
@@ -82,7 +81,7 @@ class Environment(Mapping[str, BaseModel]):
def __call__(
self,
cr: Cursor | None = ...,
user: "Union[Users, int, None]" = ...,
user: Users | int | None = ...,
context: dict | None = ...,
su: bool | None = ...,
) -> Environment: ...
@@ -93,11 +92,11 @@ class Environment(Mapping[str, BaseModel]):
def is_admin(self) -> bool: ...
def is_system(self) -> bool: ...
@property
def user(self) -> "Users": ...
def user(self) -> Users: ...
@property
def company(self) -> "Company": ...
def company(self) -> Company: ...
@property
def companies(self) -> "Company": ...
def companies(self) -> Company: ...
@property
def lang(self) -> str: ...
def clear(self) -> None: ...

View File

@@ -210,11 +210,11 @@ class Request:
session: Session
db: str | None
env: Environment | None
website: "Website"
website: Website
website_routing: int
is_frontend: bool
is_frontend_multilang: bool
lang: "Lang"
lang: Lang
def __init__(self, httprequest: werkzeug.Request) -> None: ...
def update_env(
self,

View File

@@ -10,7 +10,6 @@ from typing import (
MutableMapping,
Sequence,
TypeVar,
Union,
)
import dateutil.relativedelta
@@ -436,8 +435,8 @@ class BaseModel(metaclass=MetaModel):
def ensure_one(self: _ModelT) -> _ModelT: ...
def with_env(self: _ModelT, env: Environment) -> _ModelT: ...
def sudo(self: _ModelT, flag: bool = ...) -> _ModelT: ...
def with_user(self: _ModelT, user: "Union[Users, int]") -> _ModelT: ...
def with_company(self: _ModelT, company: "Union[Company, int]") -> _ModelT: ...
def with_user(self: _ModelT, user: Users | int) -> _ModelT: ...
def with_company(self: _ModelT, company: Company | int) -> _ModelT: ...
def with_context(self: _ModelT, *args, **kwargs) -> _ModelT: ...
def with_prefetch(
self: _ModelT, prefetch_ids: Iterable[int] | None = ...

View File

@@ -44,7 +44,7 @@ def new_test_user(
groups: str = ...,
context: dict | None = ...,
**kwargs
) -> "Users": ...
) -> Users: ...
class RecordCapturer:
def __init__(self, model: BaseModel, domain: list) -> None: ...

View File

@@ -240,7 +240,7 @@ 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 = ...) -> Lang: ...
def babel_locale_parse(lang_code: str) -> Locale: ...
def formatLang(
env: Environment,
@@ -249,7 +249,7 @@ def formatLang(
grouping: bool = ...,
monetary: bool = ...,
dp: bool = ...,
currency_obj: "Currency" = ...,
currency_obj: Currency = ...,
) -> str: ...
def format_date(
env: Environment,
@@ -270,12 +270,12 @@ def format_time(
) -> str: ...
def format_decimalized_number(number: float, decimal: int = ...) -> str: ...
def format_decimalized_amount(
amount: float, currency: "Currency | None" = ...
amount: float, currency: Currency | None = ...
) -> str: ...
def format_amount(
env: Environment,
amount: float,
currency: "Currency",
currency: Currency,
lang_code: str = ...,
) -> str: ...
def format_duration(value: float) -> str: ...

View File

@@ -18,7 +18,7 @@ PdfFileWriter = BrandedFileWriter
def merge_pdf(pdf_data: Iterable[bytes]) -> bytes: ...
def rotate_pdf(pdf: bytes) -> bytes: ...
def to_pdf_stream(attachment: "IrAttachment") -> BytesIO: ...
def to_pdf_stream(attachment: IrAttachment) -> BytesIO: ...
def add_banner(
pdf_stream: str | BinaryIO,
text: str | None = ...,
@@ -35,7 +35,7 @@ class OdooPdfFileWriter(PdfFileWriter):
None
def addAttachment(self, fname: str, fdata, subtype: str | None = ...) -> None: ...
def embed_odoo_attachment(
self, attachment: "IrAttachment", subtype: str | None = ...
self, attachment: IrAttachment, subtype: str | None = ...
) -> None: ...
def cloneReaderDocumentRoot(self, reader: PdfFileReader) -> None: ...
def convert_to_pdfa(self) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import IO, Callable, Iterable, Literal, Union
from typing import Callable, Iterable, Literal
from lxml import etree
from lxml.etree import _Element
@@ -36,7 +36,7 @@ def load_xsd_files_from_url(
xsd_name_prefix: str = ...,
xsd_names_filter: str | list[str] | None = ...,
modify_xsd_content: Callable[[bytes], bytes] | None = ...,
) -> "Union[IrAttachment, Literal[False]]": ...
) -> IrAttachment | Literal[False]: ...
def validate_xml_from_attachment(
env: Environment,
xml_content,