Update stubs

This commit is contained in:
Trinh Anh Ngoc
2020-11-15 19:04:07 +07:00
parent a859bd5481
commit c7950c5c1e
30 changed files with 189 additions and 80 deletions

View File

@@ -1,2 +1,2 @@
from . import deploy as deploy, populate as populate, scaffold as scaffold, server as server, shell as shell, start as start from . import cloc as cloc, deploy as deploy, populate as populate, scaffold as scaffold, server as server, shell as shell, start as start
from .command import Command as Command, main as main from .command import Command as Command, main as main

5
odoo-stubs/cli/cloc.pyi Normal file
View File

@@ -0,0 +1,5 @@
from . import Command
from typing import Any
class Cloc(Command):
def run(self, args: Any) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Any from typing import Any, Optional
_logger: Any _logger: Any
@@ -8,7 +8,7 @@ class UserError(Exception):
def name(self): ... def name(self): ...
class RedirectWarning(Exception): class RedirectWarning(Exception):
def __init__(self, message: Any, action: Any, button_text: Any) -> None: ... def __init__(self, message: Any, action: Any, button_text: Any, additional_context: Optional[Any] = ...) -> None: ...
@property @property
def name(self): ... def name(self): ...
@@ -26,7 +26,7 @@ class MissingError(UserError): ...
class ValidationError(UserError): ... class ValidationError(UserError): ...
class except_orm(UserError): class except_orm(UserError):
def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __init__(self, name: Any, value: Optional[Any] = ...) -> None: ...
class Warning(UserError): class Warning(UserError):
def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ...

View File

@@ -5,6 +5,7 @@ from odoo.tools import date_utils
DATE_LENGTH: Any DATE_LENGTH: Any
DATETIME_LENGTH: Any DATETIME_LENGTH: Any
NO_ACCESS: str
IR_MODELS: Any IR_MODELS: Any
_logger: Any _logger: Any
_schema: Any _schema: Any
@@ -41,8 +42,8 @@ class Field(MetaField('DummyField', (object,), {})):
index: bool = ... index: bool = ...
manual: bool = ... manual: bool = ...
copy: bool = ... copy: bool = ...
depends: Any = ... _depends: Any = ...
depends_context: Any = ... _depends_context: Any = ...
recursive: bool = ... recursive: bool = ...
compute: Any = ... compute: Any = ...
compute_sudo: bool = ... compute_sudo: bool = ...
@@ -74,6 +75,8 @@ class Field(MetaField('DummyField', (object,), {})):
def _setup_attrs(self, model: Any, name: Any): ... def _setup_attrs(self, model: Any, name: Any): ...
def setup_full(self, model: Any) -> None: ... def setup_full(self, model: Any) -> None: ...
def _setup_regular_base(self, model: Any) -> None: ... def _setup_regular_base(self, model: Any) -> None: ...
depends: Any = ...
depends_context: Any = ...
def _setup_regular_full(self, model: Any) -> None: ... def _setup_regular_full(self, model: Any) -> None: ...
def _setup_related_full(self, model: Any) -> None: ... def _setup_related_full(self, model: Any) -> None: ...
def traverse_related(self, record: Any): ... def traverse_related(self, record: Any): ...
@@ -297,10 +300,11 @@ _BINARY = memoryview
class Binary(Field): class Binary(Field):
type: str = ... type: str = ...
prefetch: bool = ... prefetch: bool = ...
depends_context: Any = ... _depends_context: Any = ...
attachment: bool = ... attachment: bool = ...
@property @property
def column_type(self): ... def column_type(self): ...
def _get_attrs(self, model: Any, name: Any): ...
_description_attachment: Any = ... _description_attachment: Any = ...
def convert_to_column(self, value: Any, record: Any, values: Optional[Any] = ..., validate: bool = ...): ... def convert_to_column(self, value: Any, record: Any, values: Optional[Any] = ..., validate: bool = ...): ...
def convert_to_cache(self, value: Any, record: Any, validate: bool = ...): ... def convert_to_cache(self, value: Any, record: Any, validate: bool = ...): ...
@@ -388,7 +392,7 @@ class Many2one(_Relational):
def convert_to_display_name(self, value: Any, record: Any): ... def convert_to_display_name(self, value: Any, record: Any): ...
def convert_to_onchange(self, value: Any, record: Any, names: Any): ... def convert_to_onchange(self, value: Any, record: Any, names: Any): ...
def write(self, records: Any, value: Any): ... def write(self, records: Any, value: Any): ...
def _remove_inverses(self, records: Any, value: Any) -> None: ... def _remove_inverses(self, records: Any, value: Any): ...
def _update_inverses(self, records: Any, value: Any) -> None: ... def _update_inverses(self, records: Any, value: Any) -> None: ...
class Many2oneReference(Integer): class Many2oneReference(Integer):
@@ -426,6 +430,7 @@ class One2many(_RelationalMulti):
_description_relation_field: Any = ... _description_relation_field: Any = ...
def update_db(self, model: Any, columns: Any) -> None: ... def update_db(self, model: Any, columns: Any) -> None: ...
def get_domain_list(self, records: Any): ... def get_domain_list(self, records: Any): ...
# def __get__(self, records: Any, owner: Any): ...
def read(self, records: Any): ... def read(self, records: Any): ...
def write_real(self, records_commands_list: Any, create: bool = ...): ... def write_real(self, records_commands_list: Any, create: bool = ...): ...
def write_new(self, records_commands_list: Any): ... def write_new(self, records_commands_list: Any): ...
@@ -461,3 +466,4 @@ class Id(Field):
def prefetch_many2one_ids(record: Any, field: Any): ... def prefetch_many2one_ids(record: Any, field: Any): ...
def prefetch_x2many_ids(record: Any, field: Any): ... def prefetch_x2many_ids(record: Any, field: Any): ...
def apply_required(model: Any, field_name: Any) -> None: ...

