Python package to collect and analyze data from Odoo module folders without requiring an Odoo runtime. It performs static file analysis to extract useful information from Odoo modules.
- Static Analysis: Doesn't rely on any Odoo runtime; performs static files analysis
- Code Statistics: Count lines of code (Python, XML, JavaScript, and CSS)
- Manifest Parsing: Extract useful data from manifest files (authors, dependencies, etc.)
- Model Extraction: Extract Odoo models information (with fields and methods)
- Data Extraction: Extract data from XML and CSV files
- Flexible Scanning: Scan individual modules, repositories, or entire Odoo source code
uv pip install odoo-addons-parserOr with pip:
pip install odoo-addons-parserParse a single Odoo module:
from odoo_addons_parser import ModuleParser
from pprint import pprint as pp
mod = ModuleParser("/path/to/OCA/server-tools/server_environment")
pp(mod.to_dict())Example output:
{
'code': {'CSS': 0, 'JavaScript': 0, 'Python': 541, 'XML': 21},
'manifest': {
'author': 'Camptocamp,Odoo Community Association (OCA)',
'category': 'Tools',
'data': ['security/ir.model.access.csv', 'security/res_groups.xml', 'serv_config.xml'],
'depends': ['base', 'base_sparse_field'],
'installable': True,
'license': 'GPL-3 or any later version',
'name': 'server configuration environment files',
'summary': 'move some configurations out of the database',
'version': '14.0.1.0.0',
'website': 'https://github.com/OCA/server-env'
},
'models': ...,
'name': 'server_environment'
}Parse a whole repository of addons:
from odoo_addons_parser import RepositoryParser
repo = RepositoryParser("/path/to/OCA/server-tools")
pp(repo.to_dict())Parse the Odoo source code repository:
from odoo_addons_parser import OdooParser
odoo = OdooParser("/path/to/odoo/odoo")
data = odoo.to_dict()
list(data["__odoo__"]["models"])
# ["BaseModel", "Model", "TransientModel"]
"res.partner" in data["base"]["models"]
# TrueYou can disable specific features using parameters:
# Disable code statistics
repo = RepositoryParser("path/to/addons_path", code_stats=False)
# Disable model scanning
mod = ModuleParser("path/to/addons_path/module", scan_models=False)
# Disable data scanning
mod = ModuleParser("path/to/addons_path/module", scan_data=False)
# Disable all
odoo = OdooParser("/path/to/odoo/odoo", code_stats=False, scan_models=False, scan_data=False)This project is licensed under the LGPL-3.0 License - see the LICENSE file for details.