Trinh Anh Ngoc c39c364a9c Update stubs
2024-10-09 17:16:38 +07:00
2023-05-11 16:59:50 +07:00
2024-10-09 17:16:38 +07:00
2019-12-13 11:39:25 +07:00
2023-07-26 16:51:22 +07:00
2022-01-09 17:52:57 +07:00

Odoo Stubs

A stub file is a file containing a skeleton of the public interface of that Python module, including classes, variables, functions and most importantly, their types.

https://mypy.readthedocs.io/en/stable/stubs.html

By using these stubs, IDEs will provide better code completion, and static type checkers will provide better reports.

Usage

If you are using the PyCharm plugin for Odoo or the VSCode extension for Odoo, then you don't need to setup Odoo Stubs manually as they already have built-in Odoo Stubs. If not, you can follow these instructions for manually setup.

1. Clone the branch corresponding to the Odoo version

Example, for Odoo 16:

git clone -b 16.0 https://github.com/odoo-ide/odoo-stubs.git odoo-stubs16

2. Configure IDEs

PyCharm

First make sure you have attached the Odoo source code to your project. Then open Settings > Project > Project Structure, select the project containing the Odoo source code and click Add Content Root to add the odoo-stubs folder.

PyCharm

Visual Studio Code

Add the odoo-stubs folder to the stubPath or extraPaths settings as described in the import resolution documentation.

VSCode

Description
This is used by PyCharm Odoo to help PyCharm better understands your Odoo source code.
Readme 4.1 MiB
Languages
Python 100%