View File

@@ -56,6 +56,7 @@ class WebRequest:
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: ... def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: ...
def set_handler(self, endpoint: Any, arguments: Any, auth: Any) -> None: ... def set_handler(self, endpoint: Any, arguments: Any, auth: Any) -> None: ...
def _handle_exception(self, exception: Any) -> None: ... def _handle_exception(self, exception: Any) -> None: ...
def _is_cors_preflight(self, endpoint: Any): ...
def _call_function(self, *args: Any, **kwargs: Any): ... def _call_function(self, *args: Any, **kwargs: Any): ...
def registry_cr(self) -> None: ... def registry_cr(self) -> None: ...
@property @property
@@ -85,6 +86,7 @@ class HttpRequest(WebRequest):
params: Any = ... params: Any = ...
def __init__(self, *args: Any) -> None: ... def __init__(self, *args: Any) -> None: ...
def _handle_exception(self, exception: Any): ... def _handle_exception(self, exception: Any): ...
def _is_cors_preflight(self, endpoint: Any): ...
def dispatch(self): ... def dispatch(self): ...
def make_response(self, data: Any, headers: Optional[Any] = ..., cookies: Optional[Any] = ...): ... def make_response(self, data: Any, headers: Optional[Any] = ..., cookies: Optional[Any] = ...): ...
def render(self, template: Any, qcontext: Optional[Any] = ..., lazy: bool = ..., **kw: Any): ... def render(self, template: Any, qcontext: Optional[Any] = ..., lazy: bool = ..., **kw: Any): ...
@@ -120,11 +122,13 @@ class OpenERPSession(sessions.Session):
def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def __getattr__(self, attr: Any): ... def __getattr__(self, attr: Any): ...
def __setattr__(self, k: Any, v: Any): ... def __setattr__(self, k: Any, v: Any): ...
pre_uid: Any = ...
db: Any = ... db: Any = ...
uid: Any = ... uid: Any = ...
login: Any = ... login: Any = ...
def authenticate(self, db: Any, login: Optional[Any] = ..., password: Optional[Any] = ...): ...
session_token: Any = ... session_token: Any = ...
def authenticate(self, db: Any, login: Optional[Any] = ..., password: Optional[Any] = ..., uid: Optional[Any] = ...): ... def finalize(self) -> None: ...
def check_security(self) -> None: ... def check_security(self) -> None: ...
def logout(self, keep_db: bool = ...) -> None: ... def logout(self, keep_db: bool = ...) -> None: ...
def _default_values(self) -> None: ... def _default_values(self) -> None: ...

View File

@@ -42,8 +42,10 @@ class NewId:
def __eq__(self, other: Any) -> Any: ... def __eq__(self, other: Any) -> Any: ...
def __hash__(self) -> Any: ... def __hash__(self) -> Any: ...
def __repr__(self): ... def __repr__(self): ...
def __str__(self): ...
def origin_ids(ids: Any): ... def origin_ids(ids: Any): ...
def expand_ids(id0: Any, ids: Any) -> None: ...
IdType: Any IdType: Any
PREFETCH_MAX: int PREFETCH_MAX: int
@@ -63,6 +65,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
_inherit: Any = ... _inherit: Any = ...
_inherits: Any = ... _inherits: Any = ...
_table: Any = ... _table: Any = ...
_table_query: Any = ...
_sequence: Any = ... _sequence: Any = ...
_sql_constraints: Any = ... _sql_constraints: Any = ...
_rec_name: Any = ... _rec_name: Any = ...
@@ -75,6 +78,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
_needaction: bool = ... _needaction: bool = ...
_translate: bool = ... _translate: bool = ...
_check_company_auto: bool = ... _check_company_auto: bool = ...
_depends: Any = ...
_transient_max_count: Any = ... _transient_max_count: Any = ...
_transient_max_hours: Any = ... _transient_max_hours: Any = ...
env: Environment = ... env: Environment = ...
@@ -158,7 +162,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
def _read_group_raw(self, domain: Any, fields: Any, groupby: Any, offset: int = ..., limit: Optional[Any] = ..., orderby: bool = ..., lazy: bool = ...): ... def _read_group_raw(self, domain: Any, fields: Any, groupby: Any, offset: int = ..., limit: Optional[Any] = ..., orderby: bool = ..., lazy: bool = ...): ...
def _read_group_resolve_many2one_fields(self, data: Any, fields: Any) -> None: ... def _read_group_resolve_many2one_fields(self, data: Any, fields: Any) -> None: ...
def _inherits_join_add(self, current_model: Any, parent_model_name: Any, query: Any): ... def _inherits_join_add(self, current_model: Any, parent_model_name: Any, query: Any): ...
def _inherits_join_calc(self, alias: Any, fname: Any, query: Any, implicit: bool = ..., outer: bool = ...): ... def _inherits_join_calc(self, alias: Any, fname: Any, query: Any): ...
def _parent_store_compute(self): ... def _parent_store_compute(self): ...
def _check_removed_columns(self, log: bool = ...) -> None: ... def _check_removed_columns(self, log: bool = ...) -> None: ...
def _init_column(self, column_name: Any) -> None: ... def _init_column(self, column_name: Any) -> None: ...
@@ -222,11 +226,12 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
_get_xml_ids: Any = ... _get_xml_ids: Any = ...
@classmethod @classmethod
def is_transient(cls): ... def is_transient(cls): ...
def search_read(self, domain: Optional[Any] = ..., fields: Optional[Any] = ..., offset: int = ..., limit: Optional[Any] = ..., order: Optional[Any] = ...): ... def search_read(self, domain: Optional[Any] = ..., fields: Optional[Any] = ..., offset: int = ..., limit: Optional[Any] = ..., order: Optional[Any] = ..., **read_kwargs: Any): ...
def toggle_active(self) -> None: ... def toggle_active(self) -> None: ...
def action_archive(self): ... def action_archive(self): ...
def action_unarchive(self): ... def action_unarchive(self): ...
def _register_hook(self) -> None: ... def _register_hook(self) -> None: ...
def _unregister_hook(self) -> None: ...
@classmethod @classmethod
def _patch_method(cls, name: Any, method: Any) -> None: ... def _patch_method(cls, name: Any, method: Any) -> None: ...
@classmethod @classmethod

View File

@@ -1,3 +1,3 @@
from . import db as db, graph as graph, loading as loading, migration as migration, module as module, registry as registry from . import db as db, graph as graph, loading as loading, migration as migration, module as module, registry as registry
from odoo.modules.loading import load_modules as load_modules, reset_modules_state as reset_modules_state from odoo.modules.loading import load_modules as load_modules, reset_modules_state as reset_modules_state
from odoo.modules.module import adapt_version as adapt_version, get_module_path as get_module_path, get_module_resource as get_module_resource, get_modules as get_modules, get_modules_with_version as get_modules_with_version, get_resource_from_path as get_resource_from_path, get_resource_path as get_resource_path, initialize_sys_path as initialize_sys_path, load_information_from_description_file as load_information_from_description_file, load_openerp_module as load_openerp_module from odoo.modules.module import adapt_version as adapt_version, check_resource_path as check_resource_path, get_module_path as get_module_path, get_module_resource as get_module_resource, get_modules as get_modules, get_modules_with_version as get_modules_with_version, get_resource_from_path as get_resource_from_path, get_resource_path as get_resource_path, initialize_sys_path as initialize_sys_path, load_information_from_description_file as load_information_from_description_file, load_openerp_module as load_openerp_module

View File

@@ -3,8 +3,8 @@ from typing import Any, Optional
_logger: Any _logger: Any
_test_logger: Any _test_logger: Any
def load_data(cr: Any, idref: Any, mode: Any, kind: Any, package: Any, report: Any): ... def load_data(cr: Any, idref: Any, mode: Any, kind: Any, package: Any): ...
def load_demo(cr: Any, package: Any, idref: Any, mode: Any, report: Optional[Any] = ...): ... def load_demo(cr: Any, package: Any, idref: Any, mode: Any): ...
def force_demo(cr: Any) -> None: ... def force_demo(cr: Any) -> None: ...
def load_module_graph(cr: Any, graph: Any, status: Optional[Any] = ..., perform_checks: bool = ..., skip_modules: Optional[Any] = ..., report: Optional[Any] = ..., models_to_check: Optional[Any] = ...): ... def load_module_graph(cr: Any, graph: Any, status: Optional[Any] = ..., perform_checks: bool = ..., skip_modules: Optional[Any] = ..., report: Optional[Any] = ..., models_to_check: Optional[Any] = ...): ...
def _check_module_names(cr: Any, module_names: Any) -> None: ... def _check_module_names(cr: Any, module_names: Any) -> None: ...

View File

@@ -1,4 +1,3 @@
import unittest
from typing import Any, Optional from typing import Any, Optional
MANIFEST_NAMES: Any MANIFEST_NAMES: Any
@@ -21,6 +20,7 @@ def initialize_sys_path() -> None: ...
def get_module_path(module: Any, downloaded: bool = ..., display_warning: bool = ...): ... def get_module_path(module: Any, downloaded: bool = ..., display_warning: bool = ...): ...
def get_module_filetree(module: Any, dir: str = ...): ... def get_module_filetree(module: Any, dir: str = ...): ...
def get_resource_path(module: Any, *args: Any): ... def get_resource_path(module: Any, *args: Any): ...
def check_resource_path(mod_path: Any, *args: Any): ...
get_module_resource = get_resource_path get_module_resource = get_resource_path
def get_resource_from_path(path: Any): ... def get_resource_from_path(path: Any): ...
@@ -32,25 +32,5 @@ def load_openerp_module(module_name: Any) -> None: ...
def get_modules(): ... def get_modules(): ...
def get_modules_with_version(): ... def get_modules_with_version(): ...
def adapt_version(version: Any): ... def adapt_version(version: Any): ...
def get_test_modules(module: Any): ...
def _get_tests_modules(path: Any, module: Any): ...
class OdooTestResult(unittest.result.TestResult):
def log(self, level: Any, msg: Any, *args: Any, test: Optional[Any] = ..., exc_info: Optional[Any] = ..., extra: Optional[Any] = ..., stack_info: bool = ..., caller_infos: Optional[Any] = ...) -> None: ...
def getDescription(self, test: Any): ...
def startTest(self, test: Any) -> None: ...
def addError(self, test: Any, err: Any) -> None: ...
def addFailure(self, test: Any, err: Any) -> None: ...
def addSubTest(self, test: Any, subtest: Any, err: Any) -> None: ...
def addSkip(self, test: Any, reason: Any) -> None: ...
def addUnexpectedSuccess(self, test: Any) -> None: ...
def logError(self, flavour: Any, test: Any, error: Any) -> None: ...
def getErrorCallerInfo(self, error: Any, test: Any): ...
class OdooTestRunner:
def run(self, test: Any): ...
current_test: Any current_test: Any
def run_unit_tests(module_name: Any, position: str = ...): ...
def unwrap_suite(test: Any) -> None: ...

View File

@@ -19,6 +19,7 @@ class Registry(Mapping):
_fields_by_model: Any = ... _fields_by_model: Any = ...
_ordinary_tables: Any = ... _ordinary_tables: Any = ...
_constraint_queue: Any = ... _constraint_queue: Any = ...
__cache: Any = ...
_init_modules: Any = ... _init_modules: Any = ...
updated_modules: Any = ... updated_modules: Any = ...
loaded_xmlids: Any = ... loaded_xmlids: Any = ...
@@ -61,7 +62,6 @@ class Registry(Mapping):
def add_foreign_key(self, table1: Any, column1: Any, table2: Any, column2: Any, ondelete: Any, model: Any, module: Any, force: bool = ...) -> None: ... def add_foreign_key(self, table1: Any, column1: Any, table2: Any, column2: Any, ondelete: Any, model: Any, module: Any, force: bool = ...) -> None: ...
def check_foreign_keys(self, cr: Any) -> None: ... def check_foreign_keys(self, cr: Any) -> None: ...
def check_tables_exist(self, cr: Any) -> None: ... def check_tables_exist(self, cr: Any) -> None: ...
def cache(self): ...
def _clear_cache(self) -> None: ... def _clear_cache(self) -> None: ...
def clear_caches(self) -> None: ... def clear_caches(self) -> None: ...
def is_an_ordinary_table(self, model: Any): ... def is_an_ordinary_table(self, model: Any): ...

View File

@@ -24,14 +24,11 @@ def AND(domains: Any): ...
def OR(domains: Any): ... def OR(domains: Any): ...
def distribute_not(domain: Any): ... def distribute_not(domain: Any): ...
def _quote(to_quote: Any): ... def _quote(to_quote: Any): ...
def generate_table_alias(src_table_alias: Any, joined_tables: Any = ...): ...
def get_alias_from_query(from_query: Any): ...
def normalize_leaf(element: Any): ... def normalize_leaf(element: Any): ...
def is_operator(element: Any): ... def is_operator(element: Any): ...
def is_leaf(element: Any, internal: bool = ...): ... def is_leaf(element: Any, internal: bool = ...): ...
def is_boolean(element: Any): ... def is_boolean(element: Any): ...
def check_leaf(element: Any, internal: bool = ...) -> None: ... def check_leaf(element: Any, internal: bool = ...) -> None: ...
def select_from_where(cr: Any, select_field: Any, from_table: Any, where_field: Any, where_ids: Any, where_operator: Any): ...
def get_unaccent_wrapper(cr: Any): ... def get_unaccent_wrapper(cr: Any): ...
class expression: class expression:

View File

@@ -1,7 +1,7 @@
from ..exceptions import UserError from ..exceptions import except_orm
from ..models import AbstractModel, Model, TransientModel from ..models import AbstractModel, Model, TransientModel
except_osv = UserError except_osv = except_orm
osv = Model osv = Model
osv_memory = TransientModel osv_memory = TransientModel
osv_abstract = AbstractModel osv_abstract = AbstractModel

View File

@@ -1,19 +1,36 @@
from typing import Any, Optional from typing import Any, Optional
def _quote(to_quote: Any): ... IDENT_RE: Any
def _from_table(table: Any, alias: Any): ...
def _generate_table_alias(src_table_alias: Any, link: Any): ...
class Query: class Query:
_cr: Any = ...
_tables: Any = ... _tables: Any = ...
where_clause: Any = ... _joins: Any = ...
where_clause_params: Any = ... _where_clauses: Any = ...
joins: Any = ... _where_params: Any = ...
extras: Any = ... order: Any = ...
def __init__(self, tables: Optional[Any] = ..., where_clause: Optional[Any] = ..., where_clause_params: Optional[Any] = ..., joins: Optional[Any] = ..., extras: Optional[Any] = ...) -> None: ... limit: Any = ...
def add_table(self, table: Any) -> None: ... offset: Any = ...
def __init__(self, cr: Any, alias: Any, table: Optional[Any] = ...) -> None: ...
def add_table(self, alias: Any, table: Optional[Any] = ...) -> None: ...
def add_where(self, where_clause: Any, where_params: Any = ...) -> None: ...
def join(self, lhs_alias: Any, lhs_column: Any, rhs_table: Any, rhs_column: Any, link: Any, extra: Optional[Any] = ..., extra_params: Any = ...): ...
def left_join(self, lhs_alias: Any, lhs_column: Any, rhs_table: Any, rhs_column: Any, link: Any, extra: Optional[Any] = ..., extra_params: Any = ...): ...
def _join(self, kind: Any, lhs_alias: Any, lhs_column: Any, rhs_table: Any, rhs_column: Any, link: Any, extra: Optional[Any] = ..., extra_params: Any = ...): ...
def select(self, *args: Any): ...
def get_sql(self): ...
def _result(self): ...
def __str__(self): ...
def __bool__(self): ...
def __len__(self): ...
def __iter__(self) -> Any: ...
@property @property
def tables(self): ... def tables(self): ...
def _get_table_aliases(self): ... @property
def _get_alias_mapping(self): ... def where_clause(self): ...
@property
def where_clause_params(self): ...
def add_join(self, connection: Any, implicit: bool = ..., outer: bool = ..., extra: Optional[Any] = ..., extra_params: Any = ...): ... def add_join(self, connection: Any, implicit: bool = ..., outer: bool = ..., extra: Optional[Any] = ..., extra_params: Any = ...): ...
def get_sql(self): ...
def __str__(self): ...

