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.
By using these stubs, IDEs will provide better code completion, and static type checkers will provide better reports. These stubs should be used in conjunction with:
Example, for Odoo 16:
git clone -b 16.0 https://github.com/odoo-ide/odoo-stubs.git odoo-stubs16
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.
Create pyrightconfig.json
in the Odoo source code folder
(should be the root folder of your workspace) with something like the following example:
{
"stubPath": "path/to/odoo-stubs"
}