[IMP] upgrade-util: link code documentation

Add direct code documentation from upgrade-util repo.
Adapt `extensions/github_link`.

Original commit: 3352d33997

X-original-commit: 26fd5f3192
Part-of: odoo/documentation#8849
Co-authored-by: Victor Feyens <vfe@odoo.com>
This commit is contained in:
Alvaro Fuentes
2024-04-15 11:30:21 +02:00
committed by Victor Feyens
parent 4a0624c897
commit 16fd9dc828
3 changed files with 47 additions and 27 deletions
+21
View File
@@ -133,6 +133,24 @@ else:
)
odoo_dir_in_path = True
if odoo_dir_in_path:
upgrade_util_dir = next(filter(Path.exists, [Path('upgrade-util'), Path('../upgrade-util')]), None)
if not upgrade_util_dir:
_logger.warning(
"Could not find Upgrade Utils sources directory in `upgrade_util`.\n"
"The developer documentation will be built but autodoc directives will be skipped.\n"
"In order to fully build the 'Developer' documentation, clone the repository with "
"`git clone https://github.com/odoo/upgrade-util` or create a symbolic link."
)
odoo_dir_in_path = False
else:
_logger.info(
"Found Upgrade Util sources in %(directory)s",
{'directory': upgrade_util_dir.resolve()},
)
from odoo import upgrade
upgrade.__path__.append(str((upgrade_util_dir / 'src').resolve()))
# Mapping between odoo models related to master data and the declaration of the
# data. This is used to point users to available xml_ids when giving values for
# a field with the autodoc_field extension.
@@ -250,6 +268,9 @@ redirects_dir = 'redirects/'
sphinx_tabs_disable_tab_closing = True
sphinx_tabs_disable_css_loading = True
# Autodoc ordering
autodoc_member_order = 'bysource'
#=== Options for HTML output ===#
html_theme = 'odoo_theme'