View File

@@ -1,6 +1,5 @@
from typing import Any from typing import Any
def login(db: Any, login: Any, password: Any): ...
def check(db: Any, uid: Any, passwd: Any): ... def check(db: Any, uid: Any, passwd: Any): ...
def compute_session_token(session: Any, env: Any): ... def compute_session_token(session: Any, env: Any): ...
def check_session(session: Any, env: Any): ... def check_session(session: Any, env: Any): ...

View File

@@ -1,4 +1,6 @@
import werkzeug.serving import werkzeug.serving
from ..tests import runner as runner
from itertools import chain as chain
from typing import Any, Optional from typing import Any, Optional
INOTIFY_LISTEN_EVENTS: Any INOTIFY_LISTEN_EVENTS: Any

View File

@@ -6,7 +6,7 @@ _logger: Any
def unbuffer(symb: Any, cr: Any): ... def unbuffer(symb: Any, cr: Any): ...
def undecimalize(symb: Any, cr: Any): ... def undecimalize(symb: Any, cr: Any): ...
def adapt_string(adapted: Any): ... def adapt_string(adapted: Any): ...
def flush_env(cr: Any) -> None: ... def flush_env(cr: Any, *, clear: bool = ...) -> None: ...
def clear_env(cr: Any) -> None: ... def clear_env(cr: Any) -> None: ...
re_from: Any re_from: Any

View File

@@ -55,7 +55,7 @@ class BaseCase(TreeCase):
def with_user(self, login: Any) -> None: ... def with_user(self, login: Any) -> None: ...
def _assertRaises(self, exception: Any, *, msg: Optional[Any] = ...) -> None: ... def _assertRaises(self, exception: Any, *, msg: Optional[Any] = ...) -> None: ...
def assertRaises(self, exception: Any, func: Optional[Any] = ..., *args: Any, **kwargs: Any): ... def assertRaises(self, exception: Any, func: Optional[Any] = ..., *args: Any, **kwargs: Any): ...
def assertQueries(self, expected: Any): ... def assertQueries(self, expected: Any, flush: bool = ...): ...
def assertQueryCount(self, default: int = ..., flush: bool = ..., **counters: Any): ... def assertQueryCount(self, default: int = ..., flush: bool = ..., **counters: Any): ...
def assertRecordValues(self, records: Any, expected_values: Any): ... def assertRecordValues(self, records: Any, expected_values: Any): ...
def shortDescription(self) -> None: ... def shortDescription(self) -> None: ...
@@ -123,7 +123,7 @@ class ChromeBrowser:
def _format_stack(self, logrecord: Any) -> None: ... def _format_stack(self, logrecord: Any) -> None: ...
def console_formatter(self, args: Any): ... def console_formatter(self, args: Any): ...
class HttpCase(TransactionCase): class HttpCaseCommon(BaseCase):
registry_test_mode: bool = ... registry_test_mode: bool = ...
browser: Any = ... browser: Any = ...
browser_size: str = ... browser_size: str = ...
@@ -132,20 +132,23 @@ class HttpCase(TransactionCase):
xmlrpc_db: Any = ... xmlrpc_db: Any = ...
xmlrpc_object: Any = ... xmlrpc_object: Any = ...
def __init__(self, methodName: str = ...) -> None: ... def __init__(self, methodName: str = ...) -> None: ...
opener: Any = ...
def setUp(self) -> None: ...
@classmethod @classmethod
def start_browser(cls) -> None: ... def start_browser(cls) -> None: ...
@classmethod @classmethod
def terminate_browser(cls) -> None: ... def terminate_browser(cls) -> None: ...
session: Any = ...
session_id: Any = ...
opener: Any = ...
def setUp(self) -> None: ...
def url_open(self, url: Any, data: Optional[Any] = ..., files: Optional[Any] = ..., timeout: int = ..., headers: Optional[Any] = ..., allow_redirects: bool = ...): ... def url_open(self, url: Any, data: Optional[Any] = ..., files: Optional[Any] = ..., timeout: int = ..., headers: Optional[Any] = ..., allow_redirects: bool = ...): ...
def _wait_remaining_requests(self, timeout: int = ...): ... def _wait_remaining_requests(self, timeout: int = ...): ...
def authenticate(self, user: Any, password: Any) -> None: ... def logout(self, keep_db: bool = ...) -> None: ...
session: Any = ...
def authenticate(self, user: Any, password: Any): ...
def browser_js(self, url_path: Any, code: Any, ready: str = ..., login: Optional[Any] = ..., timeout: int = ..., **kw: Any) -> None: ... def browser_js(self, url_path: Any, code: Any, ready: str = ..., login: Optional[Any] = ..., timeout: int = ..., **kw: Any) -> None: ...
def start_tour(self, url_path: Any, tour_name: Any, step_delay: Optional[Any] = ..., **kwargs: Any): ... def start_tour(self, url_path: Any, tour_name: Any, step_delay: Optional[Any] = ..., **kwargs: Any): ...
class HttpCase(HttpCaseCommon, TransactionCase): ...
class HttpSavepointCase(HttpCaseCommon, SavepointCase): ...
def users(*logins: Any): ... def users(*logins: Any): ...
def warmup(func: Any, *args: Any, **kwargs: Any) -> None: ... def warmup(func: Any, *args: Any, **kwargs: Any) -> None: ...
def can_import(module: Any): ... def can_import(module: Any): ...
@@ -157,7 +160,7 @@ class Form:
def _o2m_set_edition_view(self, descr: Any, node: Any, level: Any) -> None: ... def _o2m_set_edition_view(self, descr: Any, node: Any, level: Any) -> None: ...
def __str__(self): ... def __str__(self): ...
def _process_fvg(self, model: Any, fvg: Any, level: int = ...) -> None: ... def _process_fvg(self, model: Any, fvg: Any, level: int = ...) -> None: ...
def _init_from_defaults(self, model: Any): ... def _init_from_defaults(self, model: Any) -> None: ...
def _init_from_values(self, values: Any) -> None: ... def _init_from_values(self, values: Any) -> None: ...
def __getattr__(self, field: Any): ... def __getattr__(self, field: Any): ...
def _get_modifier(self, field: Any, modifier: Any, default: bool = ..., modmap: Optional[Any] = ..., vals: Optional[Any] = ...): ... def _get_modifier(self, field: Any, modifier: Any, default: bool = ..., modmap: Optional[Any] = ..., vals: Optional[Any] = ...): ...

