Skip to content
Snippets Groups Projects
Commit 530167006d4f authored by Houzefa Abbasbhay's avatar Houzefa Abbasbhay :slight_smile:
Browse files

QOL according to xcg/templates/odoo_module

parent ce876f512ed0
Branches branch/11.0
No related tags found
1 merge request!8Topic/11.0/zouzou
Pipeline #43415 passed
<?xml version="1.0" encoding="UTF-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" width="114" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1" />
<stop offset="1" stop-opacity=".1" />
</linearGradient>
<mask id="anybadge_1">
<rect width="114" height="20" rx="3" fill="#fff" />
</mask>
<g mask="url(#anybadge_1)">
<path fill="#555" d="M0 0h72v20H0z" />
<path fill="#000000" d="M72 0h42v20H72z" />
<path fill="url(#b)" d="M0 0h114v20H0z" />
</g>
<g
fill="#fff"
text-anchor="middle"
font-family="DejaVu Sans,Verdana,Geneva,sans-serif"
font-size="11"
>
<text x="37.0" y="15" fill="#010101" fill-opacity=".3">code style</text>
<text x="36.0" y="14">code style</text>
</g>
<g
fill="#fff"
text-anchor="middle"
font-family="DejaVu Sans,Verdana,Geneva,sans-serif"
font-size="11"
>
<text x="94.0" y="15" fill="#010101" fill-opacity=".3">black</text>
<text x="93.0" y="14">black</text>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" width="129" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1" />
<stop offset="1" stop-opacity=".1" />
</linearGradient>
<mask id="anybadge_1">
<rect width="129" height="20" rx="3" fill="#fff" />
</mask>
<g mask="url(#anybadge_1)">
<path fill="#555" d="M0 0h72v20H0z" />
<path fill="#ff69b4" d="M72 0h57v20H72z" />
<path fill="url(#b)" d="M0 0h129v20H0z" />
</g>
<g
fill="#fff"
text-anchor="middle"
font-family="DejaVu Sans,Verdana,Geneva,sans-serif"
font-size="11"
>
<text x="37.0" y="15" fill="#010101" fill-opacity=".3">code style</text>
<text x="36.0" y="14">code style</text>
</g>
<g
fill="#fff"
text-anchor="middle"
font-family="DejaVu Sans,Verdana,Geneva,sans-serif"
font-size="11"
>
<text x="101.5" y="15" fill="#010101" fill-opacity=".3">prettier</text>
<text x="100.5" y="14">prettier</text>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" width="124" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1" />
<stop offset="1" stop-opacity=".1" />
</linearGradient>
<mask id="anybadge_1">
<rect width="124" height="20" rx="3" fill="#fff" />
</mask>
<g mask="url(#anybadge_1)">
<path fill="#555" d="M0 0h65v20H0z" />
<path fill="#808080" d="M65 0h59v20H65z" />
<path fill="url(#b)" d="M0 0h124v20H0z" />
</g>
<g
fill="#fff"
text-anchor="middle"
font-family="DejaVu Sans,Verdana,Geneva,sans-serif"
font-size="11"
>
<text x="33.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
<text x="32.5" y="14">coverage</text>
</g>
<g
fill="#fff"
text-anchor="middle"
font-family="DejaVu Sans,Verdana,Geneva,sans-serif"
font-size="11"
>
<text x="95.5" y="15" fill="#010101" fill-opacity=".3">unknown</text>
<text x="94.5" y="14">unknown</text>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" width="107" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1" />
<stop offset="1" stop-opacity=".1" />
</linearGradient>
<mask id="anybadge_1">
<rect width="107" height="20" rx="3" fill="#fff" />
</mask>
<g mask="url(#anybadge_1)">
<path fill="#555" d="M0 0h53v20H0z" />
<path fill="#0000FF" d="M53 0h54v20H53z" />
<path fill="url(#b)" d="M0 0h107v20H0z" />
</g>
<g
fill="#fff"
text-anchor="middle"
font-family="DejaVu Sans,Verdana,Geneva,sans-serif"
font-size="11"
>
<text x="27.5" y="15" fill="#010101" fill-opacity=".3">licence</text>
<text x="26.5" y="14">licence</text>
</g>
<g
fill="#fff"
text-anchor="middle"
font-family="DejaVu Sans,Verdana,Geneva,sans-serif"
font-size="11"
>
<text x="81.0" y="15" fill="#010101" fill-opacity=".3">AGPL-3</text>
<text x="80.0" y="14">AGPL-3</text>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" width="103" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1" />
<stop offset="1" stop-opacity=".1" />
</linearGradient>
<mask id="anybadge_1">
<rect width="103" height="20" rx="3" fill="#fff" />
</mask>
<g mask="url(#anybadge_1)">
<path fill="#555" d="M0 0h61v20H0z" />
<path fill="#e05d44" d="M61 0h42v20H61z" />
<path fill="url(#b)" d="M0 0h103v20H0z" />
</g>
<g
fill="#fff"
text-anchor="middle"
font-family="DejaVu Sans,Verdana,Geneva,sans-serif"
font-size="11"
>
<text x="31.5" y="15" fill="#010101" fill-opacity=".3">maturity</text>
<text x="30.5" y="14">maturity</text>
</g>
<g
fill="#fff"
text-anchor="middle"
font-family="DejaVu Sans,Verdana,Geneva,sans-serif"
font-size="11"
>
<text x="83.0" y="15" fill="#010101" fill-opacity=".3">Alpha</text>
<text x="82.0" y="14">Alpha</text>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" width="103" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1" />
<stop offset="1" stop-opacity=".1" />
</linearGradient>
<mask id="anybadge_1">
<rect width="103" height="20" rx="3" fill="#fff" />
</mask>
<g mask="url(#anybadge_1)">
<path fill="#555" d="M0 0h44v20H0z" />
<path fill="#808080" d="M44 0h59v20H44z" />
<path fill="url(#b)" d="M0 0h103v20H0z" />
</g>
<g
fill="#fff"
text-anchor="middle"
font-family="DejaVu Sans,Verdana,Geneva,sans-serif"
font-size="11"
>
<text x="23.0" y="15" fill="#010101" fill-opacity=".3">pylint</text>
<text x="22.0" y="14">pylint</text>
</g>
<g
fill="#fff"
text-anchor="middle"
font-family="DejaVu Sans,Verdana,Geneva,sans-serif"
font-size="11"
>
<text x="74.5" y="15" fill="#010101" fill-opacity=".3">unknown</text>
<text x="73.5" y="14">unknown</text>
</g>
</svg>
# Configuration for known file extensions
[*.{css,htm,html,js,json,jsx,less,markdown,md,py,rst,sass,scss,toml,xml,yaml,yml}]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{json,yml,yaml,rst,markdown,md,toml}]
indent_size = 2
# Do not configure editor for libs
[{*/static/{lib,src/lib}/**}]
charset = unset
end_of_line = unset
indent_size = unset
indent_style = unset
insert_final_newline = false
trim_trailing_whitespace = false
include:
- project: xcg/ci-templates
file: /odoo/11.0/gitlab-ci.yaml
# vim: set shiftwidth=2:
# Defaults for all prettier-supported languages.
# Prettier will complete this with settings from .editorconfig file.
bracketSpacing: false
printWidth: 88
proseWrap: always
semi: true
trailingComma: "es5"
xmlWhitespaceSensitivity: "ignore"
rules:
document-start: disable
indentation:
indent-sequences: true
......@@ -2,4 +2,28 @@
Base Context
============
Provide a ``get_clean_context`` and ``with_lang`` method on models.
\ No newline at end of file
.. Update the path to the module below and to the branch
.. |coverage| image:: .badges/coverage.svg
:target: https://orus.io/xcg/odoo-modules/base_context/-/pipelines?ref=branch/11.0
:alt: Coverage report
.. the image is updated by the CI when building the documentation
.. |pylint| image:: .badges/pylint.svg
:target: https://orus.io/xcg/odoo-modules/base_context/-/pipelines?ref=branch/11.0
:alt: pylint score
.. Update the badge below depending on status
.. |maturity| image:: .badges/maturity.svg
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |license| image:: .badges/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |black| image:: .badges/code_style-black-000000.svg
:target: https://github.com/psf/black
:alt: Black
.. |prettier| image:: .badges/code_style-prettier-ff69b4.svg
:target: https://github.com/prettier/prettier
:alt: Prettier
|coverage| |pylint| |maturity| |license| |black| |prettier|
Provide a ``get_clean_context`` and ``with_lang`` method on models.
../.badges
\ No newline at end of file
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
LANGUAGE ?= en
BUILDDIRSUFFIX =
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
.PHONY: help Makefile gettext clean
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)/$(LANGUAGE)$(BUILDDIRSUFFIX)" $(SPHINXOPTS) $(O)
clean:
rm -rf $(BUILDDIR)/*
rm -f autotodo
# depends on autotodo.py but that does not work well with the catch-all below
autotodo:
@./autotodo.py ../ .py TODO,FIXME,XXX
gettext: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)$(BUILDDIRSUFFIX)" $(SPHINXOPTS) $(O)
# Use to update *.po files
update_locale: Makefile gettext
@sphinx-intl update -p "$(BUILDDIR)$(BUILDDIRSUFFIX)/gettext" -l $(LANGUAGE)
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile autotodo
@$(SPHINXBUILD) -b $@ "$(SOURCEDIR)" "$(BUILDDIR)/$@/$(LANGUAGE)$(BUILDDIRSUFFIX)" -d "$(BUILDDIR)$(BUILDDIRSUFFIX)/doctrees/$(LANGUAGE)" $(SPHINXOPTS) -D language=$(LANGUAGE) $(O)
../NEWS.rst
\ No newline at end of file
../README.rst
\ No newline at end of file
====
TODO
====
.. todolist::
.. include:: autotodo
#!/usr/bin/env python3
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014, 2018, 2022 XCG Consulting
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import os
import os.path
import sys
def main():
if len(sys.argv) != 4:
print("usage: autotodo.py <folder> <exts> <tags>")
sys.exit(1)
folder = sys.argv[1]
exts = sys.argv[2].split(",")
tags = sys.argv[3].split(",")
todolist = {tag: [] for tag in tags}
for root, _dirs, files in os.walk(folder):
scan_folder((exts, tags, todolist), root, files)
create_autotodo(folder, todolist)
def write_info(f, infos, folder):
# Check sphinx version for lineno-start support
import sphinx
if sphinx.version_info < (1, 3):
lineno_start = False
else:
lineno_start = True
for i in infos:
path = i[0]
line = i[1]
lines = (line - 3, line + 4)
class_name = ":class:`%s`" % os.path.basename(
os.path.splitext(path)[0]
)
f.write(
"%s\n"
"%s\n\n"
"Line %s\n"
"\t.. literalinclude:: %s\n"
"\t\t:language: python\n"
"\t\t:lines: %s-%s\n"
"\t\t:emphasize-lines: %s\n"
% (
class_name,
"-" * len(class_name),
line,
path,
lines[0],
lines[1],
line,
)
)
if lineno_start:
f.write("\t\t:lineno-start: %s\n" % lines[0])
f.write("\n")
def create_autotodo(folder, todolist):
with open("autotodo", "w+") as f:
for tag, info in list(todolist.items()):
f.write("%s\n%s\n\n" % (tag, "=" * len(tag)))
write_info(f, info, folder)
def scan_folder(data_tuple, dirname, names):
(exts, tags, res) = data_tuple
file_info = {}
for name in names:
(root, ext) = os.path.splitext(name)
if ext in exts:
file_info = scan_file(os.path.join(dirname, name), tags)
for tag, info in list(file_info.items()):
if info:
res[tag].extend(info)
def scan_file(filename, tags):
res = {tag: [] for tag in tags}
with open(filename, "r") as f:
for line_num, line in enumerate(f):
for tag in tags:
if tag in line:
res[tag].append((filename, line_num, line[:-1].strip()))
return res
if __name__ == "__main__":
main()
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import ast
import configparser
import os
import sys
import odoo
from odoo_scripts.config import Configuration
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath("."))
# -- General configuration ------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.graphviz",
"sphinxodoo.ext.autodoc",
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = ".rst"
# The master toctree document.
master_doc = "index"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
with open(os.path.join("..", "__manifest__.py"), "r") as f:
read_data = f.read()
d = ast.literal_eval(read_data)
# The full version, including alpha/beta/rc tags.
release = d["version"]
# The short X.Y version.
version = ".".join(release.split(".")[:4])
# General information about the project.
project = d["name"]
copyright = "2021 XCG Consulting"
author = d["author"]
module_nospace = project.replace(" ", "")
module_description = d.get("summary", "")
module_lowercase = module_nospace.lower()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
locale_dirs = ["locale"]
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["_build"]
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "default"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# Output file base name for HTML help builder.
htmlhelp_basename = "%sdoc" % module_nospace
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
master_doc,
"%s.tex" % module_nospace,
"%s Documentation" % project,
author,
"manual",
)
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, module_lowercase, "%s Documentation" % project, [author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
module_nospace,
"%s Documentation" % project,
author,
module_nospace,
module_description,
"Miscellaneous",
)
]
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"https://docs.python.org/3/": None}
#
# odoo-sphinx-autodoc
#
# sphinxodoo_addons: List of addons name to load (if empty, no addon will be
# loaded)
this_module = os.path.basename(
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
)
sphinxodoo_addons = [this_module]
# sphinxodoo_root_path : Path of the Odoo root directory
sphinxodoo_root_path = os.path.dirname(
os.path.dirname(os.path.abspath(odoo.__file__))
)
# sphinxodoo_addons_path : List of paths were Odoo addons to load are located
c = None
# find setup file of superproject, if any
directory = os.path.dirname(os.getenv("PWD"))
while not c and directory:
setup_path = os.path.join(directory, "setup.cfg")
if os.path.isfile(setup_path):
c = configparser.ConfigParser()
c.read(setup_path)
if c.has_section("odoo_scripts"):
# reload with odoo_scripts
c = Configuration(setup_path)
else:
c = None
if not c:
if os.path.dirname(directory) != directory:
directory = os.path.dirname(directory)
else:
directory = None
sphinxodoo_addons_path = []
if c:
addon_dirs = set(os.path.dirname(path) for path in c.modules)
for line in addon_dirs:
sphinxodoo_addons_path.append(os.path.join(directory, line))
else:
# add this directory top dir
sphinxodoo_addons_path.append(
os.path.dirname(os.path.dirname(os.getenv("PWD")))
)
other_addons = os.getenv("ODOO_ADDONS_PATH", default=None)
if other_addons:
for addon_path in other_addons.split(","):
sphinxodoo_addons_path.append(addon_path)
.. include:: README.rst
Contents:
.. toctree::
:maxdepth: 2
modules
NEWS
TODO
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment