Compare commits
29 Commits
danielacan
...
18.0
Author | SHA1 | Date | |
---|---|---|---|
4be6903e8f | |||
680f763c50 | |||
7df4811b76 | |||
d606713b6b | |||
e460e4553a | |||
21637a5c25 | |||
ec733fcc15 | |||
0e357b4ef8 | |||
5e3590e329 | |||
4a20dde950 | |||
44d23b4aba | |||
52ff35cc22 | |||
dd90f6bd9f | |||
ebc2396ce2 | |||
71c1aeb355 | |||
507ec45616 | |||
fb158c3b6d | |||
6b0c648c8e | |||
d9cb9d975f | |||
fb57c796ee | |||
637a4dd9fd | |||
ef68fdc2d9 | |||
a0a0927d44 | |||
3b5a2fe97d | |||
8135ed831d | |||
060548df53 | |||
181c51c9ed | |||
a94d72c241 | |||
33819509a4 |
1
.gitignore
vendored
@ -8,3 +8,4 @@ _build/
|
|||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
odoo
|
odoo
|
||||||
|
venv/
|
34
Makefile
@ -14,6 +14,7 @@ ifndef CURRENT_LANG
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
SPHINX_BUILD = sphinx-build
|
SPHINX_BUILD = sphinx-build
|
||||||
|
SPHINX_AUTO_BUILD = sphinx-autobuild
|
||||||
CONFIG_DIR = .
|
CONFIG_DIR = .
|
||||||
SPHINXOPTS = -D project_root=$(ROOT) -D canonical_version=$(CANONICAL_VERSION) \
|
SPHINXOPTS = -D project_root=$(ROOT) -D canonical_version=$(CANONICAL_VERSION) \
|
||||||
-D versions=$(VERSIONS) -D languages=$(LANGUAGES) -D language=$(CURRENT_LANG) \
|
-D versions=$(VERSIONS) -D languages=$(LANGUAGES) -D language=$(CURRENT_LANG) \
|
||||||
@ -24,7 +25,18 @@ SPHINXOPTS = -D project_root=$(ROOT) -D canonical_version=$(CANONICAL_VERSIO
|
|||||||
-A plausible_domain=$(PLAUSIBLE_DOMAIN) \
|
-A plausible_domain=$(PLAUSIBLE_DOMAIN) \
|
||||||
-j $(WORKERS)
|
-j $(WORKERS)
|
||||||
SOURCE_DIR = content
|
SOURCE_DIR = content
|
||||||
|
THEME = extensions/odoo_theme
|
||||||
|
THEME_STATIC = extensions/odoo_theme/static
|
||||||
|
LOCALE = locale
|
||||||
|
STATIC = static
|
||||||
|
REDIRECTS = redirects
|
||||||
|
SERVER_IP := $(shell ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
|
||||||
|
# Get all listening ports
|
||||||
|
LISTENING_PORTS := $(shell ss -tuln | awk 'NR>1 {print $$4}' | awk -F: '{print $$NF}' | sort -n | uniq)
|
||||||
|
LOGFILE := $(BUILD_DIR)/live_server.log
|
||||||
|
# Default port
|
||||||
|
OPEN_PORTS := $(shell ss -tuln | awk 'NR>1 {print $$4}' | awk -F: '{print $$NF}' | sort -n | uniq)
|
||||||
|
SELECTED_PORT := $(shell echo "$(OPEN_PORTS)" | awk 'NR==1')
|
||||||
HTML_BUILD_DIR = $(BUILD_DIR)/html
|
HTML_BUILD_DIR = $(BUILD_DIR)/html
|
||||||
ifdef VERSIONS
|
ifdef VERSIONS
|
||||||
HTML_BUILD_DIR := $(HTML_BUILD_DIR)/18.0
|
HTML_BUILD_DIR := $(HTML_BUILD_DIR)/18.0
|
||||||
@ -52,8 +64,24 @@ clean:
|
|||||||
|
|
||||||
html: $(HTML_BUILD_DIR)/_static/style.css
|
html: $(HTML_BUILD_DIR)/_static/style.css
|
||||||
@echo "Starting build..."
|
@echo "Starting build..."
|
||||||
$(SPHINX_BUILD) -c $(CONFIG_DIR) -b html $(SPHINXOPTS) $(SOURCE_DIR) $(HTML_BUILD_DIR)
|
$(SPHINX_BUILD) -q -c $(CONFIG_DIR) -b html $(SPHINXOPTS) $(SOURCE_DIR) $(HTML_BUILD_DIR)
|
||||||
@echo "Build finished."
|
@echo "Build finished."
|
||||||
|
html_log: SPHINXOPTS += -A collapse_menu=True
|
||||||
|
html_log: $(HTML_BUILD_DIR)/_static/style.css
|
||||||
|
@echo "Starting build..."
|
||||||
|
$(SPHINX_BUILD) -q -c $(CONFIG_DIR) -b html $(SPHINXOPTS) $(SOURCE_DIR) $(HTML_BUILD_DIR) > $(LOGFILE) 2>&1
|
||||||
|
@echo "Build finished."
|
||||||
|
|
||||||
|
live: SPHINXOPTS += -A collapse_menu=True
|
||||||
|
live:
|
||||||
|
@echo "Starting Live Server..."
|
||||||
|
$(SPHINX_AUTO_BUILD) $(SOURCE_DIR) $(HTML_BUILD_DIR) \
|
||||||
|
--port 8000 --host $(SERVER_IP) \
|
||||||
|
--watch $(THEME) --watch $(LOCALE) --watch $(STATIC) --watch $(REDIRECTS) --watch $(THEME_STATIC) --watch . \
|
||||||
|
--pre-build "sh -c 'mkdir -p $(HTML_BUILD_DIR)/_static && python3 -m pysassc $(THEME)/static/style.scss $(HTML_BUILD_DIR)/_static/style.css'" \
|
||||||
|
$(SPHINXOPTS) -c $(CONFIG_DIR) -b html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# To call *after* `make html`
|
# To call *after* `make html`
|
||||||
# Binary dependencies (Debian): texlive-fonts-recommended texlive-latex-extra
|
# Binary dependencies (Debian): texlive-fonts-recommended texlive-latex-extra
|
||||||
@ -79,7 +107,7 @@ $(HTML_BUILD_DIR)/_static/style.css: extensions/odoo_theme/static/style.scss ext
|
|||||||
#=== Development and debugging rules ===#
|
#=== Development and debugging rules ===#
|
||||||
|
|
||||||
fast: SPHINXOPTS += -A collapse_menu=True
|
fast: SPHINXOPTS += -A collapse_menu=True
|
||||||
fast: html
|
fast: hmlt
|
||||||
|
|
||||||
static: $(HTML_BUILD_DIR)/_static/style.css
|
static: $(HTML_BUILD_DIR)/_static/style.css
|
||||||
cp -r extensions/odoo_theme/static/* $(HTML_BUILD_DIR)/_static/
|
cp -r extensions/odoo_theme/static/* $(HTML_BUILD_DIR)/_static/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Odoo documentation
|
# Documentation
|
||||||
|
|
||||||
## Build the documentation locally
|
## Build the documentation locally
|
||||||
|
|
||||||
|
526
conf.py
@ -13,86 +13,92 @@ from sphinx.util import logging
|
|||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
#=== General configuration ===#
|
# === General configuration ===#
|
||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = 'Odoo'
|
project = "Odoo"
|
||||||
copyright = 'Odoo S.A.'
|
copyright = "Odoo S.A."
|
||||||
|
|
||||||
# `version` is the version info for the project being documented, acts as replacement for |version|,
|
# `version` is the version info for the project being documented, acts as replacement for |version|,
|
||||||
# also used in various other places throughout the built documents.
|
# also used in various other places throughout the built documents.
|
||||||
# `release` is the full version, including alpha/beta/rc tags. Acts as replacement for |release|.
|
# `release` is the full version, including alpha/beta/rc tags. Acts as replacement for |release|.
|
||||||
version = release = '18.0'
|
version = release = "18.0"
|
||||||
|
|
||||||
# `current_branch` is the technical name of the current branch.
|
# `current_branch` is the technical name of the current branch.
|
||||||
# E.g., saas-15.4 -> saas-15.4; 12.0 -> 12.0, master -> master (*).
|
# E.g., saas-15.4 -> saas-15.4; 12.0 -> 12.0, master -> master (*).
|
||||||
current_branch = version
|
current_branch = version
|
||||||
# `current_version` is the Odoo version linked to the current branch.
|
# `current_version` is the Odoo version linked to the current branch.
|
||||||
# E.g., saas-15.4 -> 15.4; 12.0 -> 12; master -> master (*).
|
# E.g., saas-15.4 -> 15.4; 12.0 -> 12; master -> master (*).
|
||||||
current_version = current_branch.replace('saas-', '').replace('.0', '')
|
current_version = current_branch.replace("saas-", "").replace(".0", "")
|
||||||
# `current_major_branch` is the technical name of the major branch before the current branch.
|
# `current_major_branch` is the technical name of the major branch before the current branch.
|
||||||
# E.g., saas-15.4 -> 15.0; 12.0 -> 12.0; master -> master (*).
|
# E.g., saas-15.4 -> 15.0; 12.0 -> 12.0; master -> master (*).
|
||||||
current_major_branch = re.sub(r'\.\d', '.0', current_branch.replace('saas-', ''))
|
current_major_branch = re.sub(r"\.\d", ".0", current_branch.replace("saas-", ""))
|
||||||
# `current_major_version` is the Odoo version linked to the current major branch.
|
# `current_major_version` is the Odoo version linked to the current major branch.
|
||||||
# E.g., saas-15.4 -> 15; 12.0 -> 12; master -> master (*).
|
# E.g., saas-15.4 -> 15; 12.0 -> 12; master -> master (*).
|
||||||
current_major_version = current_major_branch.replace('.0', '')
|
current_major_version = current_major_branch.replace(".0", "")
|
||||||
# (*): We don't care for master.
|
# (*): We don't care for master.
|
||||||
|
|
||||||
# The minimal Sphinx version required to build the documentation.
|
# The minimal Sphinx version required to build the documentation.
|
||||||
needs_sphinx = '3.0.0'
|
needs_sphinx = "3.0.0"
|
||||||
|
|
||||||
# The default language in which the documentation is written. It is set to `None` because Sphinx
|
# The default language in which the documentation is written. It is set to `None` because Sphinx
|
||||||
# considers that no language means 'en'.
|
# considers that no language means 'en'.
|
||||||
language = None
|
language = None
|
||||||
|
|
||||||
# The suffix of source filenames.
|
# The suffix of source filenames.
|
||||||
source_suffix = '.rst'
|
source_suffix = {
|
||||||
|
".md": "markdown",
|
||||||
|
".rst": "restructuredtext",
|
||||||
|
}
|
||||||
|
|
||||||
# The master toctree document.
|
# The master toctree document.
|
||||||
master_doc = 'index'
|
master_doc = "index"
|
||||||
|
|
||||||
# List of patterns, relative to source directory, that match files and directories to ignore when
|
# List of patterns, relative to source directory, that match files and directories to ignore when
|
||||||
# looking for source files.
|
# looking for source files.
|
||||||
exclude_patterns = [
|
exclude_patterns = [
|
||||||
'locale',
|
"locale",
|
||||||
'README.*',
|
"README.*",
|
||||||
'bin', 'include', 'lib',
|
"bin",
|
||||||
'odoo',
|
"include",
|
||||||
|
"lib",
|
||||||
|
"odoo",
|
||||||
]
|
]
|
||||||
|
|
||||||
# The RST text role to use when the role is not specified. E.g.: `example`.
|
# The RST text role to use when the role is not specified. E.g.: `example`.
|
||||||
# We use 'literal' as default role for markdown compatibility: `foo` behaves like ``foo``.
|
# We use 'literal' as default role for markdown compatibility: `foo` behaves like ``foo``.
|
||||||
# See https://docutils.sourceforge.io/docs/ref/rst/roles.html#standard-roles for other roles.
|
# See https://docutils.sourceforge.io/docs/ref/rst/roles.html#standard-roles for other roles.
|
||||||
default_role = 'literal'
|
default_role = "literal"
|
||||||
|
|
||||||
|
|
||||||
|
html_copy_source = False
|
||||||
# Whether scaled down images should be be wrapped in a `<a/>` tag linking to the image file or not.
|
# Whether scaled down images should be be wrapped in a `<a/>` tag linking to the image file or not.
|
||||||
html_scaled_image_link = False
|
html_scaled_image_link = False
|
||||||
|
|
||||||
# If true, '()' will be appended to :func: etc. cross-reference text
|
# If true, '()' will be appended to :func: etc. cross-reference text
|
||||||
add_function_parentheses = True
|
add_function_parentheses = True
|
||||||
|
|
||||||
#=== Extensions configuration ===#
|
# === Extensions configuration ===#
|
||||||
|
|
||||||
source_read_replace_vals = {
|
source_read_replace_vals = {
|
||||||
'BRANCH': current_branch,
|
"BRANCH": current_branch,
|
||||||
'CURRENT_BRANCH': current_branch,
|
"CURRENT_BRANCH": current_branch,
|
||||||
'CURRENT_VERSION': current_version,
|
"CURRENT_VERSION": current_version,
|
||||||
'CURRENT_MAJOR_BRANCH': current_major_branch,
|
"CURRENT_MAJOR_BRANCH": current_major_branch,
|
||||||
'CURRENT_MAJOR_VERSION': current_major_version,
|
"CURRENT_MAJOR_VERSION": current_major_version,
|
||||||
'GITHUB_PATH': f'https://github.com/odoo/odoo/blob/{version}',
|
"GITHUB_PATH": f"https://github.com/odoo/odoo/blob/{version}",
|
||||||
'GITHUB_ENT_PATH': f'https://github.com/odoo/enterprise/blob/{version}',
|
"GITHUB_ENT_PATH": f"https://github.com/odoo/enterprise/blob/{version}",
|
||||||
'OWL_PATH': f'https://github.com/odoo/owl/blob/master',
|
"OWL_PATH": f"https://github.com/odoo/owl/blob/master",
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add extensions directory to PYTHONPATH
|
# Add extensions directory to PYTHONPATH
|
||||||
extension_dir = Path('extensions')
|
extension_dir = Path("extensions")
|
||||||
sys.path.insert(0, str(extension_dir.absolute()))
|
sys.path.insert(0, str(extension_dir.absolute()))
|
||||||
|
|
||||||
# Search for the directory of odoo sources to know whether autodoc should be used on the dev doc
|
# Search for the directory of odoo sources to know whether autodoc should be used on the dev doc
|
||||||
odoo_sources_candidate_dirs = (Path('odoo'), Path('../odoo'))
|
odoo_sources_candidate_dirs = (Path("Odoo18"), Path("../Odoo18"))
|
||||||
|
# odoo_sources_candidate_dirs = (Path('odoo'), Path('../odoo'))
|
||||||
odoo_sources_dirs = [
|
odoo_sources_dirs = [
|
||||||
d for d in odoo_sources_candidate_dirs if d.is_dir() and (d / 'odoo-bin').exists()
|
d for d in odoo_sources_candidate_dirs if d.is_dir() and (d / "odoo-bin").exists()
|
||||||
]
|
]
|
||||||
odoo_dir_in_path = False
|
odoo_dir_in_path = False
|
||||||
|
|
||||||
@ -103,20 +109,30 @@ if not odoo_sources_dirs:
|
|||||||
"The 'Developer' documentation will be built but autodoc directives will be skipped.\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 "
|
"In order to fully build the 'Developer' documentation, clone the repository with "
|
||||||
"`git clone https://github.com/odoo/odoo` or create a symbolic link.",
|
"`git clone https://github.com/odoo/odoo` or create a symbolic link.",
|
||||||
{'dir_list': '\n'.join([f'\t- {d.resolve()}' for d in odoo_sources_candidate_dirs])},
|
{
|
||||||
|
"dir_list": "\n".join(
|
||||||
|
[f"\t- {d.resolve()}" for d in odoo_sources_candidate_dirs]
|
||||||
|
)
|
||||||
|
},
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if (3, 6) < sys.version_info < (3, 7):
|
if (3, 6) < sys.version_info < (3, 7):
|
||||||
# Running odoo needs python 3.7 min but monkey patch version_info to be compatible with 3.6.
|
# Running odoo needs python 3.7 min but monkey patch version_info to be compatible with 3.6.
|
||||||
sys.version_info = (3, 7, 0)
|
sys.version_info = (3, 7, 0)
|
||||||
odoo_dir = odoo_sources_dirs[0].resolve()
|
odoo_dir = odoo_sources_dirs[0].resolve()
|
||||||
source_read_replace_vals['ODOO_RELPATH'] = '/../' + str(odoo_sources_dirs[0])
|
source_read_replace_vals["ODOO_RELPATH"] = "/../" + str(odoo_sources_dirs[0])
|
||||||
sys.path.insert(0, str(odoo_dir))
|
sys.path.insert(0, str(odoo_dir))
|
||||||
import odoo.addons
|
import odoo.addons
|
||||||
odoo.addons.__path__.append(str(odoo_dir) + '/addons')
|
|
||||||
from odoo import release as odoo_release # Don't collide with Sphinx's 'release' config option
|
odoo.addons.__path__.append(str(odoo_dir) + "/addons")
|
||||||
odoo_version = '.'.join(str(s) for s in odoo_release.version_info[:2]).replace('~', '-') # Change saas~XX.Y to saas-XX.Y
|
from odoo import (
|
||||||
odoo_version = 'master' if 'alpha' in odoo_release.version else odoo_version
|
release as odoo_release,
|
||||||
|
) # Don't collide with Sphinx's 'release' config option
|
||||||
|
|
||||||
|
odoo_version = ".".join(str(s) for s in odoo_release.version_info[:2]).replace(
|
||||||
|
"~", "-"
|
||||||
|
) # Change saas~XX.Y to saas-XX.Y
|
||||||
|
odoo_version = "master" if "alpha" in odoo_release.version else odoo_version
|
||||||
if release != odoo_version:
|
if release != odoo_version:
|
||||||
_logger.warning(
|
_logger.warning(
|
||||||
"Found Odoo sources in %(directory)s but with version '%(odoo_version)s' incompatible "
|
"Found Odoo sources in %(directory)s but with version '%(odoo_version)s' incompatible "
|
||||||
@ -124,17 +140,23 @@ else:
|
|||||||
"The 'Developer' documentation will be built but autodoc directives will be skipped.\n"
|
"The 'Developer' documentation will be built but autodoc directives will be skipped.\n"
|
||||||
"In order to fully build the 'Developer' documentation, checkout the matching branch"
|
"In order to fully build the 'Developer' documentation, checkout the matching branch"
|
||||||
" with `cd odoo && git checkout %(doc_version)s`.",
|
" with `cd odoo && git checkout %(doc_version)s`.",
|
||||||
{'directory': odoo_dir, 'odoo_version': odoo_version, 'doc_version': version},
|
{
|
||||||
|
"directory": odoo_dir,
|
||||||
|
"odoo_version": odoo_version,
|
||||||
|
"doc_version": version,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
_logger.info(
|
_logger.info(
|
||||||
"Found Odoo sources in %(directory)s matching documentation version '%(version)s'.",
|
"Found Odoo sources in %(directory)s matching documentation version '%(version)s'.",
|
||||||
{'directory': odoo_dir, 'version': release},
|
{"directory": odoo_dir, "version": release},
|
||||||
)
|
)
|
||||||
odoo_dir_in_path = True
|
odoo_dir_in_path = True
|
||||||
|
|
||||||
if odoo_dir_in_path:
|
if odoo_dir_in_path:
|
||||||
upgrade_util_dir = next(filter(Path.exists, [Path('upgrade-util'), Path('../upgrade-util')]), None)
|
upgrade_util_dir = next(
|
||||||
|
filter(Path.exists, [Path("upgrade-util"), Path("../upgrade-util")]), None
|
||||||
|
)
|
||||||
if not upgrade_util_dir:
|
if not upgrade_util_dir:
|
||||||
_logger.warning(
|
_logger.warning(
|
||||||
"Could not find Upgrade Utils sources directory in `upgrade_util`.\n"
|
"Could not find Upgrade Utils sources directory in `upgrade_util`.\n"
|
||||||
@ -146,151 +168,165 @@ if odoo_dir_in_path:
|
|||||||
else:
|
else:
|
||||||
_logger.info(
|
_logger.info(
|
||||||
"Found Upgrade Util sources in %(directory)s",
|
"Found Upgrade Util sources in %(directory)s",
|
||||||
{'directory': upgrade_util_dir.resolve()},
|
{"directory": upgrade_util_dir.resolve()},
|
||||||
)
|
)
|
||||||
from odoo import upgrade
|
from odoo import upgrade
|
||||||
upgrade.__path__.append(str((upgrade_util_dir / 'src').resolve()))
|
|
||||||
|
upgrade.__path__.append(str((upgrade_util_dir / "src").resolve()))
|
||||||
|
|
||||||
# Mapping between odoo models related to master data and the declaration of the
|
# 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
|
# data. This is used to point users to available xml_ids when giving values for
|
||||||
# a field with the autodoc_field extension.
|
# a field with the autodoc_field extension.
|
||||||
model_references = {
|
model_references = {
|
||||||
'account.account.type': 'addons/account/data/data_account_type.xml',
|
"account.account.type": "addons/account/data/data_account_type.xml",
|
||||||
'res.country': 'odoo/addons/base/data/res_country_data.xml',
|
"res.country": "odoo/addons/base/data/res_country_data.xml",
|
||||||
'res.currency': 'odoo/addons/base/data/res_currency_data.xml',
|
"res.currency": "odoo/addons/base/data/res_currency_data.xml",
|
||||||
}
|
}
|
||||||
|
|
||||||
# The Sphinx extensions to use, as module names.
|
# The Sphinx extensions to use, as module names.
|
||||||
# They can be extensions coming with Sphinx (named 'sphinx.ext.*') or custom ones.
|
# They can be extensions coming with Sphinx (named 'sphinx.ext.*') or custom ones.
|
||||||
extensions = [
|
extensions = [
|
||||||
# Link sources in other projects (used to build the reference doc)
|
# Link sources in other projects (used to build the reference doc)
|
||||||
'sphinx.ext.intersphinx',
|
"sphinx.ext.intersphinx",
|
||||||
|
|
||||||
# Support the specialized to-do directives
|
# Support the specialized to-do directives
|
||||||
'sphinx.ext.todo',
|
"sphinx.ext.todo",
|
||||||
|
|
||||||
# Custom Odoo theme
|
# Custom Odoo theme
|
||||||
'odoo_theme',
|
"odoo_theme",
|
||||||
|
|
||||||
# Youtube and Vimeo videos integration (youtube, vimeo directives)
|
# Youtube and Vimeo videos integration (youtube, vimeo directives)
|
||||||
'embedded_video',
|
"embedded_video",
|
||||||
|
"custom_admonitions",
|
||||||
'custom_admonitions',
|
|
||||||
|
|
||||||
# Redirection generator
|
# Redirection generator
|
||||||
'redirects',
|
"redirects",
|
||||||
|
|
||||||
# Content tabs
|
# Content tabs
|
||||||
'sphinx_tabs.tabs',
|
"sphinx_tabs.tabs",
|
||||||
|
|
||||||
# Cards
|
# Cards
|
||||||
'cards',
|
# "cards",
|
||||||
|
|
||||||
# Spoilers
|
# Spoilers
|
||||||
'spoilers',
|
"spoilers",
|
||||||
|
|
||||||
# Strange html domain logic used in memento pages
|
# Strange html domain logic used in memento pages
|
||||||
'html_domain',
|
"html_domain",
|
||||||
|
"myst_parser",
|
||||||
|
"sphinx_design",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
myst_enable_extensions = [
|
||||||
|
"amsmath",
|
||||||
|
"colon_fence",
|
||||||
|
"deflist",
|
||||||
|
"dollarmath",
|
||||||
|
"fieldlist",
|
||||||
|
"html_admonition",
|
||||||
|
"html_image",
|
||||||
|
"replacements",
|
||||||
|
"smartquotes",
|
||||||
|
"strikethrough",
|
||||||
|
"substitution",
|
||||||
|
"tasklist",
|
||||||
|
]
|
||||||
if odoo_dir_in_path:
|
if odoo_dir_in_path:
|
||||||
# GitHub links generation
|
# GitHub links generation
|
||||||
extensions += [
|
extensions += [
|
||||||
'sphinx.ext.linkcode',
|
"sphinx.ext.linkcode",
|
||||||
'github_link',
|
"github_link",
|
||||||
# Parse Python docstrings (autodoc, automodule, autoattribute directives)
|
# Parse Python docstrings (autodoc, automodule, autoattribute directives)
|
||||||
'sphinx.ext.autodoc',
|
"sphinx.ext.autodoc",
|
||||||
'autodoc_field',
|
"autodoc_field",
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
extensions += [
|
extensions += [
|
||||||
'autodoc_placeholder',
|
"autodoc_placeholder",
|
||||||
]
|
]
|
||||||
extensions.append('sphinx.ext.graphviz' if shutil.which('dot') else 'graphviz_placeholder')
|
extensions.append(
|
||||||
|
"sphinx.ext.graphviz" if shutil.which("dot") else "graphviz_placeholder"
|
||||||
|
)
|
||||||
|
|
||||||
todo_include_todos = False
|
todo_include_todos = False
|
||||||
|
|
||||||
intersphinx_mapping = {
|
intersphinx_mapping = {
|
||||||
'pillow': ('https://pillow.readthedocs.io/en/stable/', None),
|
"pillow": ("https://pillow.readthedocs.io/en/stable/", None),
|
||||||
'python': ('https://docs.python.org/3/', None),
|
"python": ("https://docs.python.org/3/", None),
|
||||||
'werkzeug': ('https://werkzeug.palletsprojects.com/en/2.3.x/', None),
|
"werkzeug": ("https://werkzeug.palletsprojects.com/en/2.3.x/", None),
|
||||||
}
|
}
|
||||||
|
|
||||||
github_user = 'odoo'
|
github_user = "NextERP"
|
||||||
github_project = 'documentation'
|
github_project = "documentation"
|
||||||
|
|
||||||
locale_dirs = ['../locale/']
|
locale_dirs = ["../locale/"]
|
||||||
templates_path = ['../extensions']
|
templates_path = ["../extensions"]
|
||||||
|
|
||||||
# custom docname_to_domain to divide the translations of applications in subdirectories
|
# custom docname_to_domain to divide the translations of applications in subdirectories
|
||||||
sphinx.transforms.i18n.docname_to_domain = (
|
sphinx.transforms.i18n.docname_to_domain = sphinx.util.i18n.docname_to_domain = (
|
||||||
sphinx.util.i18n.docname_to_domain
|
lambda docname, compact: docname.split("/")[
|
||||||
) = lambda docname, compact: docname.split('/')[1 if docname.startswith('applications/') else 0]
|
1 if docname.startswith("applications/") else 0
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
# The version names that should be shown in the version switcher, if the config option `versions`
|
# The version names that should be shown in the version switcher, if the config option `versions`
|
||||||
# is populated. If a version is passed to `versions` but is not listed here, it will not be shown.
|
# is populated. If a version is passed to `versions` but is not listed here, it will not be shown.
|
||||||
versions_names = {
|
versions_names = {
|
||||||
'master': "Master",
|
"master": "Master",
|
||||||
'saas-18.1': "Odoo Online",
|
"saas-18.1": "Odoo Online",
|
||||||
'18.0': "Odoo 18",
|
"18.0": "18.0",
|
||||||
'saas-17.4': "Odoo Online",
|
"saas-17.4": "Odoo Online",
|
||||||
'saas-17.2': "Odoo Online",
|
"saas-17.2": "Odoo Online",
|
||||||
'17.0': "Odoo 17",
|
"17.0": "Odoo 17",
|
||||||
'16.0': "Odoo 16",
|
"16.0": "Odoo 16",
|
||||||
'15.0': "Odoo 15",
|
"15.0": "Odoo 15",
|
||||||
}
|
}
|
||||||
|
|
||||||
# The language names that should be shown in the language switcher, if the config option `languages`
|
# The language names that should be shown in the language switcher, if the config option `languages`
|
||||||
# is populated. If a language is passed to `languages` but is not listed here, it will not be shown.
|
# is populated. If a language is passed to `languages` but is not listed here, it will not be shown.
|
||||||
languages_names = {
|
languages_names = {
|
||||||
'de': 'DE',
|
"de": "DE",
|
||||||
'en': 'EN',
|
"en": "EN",
|
||||||
'es': 'ES',
|
"es": "ES",
|
||||||
'es_419': 'ES (LATAM)',
|
"es_419": "ES (LATAM)",
|
||||||
'fr': 'FR',
|
"fr": "FR",
|
||||||
'id': 'ID',
|
"id": "ID",
|
||||||
'it': 'IT',
|
"it": "IT",
|
||||||
'ja': 'JA',
|
"ja": "JA",
|
||||||
'ko': 'KR',
|
"ko": "KR",
|
||||||
'nl': 'NL',
|
"nl": "NL",
|
||||||
'pt_BR': 'PT',
|
"pt_BR": "PT",
|
||||||
'ro': 'RO',
|
"ro": "RO",
|
||||||
'sv': 'SV',
|
"sv": "SV",
|
||||||
'th': 'TH',
|
"th": "TH",
|
||||||
'uk': 'UA',
|
"uk": "UA",
|
||||||
'vi': 'VI',
|
"vi": "VI",
|
||||||
'zh_CN': 'ZH (CN)',
|
"zh_CN": "ZH (CN)",
|
||||||
'zh_TW': 'ZH (TW)'
|
"zh_TW": "ZH (TW)",
|
||||||
}
|
}
|
||||||
|
|
||||||
# The directory in which files holding redirect rules used by the 'redirects' extension are listed.
|
# The directory in which files holding redirect rules used by the 'redirects' extension are listed.
|
||||||
redirects_dir = 'redirects/'
|
redirects_dir = "redirects/"
|
||||||
|
|
||||||
sphinx_tabs_disable_tab_closing = True
|
sphinx_tabs_disable_tab_closing = True
|
||||||
sphinx_tabs_disable_css_loading = True
|
sphinx_tabs_disable_css_loading = True
|
||||||
|
|
||||||
# Autodoc ordering
|
# Autodoc ordering
|
||||||
autodoc_member_order = 'bysource'
|
autodoc_member_order = "bysource"
|
||||||
|
|
||||||
#=== Options for HTML output ===#
|
# === Options for HTML output ===#
|
||||||
|
|
||||||
html_theme = 'odoo_theme'
|
html_theme = "odoo_theme"
|
||||||
|
|
||||||
# The name of the Pygments (syntax highlighting) style to use.
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
# See extensions/odoo_theme/pygments_override.py
|
# See extensions/odoo_theme/pygments_override.py
|
||||||
pygments_style = 'odoo'
|
pygments_style = "odoo"
|
||||||
|
|
||||||
# The paths that contain custom themes, relative to this directory.
|
# The paths that contain custom themes, relative to this directory.
|
||||||
html_theme_path = ['extensions']
|
html_theme_path = ["extensions"]
|
||||||
|
|
||||||
# The name of an image file (within the static path) to use as favicon of the docs.
|
# The name of an image file (within the static path) to use as favicon of the docs.
|
||||||
# This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large.
|
# This file should be a Windows icon file (.ico) being 16x16 or 32x32 pixels large.
|
||||||
html_favicon = os.path.join(html_theme_path[0], html_theme, 'static', 'img', 'favicon.ico')
|
html_favicon = os.path.join(
|
||||||
|
html_theme_path[0], html_theme, "static", "img", "favicon.ico"
|
||||||
|
)
|
||||||
|
|
||||||
# The paths that contain custom static files, relative to this directory.
|
# The paths that contain custom static files, relative to this directory.
|
||||||
# They are copied after the builtin static files, so a file named "default.css" will overwrite the
|
# They are copied after the builtin static files, so a file named "default.css" will overwrite the
|
||||||
# builtin "default.css".
|
# builtin "default.css".
|
||||||
html_static_path = ['static']
|
html_static_path = ["static"]
|
||||||
html_permalinks = True
|
html_permalinks = True
|
||||||
|
|
||||||
# Additional JS & CSS files that can be imported with the 'custom-js' and 'custom-css' metadata.
|
# Additional JS & CSS files that can be imported with the 'custom-js' and 'custom-css' metadata.
|
||||||
@ -300,72 +336,131 @@ html_css_files = []
|
|||||||
|
|
||||||
# PHP lexer option to not require <?php
|
# PHP lexer option to not require <?php
|
||||||
highlight_options = {
|
highlight_options = {
|
||||||
'php': {'startinline': True},
|
"php": {"startinline": True},
|
||||||
}
|
}
|
||||||
|
|
||||||
#=== Options for LaTeX output ===#
|
# === Options for LaTeX output ===#
|
||||||
|
|
||||||
latex_elements = {
|
latex_elements = {
|
||||||
# The paper size ('letterpaper' or 'a4paper').
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
'papersize': 'a4paper',
|
"papersize": "a4paper",
|
||||||
|
|
||||||
# Additional stuff for the LaTeX preamble.
|
# Additional stuff for the LaTeX preamble.
|
||||||
'preamble': r'\usepackage{odoo}',
|
"preamble": r"\usepackage{odoo}",
|
||||||
'tableofcontents': '', # no TOC
|
"tableofcontents": "", # no TOC
|
||||||
|
|
||||||
# Output manually in latex docs
|
# Output manually in latex docs
|
||||||
'releasename': release,
|
"releasename": release,
|
||||||
}
|
}
|
||||||
|
|
||||||
latex_additional_files = ['static/latex/odoo.sty']
|
latex_additional_files = ["static/latex/odoo.sty"]
|
||||||
|
|
||||||
# Grouping the document tree into LaTeX files. List of tuples:
|
# Grouping the document tree into LaTeX files. List of tuples:
|
||||||
# (source start file, target name, title, author, documentclass [howto, manual, or own class]).
|
# (source start file, target name, title, author, documentclass [howto, manual, or own class]).
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
('legal/terms/enterprise_tex', 'odoo_enterprise_agreement.tex',
|
(
|
||||||
'Odoo Enterprise Subscription Agreement', '', 'howto'),
|
"legal/terms/enterprise_tex",
|
||||||
('legal/terms/partnership_tex',
|
"odoo_enterprise_agreement.tex",
|
||||||
'odoo_partnership_agreement.tex', 'Odoo Partnership Agreement', '', 'howto'),
|
"Odoo Enterprise Subscription Agreement",
|
||||||
('legal/terms/terms_of_sale',
|
"",
|
||||||
'terms_of_sale.tex', 'Odoo Terms of Sale', '', 'howto'),
|
"howto",
|
||||||
|
),
|
||||||
('legal/terms/i18n/enterprise_tex_fr', 'odoo_enterprise_agreement_fr.tex',
|
(
|
||||||
'Odoo Enterprise Subscription Agreement (FR)', '', 'howto'),
|
"legal/terms/partnership_tex",
|
||||||
('legal/terms/i18n/partnership_tex_fr',
|
"odoo_partnership_agreement.tex",
|
||||||
'odoo_partnership_agreement_fr.tex', 'Odoo Partnership Agreement (FR)', '', 'howto'),
|
"Odoo Partnership Agreement",
|
||||||
('legal/terms/i18n/terms_of_sale_fr', 'terms_of_sale_fr.tex',
|
"",
|
||||||
'Conditions Générales de Vente Odoo', '', 'howto'),
|
"howto",
|
||||||
|
),
|
||||||
('legal/terms/i18n/enterprise_tex_nl', 'odoo_enterprise_agreement_nl.tex',
|
(
|
||||||
'Odoo Enterprise Subscription Agreement (NL)', '', 'howto'),
|
"legal/terms/terms_of_sale",
|
||||||
|
"terms_of_sale.tex",
|
||||||
('legal/terms/i18n/enterprise_tex_de', 'odoo_enterprise_agreement_de.tex',
|
"Odoo Terms of Sale",
|
||||||
'Odoo Enterprise Subscription Agreement (DE)', '', 'howto'),
|
"",
|
||||||
('legal/terms/i18n/terms_of_sale_de', 'terms_of_sale_de.tex',
|
"howto",
|
||||||
'Allgemeine Verkaufsbedingungen Odoo', '', 'howto'),
|
),
|
||||||
|
(
|
||||||
('legal/terms/i18n/enterprise_tex_es', 'odoo_enterprise_agreement_es.tex',
|
"legal/terms/i18n/enterprise_tex_fr",
|
||||||
'Odoo Enterprise Subscription Agreement (ES)', '', 'howto'),
|
"odoo_enterprise_agreement_fr.tex",
|
||||||
('legal/terms/i18n/partnership_tex_es',
|
"Odoo Enterprise Subscription Agreement (FR)",
|
||||||
'odoo_partnership_agreement_es.tex', 'Odoo Partnership Agreement (ES)', '', 'howto'),
|
"",
|
||||||
('legal/terms/i18n/terms_of_sale_es', 'terms_of_sale_es.tex',
|
"howto",
|
||||||
'Términos Generales de Venta Odoo', '', 'howto'),
|
),
|
||||||
|
(
|
||||||
('legal/terms/i18n/enterprise_tex_pt_BR', 'odoo_enterprise_agreement_pt_BR.tex',
|
"legal/terms/i18n/partnership_tex_fr",
|
||||||
'Odoo Enterprise Subscription Agreement (PT)', '', 'howto'),
|
"odoo_partnership_agreement_fr.tex",
|
||||||
|
"Odoo Partnership Agreement (FR)",
|
||||||
|
"",
|
||||||
|
"howto",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"legal/terms/i18n/terms_of_sale_fr",
|
||||||
|
"terms_of_sale_fr.tex",
|
||||||
|
"Conditions Générales de Vente Odoo",
|
||||||
|
"",
|
||||||
|
"howto",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"legal/terms/i18n/enterprise_tex_nl",
|
||||||
|
"odoo_enterprise_agreement_nl.tex",
|
||||||
|
"Odoo Enterprise Subscription Agreement (NL)",
|
||||||
|
"",
|
||||||
|
"howto",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"legal/terms/i18n/enterprise_tex_de",
|
||||||
|
"odoo_enterprise_agreement_de.tex",
|
||||||
|
"Odoo Enterprise Subscription Agreement (DE)",
|
||||||
|
"",
|
||||||
|
"howto",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"legal/terms/i18n/terms_of_sale_de",
|
||||||
|
"terms_of_sale_de.tex",
|
||||||
|
"Allgemeine Verkaufsbedingungen Odoo",
|
||||||
|
"",
|
||||||
|
"howto",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"legal/terms/i18n/enterprise_tex_es",
|
||||||
|
"odoo_enterprise_agreement_es.tex",
|
||||||
|
"Odoo Enterprise Subscription Agreement (ES)",
|
||||||
|
"",
|
||||||
|
"howto",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"legal/terms/i18n/partnership_tex_es",
|
||||||
|
"odoo_partnership_agreement_es.tex",
|
||||||
|
"Odoo Partnership Agreement (ES)",
|
||||||
|
"",
|
||||||
|
"howto",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"legal/terms/i18n/terms_of_sale_es",
|
||||||
|
"terms_of_sale_es.tex",
|
||||||
|
"Términos Generales de Venta Odoo",
|
||||||
|
"",
|
||||||
|
"howto",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"legal/terms/i18n/enterprise_tex_pt_BR",
|
||||||
|
"odoo_enterprise_agreement_pt_BR.tex",
|
||||||
|
"Odoo Enterprise Subscription Agreement (PT)",
|
||||||
|
"",
|
||||||
|
"howto",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
# List of languages that have legal translations (excluding EN). The keys must be in
|
# List of languages that have legal translations (excluding EN). The keys must be in
|
||||||
# `languages_names`. These translations will have a link to their versions of the legal
|
# `languages_names`. These translations will have a link to their versions of the legal
|
||||||
# contracts, instead of the default EN one. The main legal documents are not part of the
|
# contracts, instead of the default EN one. The main legal documents are not part of the
|
||||||
# translations since they have legal meaning.
|
# translations since they have legal meaning.
|
||||||
legal_translations = ['de', 'es', 'fr', 'nl', 'pt_BR']
|
legal_translations = ["de", "es", "fr", "nl", "pt_BR"]
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top of the title page.
|
# The name of an image file (relative to this directory) to place at the top of the title page.
|
||||||
latex_logo = 'static/img/odoo_logo.png'
|
latex_logo = "static/img/odoo_logo.png"
|
||||||
|
|
||||||
# If true, show URL addresses after external links.
|
# If true, show URL addresses after external links.
|
||||||
latex_show_urls = 'True'
|
latex_show_urls = "True"
|
||||||
|
|
||||||
|
|
||||||
# https://github.com/sphinx-doc/sphinx/issues/4054#issuecomment-329097229
|
# https://github.com/sphinx-doc/sphinx/issues/4054#issuecomment-329097229
|
||||||
def source_read_replace(app, docname, source):
|
def source_read_replace(app, docname, source):
|
||||||
@ -383,36 +478,42 @@ def source_read_replace(app, docname, source):
|
|||||||
result = result.replace(f"{{{key}}}", app.config.source_read_replace_vals[key])
|
result = result.replace(f"{{{key}}}", app.config.source_read_replace_vals[key])
|
||||||
source[0] = result
|
source[0] = result
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
# Generate all alternate URLs for each document
|
# Generate all alternate URLs for each document
|
||||||
app.add_config_value('project_root', None, 'env')
|
app.add_config_value("project_root", None, "env")
|
||||||
app.add_config_value('canonical_version', None, 'env')
|
app.add_config_value("canonical_version", None, "env")
|
||||||
app.add_config_value('versions', None, 'env')
|
app.add_config_value("versions", None, "env")
|
||||||
app.add_config_value('languages', None, 'env')
|
app.add_config_value("languages", None, "env")
|
||||||
app.add_config_value('is_remote_build', None, 'env') # Whether the build is remotely deployed
|
app.add_config_value(
|
||||||
app.add_config_value('source_read_replace_vals', {}, 'env')
|
"is_remote_build", None, "env"
|
||||||
app.connect('source-read', source_read_replace)
|
) # Whether the build is remotely deployed
|
||||||
|
app.add_config_value("source_read_replace_vals", {}, "env")
|
||||||
|
app.connect("source-read", source_read_replace)
|
||||||
# TODO uncomment after moving to >= v7.2.5 to also substitute placeholders in included files.
|
# TODO uncomment after moving to >= v7.2.5 to also substitute placeholders in included files.
|
||||||
# See https://github.com/sphinx-doc/sphinx/commit/ff1831
|
# See https://github.com/sphinx-doc/sphinx/commit/ff1831
|
||||||
# app.connect('include-read', source_read_replace)
|
# app.connect('include-read', source_read_replace)
|
||||||
|
|
||||||
app.add_lexer('json', JsonLexer)
|
app.add_lexer("json", JsonLexer)
|
||||||
app.add_lexer('xml', XmlLexer)
|
app.add_lexer("xml", XmlLexer)
|
||||||
|
|
||||||
app.connect('html-page-context', _generate_alternate_urls)
|
app.connect("html-page-context", _generate_alternate_urls)
|
||||||
|
|
||||||
# Add a `condition` option on directives to ignore them based on config values
|
# Add a `condition` option on directives to ignore them based on config values
|
||||||
app.add_config_value('odoo_dir_in_path', None, 'env')
|
app.add_config_value("odoo_dir_in_path", None, "env")
|
||||||
|
|
||||||
def context_eval(expr):
|
def context_eval(expr):
|
||||||
return eval(expr, {confval.name: confval.value for confval in app.config})
|
return eval(expr, {confval.name: confval.value for confval in app.config})
|
||||||
|
|
||||||
def patch(to_patch):
|
def patch(to_patch):
|
||||||
to_patch.option_spec['condition'] = context_eval
|
to_patch.option_spec["condition"] = context_eval
|
||||||
original_run = to_patch.run
|
original_run = to_patch.run
|
||||||
|
|
||||||
def new_run(self):
|
def new_run(self):
|
||||||
if not self.options.get('condition', True):
|
if not self.options.get("condition", True):
|
||||||
return []
|
return []
|
||||||
return original_run(self)
|
return original_run(self)
|
||||||
|
|
||||||
to_patch.run = new_run
|
to_patch.run = new_run
|
||||||
|
|
||||||
for to_patch in (
|
for to_patch in (
|
||||||
@ -423,7 +524,7 @@ def setup(app):
|
|||||||
|
|
||||||
|
|
||||||
def _generate_alternate_urls(app, pagename, templatename, context, doctree):
|
def _generate_alternate_urls(app, pagename, templatename, context, doctree):
|
||||||
""" Add keys of required alternate URLs for the current document in the rendering context.
|
"""Add keys of required alternate URLs for the current document in the rendering context.
|
||||||
|
|
||||||
Alternate URLS are required for:
|
Alternate URLS are required for:
|
||||||
- The canonical link tag
|
- The canonical link tag
|
||||||
@ -432,7 +533,7 @@ def _generate_alternate_urls(app, pagename, templatename, context, doctree):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def _canonicalize():
|
def _canonicalize():
|
||||||
""" Add the canonical URL for the current document in the rendering context.
|
"""Add the canonical URL for the current document in the rendering context.
|
||||||
|
|
||||||
The canonical version is the last released version of the documentation.
|
The canonical version is the last released version of the documentation.
|
||||||
For a given language, the canonical root of a page is in the same language so that web
|
For a given language, the canonical root of a page is in the same language so that web
|
||||||
@ -444,92 +545,117 @@ def _generate_alternate_urls(app, pagename, templatename, context, doctree):
|
|||||||
"""
|
"""
|
||||||
# If the canonical version is not set, assume that the project has a single version
|
# If the canonical version is not set, assume that the project has a single version
|
||||||
_canonical_version = app.config.canonical_version or app.config.version
|
_canonical_version = app.config.canonical_version or app.config.version
|
||||||
_canonical_lang = 'en' # Always 'en'. Don't take the value of the config option.
|
_canonical_lang = (
|
||||||
context['canonical'] = _build_url(_version=_canonical_version, _lang=_canonical_lang)
|
"en" # Always 'en'. Don't take the value of the config option.
|
||||||
|
)
|
||||||
|
context["canonical"] = _build_url(
|
||||||
|
_version=_canonical_version, _lang=_canonical_lang
|
||||||
|
)
|
||||||
|
|
||||||
def _versionize():
|
def _versionize():
|
||||||
""" Add the pairs of (version, url) for the current document in the rendering context.
|
"""Add the pairs of (version, url) for the current document in the rendering context.
|
||||||
|
|
||||||
The entry 'version' is added by Sphinx in the rendering context.
|
The entry 'version' is added by Sphinx in the rendering context.
|
||||||
"""
|
"""
|
||||||
context['version_display_name'] = versions_names[version]
|
context["version_display_name"] = versions_names[version]
|
||||||
|
|
||||||
# If the list of versions is not set, assume the project has no alternate version
|
# If the list of versions is not set, assume the project has no alternate version
|
||||||
_provided_versions = app.config.versions and app.config.versions.split(',') or []
|
_provided_versions = (
|
||||||
|
app.config.versions and app.config.versions.split(",") or []
|
||||||
|
)
|
||||||
|
|
||||||
# Map alternate versions to their display names and URLs.
|
# Map alternate versions to their display names and URLs.
|
||||||
context['alternate_versions'] = []
|
context["alternate_versions"] = []
|
||||||
for _alternate_version, _display_name in versions_names.items():
|
for _alternate_version, _display_name in versions_names.items():
|
||||||
if _alternate_version in _provided_versions and _alternate_version != version:
|
if (
|
||||||
context['alternate_versions'].append(
|
_alternate_version in _provided_versions
|
||||||
|
and _alternate_version != version
|
||||||
|
):
|
||||||
|
context["alternate_versions"].append(
|
||||||
(_display_name, _build_url(_alternate_version))
|
(_display_name, _build_url(_alternate_version))
|
||||||
)
|
)
|
||||||
|
|
||||||
def _localize():
|
def _localize():
|
||||||
""" Add the pairs of (lang, code, url) for the current document in the rendering context.
|
"""Add the pairs of (lang, code, url) for the current document in the rendering context.
|
||||||
|
|
||||||
E.g.: ('French', 'fr', 'https://.../fr_BE/...')
|
E.g.: ('French', 'fr', 'https://.../fr_BE/...')
|
||||||
|
|
||||||
The entry 'language' is added by Sphinx in the rendering context.
|
The entry 'language' is added by Sphinx in the rendering context.
|
||||||
"""
|
"""
|
||||||
_current_lang = app.config.language or 'en'
|
_current_lang = app.config.language or "en"
|
||||||
# Replace the context value by its upper-cased value ("FR" instead of "fr")
|
# Replace the context value by its upper-cased value ("FR" instead of "fr")
|
||||||
context['language'] = languages_names.get(_current_lang, _current_lang.upper())
|
context["language"] = languages_names.get(_current_lang, _current_lang.upper())
|
||||||
context['language_code'] = _current_lang
|
context["language_code"] = _current_lang
|
||||||
|
|
||||||
# If the list of languages is not set, assume that the project has no alternate language
|
# If the list of languages is not set, assume that the project has no alternate language
|
||||||
_provided_languages = app.config.languages and app.config.languages.split(',') or []
|
_provided_languages = (
|
||||||
|
app.config.languages and app.config.languages.split(",") or []
|
||||||
|
)
|
||||||
|
|
||||||
# Map alternate languages to their display names and URLs.
|
# Map alternate languages to their display names and URLs.
|
||||||
context['alternate_languages'] = []
|
context["alternate_languages"] = []
|
||||||
for _alternate_lang, _display_name in languages_names.items():
|
for _alternate_lang, _display_name in languages_names.items():
|
||||||
if _alternate_lang in _provided_languages and _alternate_lang != _current_lang:
|
if (
|
||||||
context['alternate_languages'].append(
|
_alternate_lang in _provided_languages
|
||||||
|
and _alternate_lang != _current_lang
|
||||||
|
):
|
||||||
|
context["alternate_languages"].append(
|
||||||
(
|
(
|
||||||
_display_name,
|
_display_name,
|
||||||
_alternate_lang.split('_')[0] if _alternate_lang != 'en' else 'x-default',
|
(
|
||||||
|
_alternate_lang.split("_")[0]
|
||||||
|
if _alternate_lang != "en"
|
||||||
|
else "x-default"
|
||||||
|
),
|
||||||
_build_url(_lang=_alternate_lang),
|
_build_url(_lang=_alternate_lang),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Dynamic generation of localized legal doc links
|
# Dynamic generation of localized legal doc links
|
||||||
context['legal_translations'] = legal_translations
|
context["legal_translations"] = legal_translations
|
||||||
|
|
||||||
|
|
||||||
def _build_url(_version=None, _lang=None):
|
def _build_url(_version=None, _lang=None):
|
||||||
|
# print(f"###################################{app.config.is_remote_build}")
|
||||||
|
# print(f"###################################{app.config.project_root}")
|
||||||
if app.config.is_remote_build:
|
if app.config.is_remote_build:
|
||||||
# Project root like https://www.odoo.com/documentation
|
# Project root like https://www.odoo.com/documentation
|
||||||
_root = app.config.project_root
|
_root = app.config.project_root
|
||||||
else:
|
else:
|
||||||
# Project root like .../documentation/_build/html/14.0/fr
|
# Project root like .../documentation/_build/html/14.0/fr
|
||||||
_root = re.sub(rf'(/{app.config.version})?(/{app.config.language})?$', '', app.outdir)
|
_root = re.sub(
|
||||||
|
rf"(/{app.config.version})?(/{app.config.language})?$", "", app.outdir
|
||||||
|
)
|
||||||
# If the canonical version is not set, assume that the project has a single version
|
# If the canonical version is not set, assume that the project has a single version
|
||||||
_canonical_version = app.config.canonical_version or app.config.version
|
_canonical_version = app.config.canonical_version or app.config.version
|
||||||
_version = _version or app.config.version
|
_version = _version or app.config.version
|
||||||
_lang = _lang or app.config.language or 'en'
|
_lang = _lang or app.config.language or "en"
|
||||||
_canonical_page = f'{pagename}.html'
|
_canonical_page = f"{pagename}.html"
|
||||||
|
|
||||||
# legal translations have different URLs schemes as they are not managed on transifex
|
# legal translations have different URLs schemes as they are not managed on transifex
|
||||||
# e.g. FR translation of /terms/enterprise => /fr/terms/enterprise_fr
|
# e.g. FR translation of /terms/enterprise => /fr/terms/enterprise_fr
|
||||||
if pagename.startswith('legal/terms/'):
|
if pagename.startswith("legal/terms/"):
|
||||||
if _lang in legal_translations and not pagename.endswith(f"_{_lang}"):
|
if _lang in legal_translations and not pagename.endswith(f"_{_lang}"):
|
||||||
# remove language code for current translation, set target one
|
# remove language code for current translation, set target one
|
||||||
_page = re.sub("_[a-z]{2}$", "", pagename)
|
_page = re.sub("_[a-z]{2}$", "", pagename)
|
||||||
if 'terms/i18n' not in _page:
|
if "terms/i18n" not in _page:
|
||||||
_page = _page.replace("/terms/", "/terms/i18n/")
|
_page = _page.replace("/terms/", "/terms/i18n/")
|
||||||
_canonical_page = f'{_page}_{_lang}.html'
|
_canonical_page = f"{_page}_{_lang}.html"
|
||||||
elif _lang == 'en' and pagename.endswith(tuple(f"_{l}" for l in legal_translations)):
|
elif _lang == "en" and pagename.endswith(
|
||||||
|
tuple(f"_{l}" for l in legal_translations)
|
||||||
|
):
|
||||||
# remove language code for current translation, link to original EN one
|
# remove language code for current translation, link to original EN one
|
||||||
_page = re.sub("_[a-z]{2}$", "", pagename)
|
_page = re.sub("_[a-z]{2}$", "", pagename)
|
||||||
_canonical_page = f'{_page.replace("/i18n/", "/")}.html'
|
_canonical_page = f'{_page.replace("/i18n/", "/")}.html'
|
||||||
|
|
||||||
if app.config.is_remote_build:
|
if app.config.is_remote_build:
|
||||||
_canonical_page = _canonical_page.replace('index.html', '')
|
_canonical_page = _canonical_page.replace("index.html", "")
|
||||||
|
|
||||||
return f'{_root}' \
|
return (
|
||||||
f'{f"/{_version}" if app.config.versions else ""}' \
|
f"{_root}"
|
||||||
f'{f"/{_lang}" if _lang != "en" else ""}' \
|
f'{f"/{_version}" if app.config.versions else ""}'
|
||||||
f'/{_canonical_page}'
|
f'{f"/{_lang}" if _lang != "en" else ""}'
|
||||||
|
f"/{_canonical_page}"
|
||||||
|
)
|
||||||
|
|
||||||
_canonicalize()
|
_canonicalize()
|
||||||
_versionize()
|
_versionize()
|
||||||
|
42
config.yaml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# -d, --dry-run Do not write/remove any files
|
||||||
|
# -R, --replace-files Remove parsed files
|
||||||
|
# -S, --stop-on-fail Stop on first failure
|
||||||
|
# -W, --raise-on-warning Raise exception on parsing warning
|
||||||
|
# -l, --language TEXT Language code for directive names [default:
|
||||||
|
# en]
|
||||||
|
# --sphinx / --no-sphinx Load sphinx. [default: sphinx]
|
||||||
|
# -e, --extensions TEXT A comma-separated list of sphinx extensions
|
||||||
|
# to load.
|
||||||
|
# -dd, --default-domain TEXT Default sphinx domain [default: py]
|
||||||
|
# -dr, --default-role TEXT Default sphinx role [default: convert to
|
||||||
|
# literal]
|
||||||
|
# -cp, --cite-prefix TEXT Prefix to add to citation references
|
||||||
|
# [default: cite]
|
||||||
|
# --consecutive-numbering / --no-consecutive-numbering
|
||||||
|
# Apply consecutive numbering to ordered lists
|
||||||
|
# [default: consecutive-numbering]
|
||||||
|
# --colon-fences / --no-colon-fences
|
||||||
|
# Use colon fences for directives with parsed
|
||||||
|
# content [default: colon-fences]
|
||||||
|
# --dollar-math / --no-dollar-math
|
||||||
|
# Convert math (where possible) to dollar-
|
||||||
|
# delimited math [default: dollar-math]
|
||||||
|
# -c, --conversions PATH YAML file mapping directives -> conversions
|
||||||
|
# --encoding TEXT Encoding for read/write [default: utf8]
|
||||||
|
# --config FILE YAML file to read default configuration from
|
||||||
|
# -h, --help Show this message and exit.
|
||||||
|
language: en
|
||||||
|
sphinx: true
|
||||||
|
default_conversion: parse_all
|
||||||
|
conversions:
|
||||||
|
docutils.parsers.rst.directives.images.image: parse_all
|
||||||
|
sphinx.directives.patches.ListTable: parse_all # For tables if needed
|
||||||
|
extensions:
|
||||||
|
- sphinx.ext.intersphinx
|
||||||
|
- sphinx.ext.todo
|
||||||
|
- sphinx_tabs.tabs
|
||||||
|
- sphinx_design
|
||||||
|
default_domain: py
|
||||||
|
consecutive_numbering: true
|
||||||
|
colon_fences: true
|
||||||
|
dollar_math: true
|
BIN
content-rst/administration/odoo_accounts/delete-account.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
content-rst/administration/odoo_online/database-manager.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
content-rst/administration/odoo_online/delete.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
content-rst/administration/odoo_online/invite-users.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 2.0 MiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 35 KiB |