View File

@@ -0,0 +1,9 @@
from typing import Any
_logger: Any
def get_test_modules(module: Any): ...
def _get_tests_modules(path: Any, module: Any): ...
def make_suite(module_name: Any, position: str = ...): ...
def run_suite(suite: Any, module_name: Any): ...
def unwrap_suite(test: Any) -> None: ...

View File

@@ -0,0 +1,22 @@
import unittest
from typing import Any, Optional
_logger: Any
class OdooTestResult(unittest.result.TestResult):
time_start: Any = ...
queries_start: Any = ...
def __init__(self) -> None: ...
def __str__(self): ...
shouldStop: Any = ...
def update(self, other: Any) -> None: ...
def log(self, level: Any, msg: Any, *args: Any, test: Optional[Any] = ..., exc_info: Optional[Any] = ..., extra: Optional[Any] = ..., stack_info: bool = ..., caller_infos: Optional[Any] = ...) -> None: ...
def getDescription(self, test: Any): ...
def startTest(self, test: Any) -> None: ...
def addError(self, test: Any, err: Any) -> None: ...
def addFailure(self, test: Any, err: Any) -> None: ...
def addSubTest(self, test: Any, subtest: Any, err: Any) -> None: ...
def addSkip(self, test: Any, reason: Any) -> None: ...
def addUnexpectedSuccess(self, test: Any) -> None: ...
def logError(self, flavour: Any, test: Any, error: Any) -> None: ...
def getErrorCallerInfo(self, error: Any, test: Any): ...

View File

@@ -10,5 +10,5 @@ from .xml_utils import *
from .date_utils import * from .date_utils import *
from .convert import * from .convert import *
from .template_inheritance import * from .template_inheritance import *
from . import appdirs as appdirs, osutil as osutil, pdf as pdf, pycompat as pycompat, win32 as win32 from . import appdirs as appdirs, cloc as cloc, osutil as osutil, pdf as pdf, pycompat as pycompat, win32 as win32
from .config import config as config from .config import config as config

24
odoo-stubs/tools/cloc.pyi Normal file
View File

@@ -0,0 +1,24 @@
from typing import Any, Optional
VERSION: int
DEFAULT_EXCLUDE: Any
STANDARD_MODULES: Any
MAX_FILE_SIZE: Any
class Cloc:
modules: Any = ...
code: Any = ...
total: Any = ...
errors: Any = ...
max_width: int = ...
def __init__(self) -> None: ...
def parse_xml(self, s: Any): ...
def parse_py(self, s: Any): ...
def parse_js(self, s: Any): ...
def book(self, module: Any, item: str = ..., count: Any = ...) -> None: ...
def count_path(self, path: Any, exclude: Optional[Any] = ...) -> None: ...
def count_modules(self, env: Any) -> None: ...
def count_customization(self, env: Any) -> None: ...
def count_env(self, env: Any) -> None: ...
def count_database(self, database: Any) -> None: ...
def report(self, verbose: bool = ..., width: Optional[Any] = ...): ...

View File

@@ -2,6 +2,7 @@ from .misc import ustr as ustr
from odoo import api as api from odoo import api as api
from typing import Any, Optional from typing import Any, Optional
__all__: Any
_logger: Any _logger: Any
safe_eval: Any safe_eval: Any
@@ -26,7 +27,7 @@ class xml_import:
def _tag_report(self, rec: Any): ... def _tag_report(self, rec: Any): ...
def _tag_function(self, rec: Any) -> None: ... def _tag_function(self, rec: Any) -> None: ...
def _tag_act_window(self, rec: Any) -> None: ... def _tag_act_window(self, rec: Any) -> None: ...
def _tag_menuitem(self, rec: Any) -> None: ... def _tag_menuitem(self, rec: Any, parent: Optional[Any] = ...) -> None: ...
def _tag_record(self, rec: Any): ... def _tag_record(self, rec: Any): ...
def _tag_template(self, el: Any): ... def _tag_template(self, el: Any): ...
def id_get(self, id_str: Any, raise_if_not_found: bool = ...): ... def id_get(self, id_str: Any, raise_if_not_found: bool = ...): ...
@@ -40,15 +41,14 @@ class xml_import:
module: Any = ... module: Any = ...
envs: Any = ... envs: Any = ...
idref: Any = ... idref: Any = ...
assertion_report: Any = ...
_noupdate: Any = ... _noupdate: Any = ...
xml_filename: Any = ... xml_filename: Any = ...
_tags: Any = ... _tags: Any = ...
def __init__(self, cr: Any, module: Any, idref: Any, mode: Any, report: Optional[Any] = ..., noupdate: bool = ..., xml_filename: Optional[Any] = ...) -> None: ... def __init__(self, cr: Any, module: Any, idref: Any, mode: Any, noupdate: bool = ..., xml_filename: Optional[Any] = ...) -> None: ...
def parse(self, de: Any) -> None: ... def parse(self, de: Any) -> None: ...
DATA_ROOTS: Any = ... DATA_ROOTS: Any = ...
def convert_file(cr: Any, module: Any, filename: Any, idref: Any, mode: str = ..., noupdate: bool = ..., kind: Optional[Any] = ..., report: Optional[Any] = ..., pathname: Optional[Any] = ...) -> None: ... def convert_file(cr: Any, module: Any, filename: Any, idref: Any, mode: str = ..., noupdate: bool = ..., kind: Optional[Any] = ..., pathname: Optional[Any] = ...) -> None: ...
def convert_sql_import(cr: Any, fp: Any) -> None: ... def convert_sql_import(cr: Any, fp: Any) -> None: ...
def convert_csv_import(cr: Any, module: Any, fname: Any, csvcontent: Any, idref: Optional[Any] = ..., mode: str = ..., noupdate: bool = ...) -> None: ... def convert_csv_import(cr: Any, module: Any, fname: Any, csvcontent: Any, idref: Optional[Any] = ..., mode: str = ..., noupdate: bool = ...) -> None: ...
def convert_xml_import(cr: Any, module: Any, xmlfile: Any, idref: Optional[Any] = ..., mode: str = ..., noupdate: bool = ..., report: Optional[Any] = ...) -> None: ... def convert_xml_import(cr: Any, module: Any, xmlfile: Any, idref: Optional[Any] = ..., mode: str = ..., noupdate: bool = ..., report: Optional[Any] = ...) -> None: ...

View File

@@ -0,0 +1,9 @@
from typing import Any
JSON_SCRIPTSAFE_MAPPER: Any
class JSON:
def loads(self, *args: Any, **kwargs: Any): ...
def dumps(self, *args: Any, **kwargs: Any): ...
scriptsafe: Any

View File

@@ -21,6 +21,7 @@ def html_sanitize(src: Any, silent: bool = ..., sanitize_tags: bool = ..., sanit
URL_REGEX: str URL_REGEX: str
TEXT_URL_REGEX: str TEXT_URL_REGEX: str
HTML_TAG_URL_REGEX: Any
def validate_url(url: Any): ... def validate_url(url: Any): ...
def is_html_empty(html_content: Any): ... def is_html_empty(html_content: Any): ...
@@ -28,6 +29,7 @@ def html_keep_url(text: Any): ...
def html2plaintext(html: Any, body_id: Optional[Any] = ..., encoding: str = ...): ... def html2plaintext(html: Any, body_id: Optional[Any] = ..., encoding: str = ...): ...
def plaintext2html(text: Any, container_tag: bool = ...): ... def plaintext2html(text: Any, container_tag: bool = ...): ...
def append_content_to_html(html: Any, content: Any, plaintext: bool = ..., preserve: bool = ..., container_tag: bool = ...): ... def append_content_to_html(html: Any, content: Any, plaintext: bool = ..., preserve: bool = ..., container_tag: bool = ...): ...
def prepend_html_content(html_body: Any, html_content: Any): ...
email_re: Any email_re: Any
single_email_re: Any single_email_re: Any

View File

@@ -2,7 +2,6 @@ from .cache import *
import pickle as pickle_ import pickle as pickle_
import xlsxwriter import xlsxwriter
import xlwt import xlwt
from collections import defaultdict
from collections.abc import Mapping, MutableMapping, MutableSet from collections.abc import Mapping, MutableMapping, MutableSet
from odoo.loglevels import exception_to_unicode as exception_to_unicode, get_encodings as get_encodings from odoo.loglevels import exception_to_unicode as exception_to_unicode, get_encodings as get_encodings
from typing import Any, Optional from typing import Any, Optional
@@ -146,11 +145,13 @@ class OrderedSet(MutableSet):
class LastOrderedSet(OrderedSet): class LastOrderedSet(OrderedSet):
def add(self, elem: Any) -> None: ... def add(self, elem: Any) -> None: ...
class GroupCalls: class Callbacks:
_func_args: Any = ... __slots__: Any = ...
_funcs: Any = ...
data: Any = ...
def __init__(self) -> None: ... def __init__(self) -> None: ...
def __call__(self) -> None: ... def add(self, func: Any) -> None: ...
def add(self, func: Any, *types: Any): ... def run(self) -> None: ...
def clear(self) -> None: ... def clear(self) -> None: ...
class IterableGenerator: class IterableGenerator:
@@ -183,6 +184,8 @@ def parse_date(env: Any, value: Any, lang_code: bool = ...): ...
def format_datetime(env: Any, value: Any, tz: bool = ..., dt_format: str = ..., lang_code: bool = ...): ... def format_datetime(env: Any, value: Any, tz: bool = ..., dt_format: str = ..., lang_code: bool = ...): ...
def format_time(env: Any, value: Any, tz: bool = ..., time_format: str = ..., lang_code: bool = ...): ... def format_time(env: Any, value: Any, tz: bool = ..., time_format: str = ..., lang_code: bool = ...): ...
def _format_time_ago(env: Any, time_delta: Any, lang_code: bool = ..., add_direction: bool = ...): ... def _format_time_ago(env: Any, time_delta: Any, lang_code: bool = ..., add_direction: bool = ...): ...
def format_decimalized_number(number: Any, decimal: int = ...): ...
def format_decimalized_amount(amount: Any, currency: Optional[Any] = ...): ...
def format_amount(env: Any, amount: Any, currency: Any, lang_code: bool = ...): ... def format_amount(env: Any, amount: Any, currency: Any, lang_code: bool = ...): ...
def format_duration(value: Any): ... def format_duration(value: Any): ...
def _consteq(str1: Any, str2: Any): ... def _consteq(str1: Any, str2: Any): ...
@@ -197,8 +200,6 @@ def _pickle_load(stream: Any, encoding: str = ..., errors: bool = ...): ...
pickle: Any pickle: Any
def wrap_module(module: Any, attr_list: Any): ...
class DotDict(dict): class DotDict(dict):
def __getattr__(self, attrib: Any): ... def __getattr__(self, attrib: Any): ...

View File

@@ -1,10 +1,12 @@
from PyPDF2 import PdfFileReader, PdfFileWriter from PyPDF2 import PdfFileReader, PdfFileWriter
from PyPDF2.generic import ArrayObject as ArrayObject from PyPDF2.generic import ArrayObject as ArrayObject
from PyPDF2.utils import b_ as b_ from PyPDF2.utils import b_ as b_
from typing import Any from typing import Any, Optional
DEFAULT_PDF_DATETIME_FORMAT: str DEFAULT_PDF_DATETIME_FORMAT: str
def _unwrapping_get(self, key: Any, default: Optional[Any] = ...): ...
class BrandedFileWriter(PdfFileWriter): class BrandedFileWriter(PdfFileWriter):
def __init__(self) -> None: ... def __init__(self) -> None: ...
PdfFileWriter = BrandedFileWriter PdfFileWriter = BrandedFileWriter
@@ -12,6 +14,8 @@ PdfFileWriter = BrandedFileWriter
def merge_pdf(pdf_data: Any): ... def merge_pdf(pdf_data: Any): ...
def rotate_pdf(pdf: Any): ... def rotate_pdf(pdf: Any): ...
old_init: Any
class OdooPdfFileReader(PdfFileReader): class OdooPdfFileReader(PdfFileReader):
def getAttachments(self): ... def getAttachments(self): ...

View File

@@ -26,3 +26,15 @@ _BUILTINS: Any
def safe_eval(expr: Any, globals_dict: Optional[Any] = ..., locals_dict: Optional[Any] = ..., mode: str = ..., nocopy: bool = ..., locals_builtins: bool = ...): ... def safe_eval(expr: Any, globals_dict: Optional[Any] = ..., locals_dict: Optional[Any] = ..., mode: str = ..., nocopy: bool = ..., locals_builtins: bool = ...): ...
def test_python_expr(expr: Any, mode: str = ...): ... def test_python_expr(expr: Any, mode: str = ...): ...
def check_values(d: Any): ...
class wrap_module:
_repr: Any = ...
def __init__(self, module: Any, attributes: Any) -> None: ...
def __repr__(self): ...
mods: Any
datetime: Any
json: Any
time: Any
pytz: Any

View File

@@ -27,3 +27,4 @@ def drop_view_if_exists(cr: Any, viewname: Any) -> None: ...
def escape_psql(to_escape: Any): ... def escape_psql(to_escape: Any): ...
def pg_varchar(size: int = ...): ... def pg_varchar(size: int = ...): ...
def reverse_order(order: Any): ... def reverse_order(order: Any): ...
def increment_field_skiplock(record: Any, field: Any): ...

View File

@@ -36,16 +36,19 @@ class GettextAlias:
def _get_cr(self, frame: Any, allow_create: bool = ...): ... def _get_cr(self, frame: Any, allow_create: bool = ...): ...
def _get_uid(self, frame: Any): ... def _get_uid(self, frame: Any): ...
def _get_lang(self, frame: Any): ... def _get_lang(self, frame: Any): ...
def __call__(self, source: Any): ... def __call__(self, source: Any, *args: Any, **kwargs: Any): ...
def _get_translation(self, source: Any): ... def _get_translation(self, source: Any): ...
class _lt: class _lt:
__slots__: Any = ... __slots__: Any = ...
_source: Any = ... _source: Any = ...
def __init__(self, source: Any) -> None: ... _args: Any = ...
def __init__(self, source: Any, *args: Any, **kwargs: Any) -> None: ...
def __str__(self): ... def __str__(self): ...
def __eq__(self, other: Any) -> Any: ... def __eq__(self, other: Any) -> Any: ...
def __lt__(self, other: Any) -> Any: ... def __lt__(self, other: Any) -> Any: ...
def __add__(self, other: Any): ...
def __radd__(self, other: Any): ...
_: Any _: Any

View File

@@ -1,7 +1,11 @@
from odoo.tools.misc import file_open as file_open from lxml import etree
from typing import Any, Optional from typing import Any, Optional
def check_with_xsd(tree_or_str: Any, stream: Any) -> None: ... class odoo_resolver(etree.Resolver):
def _check_with_xsd(tree_or_str: Any, stream: Any) -> None: ... env: Any = ...
def __init__(self, env: Any) -> None: ...
def resolve(self, url: Any, id: Any, context: Any): ...
def _check_with_xsd(tree_or_str: Any, stream: Any, env: Optional[Any] = ...) -> None: ...
def create_xml_node_chain(first_parent_node: Any, nodes_list: Any, last_node_value: Optional[Any] = ...): ... def create_xml_node_chain(first_parent_node: Any, nodes_list: Any, last_node_value: Optional[Any] = ...): ...
def create_xml_node(parent_node: Any, node_name: Any, node_value: Optional[Any] = ...): ... def create_xml_node(parent_node: Any, node_name: Any, node_value: Optional[Any] = ...): ...