# HG changeset patch # User Houzefa Abbasbhay <houzefa.abba@xcg-consulting.fr> # Date 1690382984 -7200 # Wed Jul 26 16:49:44 2023 +0200 # Branch 11.0 # Node ID 56863a32554d71340f02c82f3486702e5da0d497 # Parent 8418ced6ef59685557e03429da4457719f17b358 QoL updates according to module template diff --git a/.editorconfig b/.editorconfig new file mode 100644 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# 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 diff --git a/.flake8 b/.flake8 new file mode 100644 --- /dev/null +++ b/.flake8 @@ -0,0 +1,4 @@ +[flake8] +per-file-ignores= + __init__.py:F401 + __manifest__.py:B018 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,3 @@ include: -- project: xcg/ci-templates - file: /odoo/11.0/gitlab-ci.yaml + - project: xcg/ci-templates + file: /odoo/11.0/gitlab-ci.yaml diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -1,28 +1,3 @@ syntax: glob -**/*.pyc -*.pyc -*.pyo -*.swp -.tmp* -*~ -.~* -*.egg-info -dist/* -build/* -lib/* -output/* -*.orig -*.log -.settings/* -storage/* -.project -.idea -.pydevproject -*.db -.ropeproject/* -.mob ./doc/_build ./doc/autotodo -./doc/manifest -pyproject.toml -.isort.cfg diff --git a/.prettierrc.yml b/.prettierrc.yml new file mode 100644 --- /dev/null +++ b/.prettierrc.yml @@ -0,0 +1,8 @@ +# 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" diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,4 @@ +rules: + document-start: disable + indentation: + indent-sequences: true diff --git a/NEWS.rst b/NEWS.rst --- a/NEWS.rst +++ b/NEWS.rst @@ -1,3 +1,7 @@ +========= +Changelog +========= + 11.0.1.2 -------- diff --git a/README.rst b/README.rst --- a/README.rst +++ b/README.rst @@ -1,5 +1,3 @@ -.. _README: - Accounting Periods ================== diff --git a/__init__.py b/__init__.py --- a/__init__.py +++ b/__init__.py @@ -1,3 +1,1 @@ -# flake8: noqa - from . import models, wizards diff --git a/__manifest__.py b/__manifest__.py --- a/__manifest__.py +++ b/__manifest__.py @@ -1,7 +1,7 @@ ############################################################################## # # Accounting Periods, for Odoo -# Copyright (C) 2018, 2020 XCG Consulting <http://odoo.consulting> +# Copyright (C) 2018, 2020 XCG Consulting <https://xcg-consulting.fr> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -25,7 +25,7 @@ "version": "11.0.1.2", "category": "Accounting", "author": "XCG Consulting", - "website": "http://odoo.consulting/", + "website": "https://orbeet.io/", "depends": ["account"], "data": [ "security/ir.model.access.csv", diff --git a/demo/account_fiscalyear_and_periods.xml b/demo/account_fiscalyear_and_periods.xml --- a/demo/account_fiscalyear_and_periods.xml +++ b/demo/account_fiscalyear_and_periods.xml @@ -1,6 +1,5 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> - <!-- Load default fiscal years and periods when building a demo database. This matters when running automated tests. --> @@ -27,8 +26,10 @@ <field name="fiscalyear_id" ref="data_fiscalyear" /> <field name="date_start" eval="time.strftime('%Y')+'-02-01'" /> <!-- Last day of February: 1 day before March 1st. --> - <field name="date_stop" - eval="(DateTime.today().replace(month=3, day=1) - timedelta(days=1)).strftime('%Y-%m-%d')" /> + <field + name="date_stop" + eval="(DateTime.today().replace(month=3, day=1) - timedelta(days=1)).strftime('%Y-%m-%d')" + /> <field name="company_id" ref="base.main_company" /> </record> <record id="period_3" model="account.period"> @@ -111,5 +112,4 @@ <field name="date_stop" eval="time.strftime('%Y')+'-12-31'" /> <field name="company_id" ref="base.main_company" /> </record> - </odoo> diff --git a/doc/Makefile b/doc/Makefile --- a/doc/Makefile +++ b/doc/Makefile @@ -1,198 +1,42 @@ -# Makefile for Sphinx documentation +# Minimal makefile for Sphinx documentation # -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = _build +# 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 -project:=$(shell basename $(shell readlink -f ..)) -branch:=$(shell hg identify --branch) +.PHONY: help Makefile gettext clean -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -# the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . - -.PHONY: help +# Put it first so that "make" without argument is like "make help". help: - @echo "Please use \`make <target>' where <target> is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " applehelp to make an Apple Help Book" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " texinfo to make Texinfo files" - @echo " info to make Texinfo files and run them through makeinfo" - @echo " gettext to make PO message catalogs" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " xml to make Docutils-native XML files" - @echo " pseudoxml to make pseudoxml-XML files for display purposes" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - @echo " coverage to run coverage check of the documentation (if enabled)" + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)/$(LANGUAGE)$(BUILDDIRSUFFIX)" $(SPHINXOPTS) $(O) -.PHONY: clean clean: rm -rf $(BUILDDIR)/* - rm -f autotodo manifest - -.PHONY: html -html: manifest autotodo - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -.PHONY: dirhtml -dirhtml: manifest autotodo - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -.PHONY: singlehtml -singlehtml: manifest autotodo - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -.PHONY: pickle -pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -.PHONY: json -json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -.PHONY: htmlhelp -htmlhelp: manifest autotodo - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -.PHONY: epub -epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -.PHONY: latex -latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -.PHONY: latexpdf -latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -.PHONY: latexpdfja -latexpdfja: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through platex and dvipdfmx..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + rm -f autotodo -.PHONY: text -text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -.PHONY: man -man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -.PHONY: texinfo -texinfo: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." - @echo "Run \`make' in that directory to run these through makeinfo" \ - "(use \`make info' here to do that automatically)." - -.PHONY: info -info: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo "Running Texinfo files through makeinfo..." - make -C $(BUILDDIR)/texinfo info - @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." - -.PHONY: gettext -gettext: - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale - @echo - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." - -.PHONY: changes -changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -.PHONY: linkcheck -linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -.PHONY: doctest -doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." - -.PHONY: coverage -coverage: - $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage - @echo "Testing of coverage in the sources finished, look at the " \ - "results in $(BUILDDIR)/coverage/python.txt." - -.PHONY: xml -xml: - $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml - @echo - @echo "Build finished. The XML files are in $(BUILDDIR)/xml." - -.PHONY: pseudoxml -pseudoxml: - $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml - @echo - @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." - -autotodo: autotodo.py +# depends on autotodo.py but that does not work well with the catch-all below +autotodo: @./autotodo.py ../ .py TODO,FIXME,XXX -manifest: ../__manifest__.py manifest.py - @./manifest.py +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) diff --git a/doc/account_period.models.rst b/doc/account_period.models.rst deleted file mode 100644 --- a/doc/account_period.models.rst +++ /dev/null @@ -1,46 +0,0 @@ -account\_period.models package -============================== - -Submodules ----------- - -account\_period.models.account\_fiscalyear module -------------------------------------------------- - -.. automodule:: odoo.addons.account_period.models.account_fiscalyear - :members: - :undoc-members: - :show-inheritance: - -account\_period.models.account\_move module -------------------------------------------- - -.. automodule:: odoo.addons.account_period.models.account_move - :members: - :undoc-members: - :show-inheritance: - -account\_period.models.account\_move\_line module -------------------------------------------------- - -.. automodule:: odoo.addons.account_period.models.account_move_line - :members: - :undoc-members: - :show-inheritance: - -account\_period.models.account\_period module ---------------------------------------------- - -.. automodule:: odoo.addons.account_period.models.odoo.addons.account_period - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: odoo.addons.account_period.models - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/account_period.rst b/doc/account_period.rst deleted file mode 100644 --- a/doc/account_period.rst +++ /dev/null @@ -1,19 +0,0 @@ -account\_period package -======================= - -Subpackages ------------ - -.. toctree:: - - account_period.models - account_period.tests - account_period.wizards - -Module contents ---------------- - -.. automodule:: account_period - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/account_period.tests.rst b/doc/account_period.tests.rst deleted file mode 100644 --- a/doc/account_period.tests.rst +++ /dev/null @@ -1,37 +0,0 @@ -account\_period.tests package -============================= - -Subpackages ------------ - -.. toctree:: - - account_period.tests.util - -Submodules ----------- - -account\_period.tests.test\_account\_fiscalyear module ------------------------------------------------------- - -.. automodule:: odoo.addons.account_period.tests.test_account_fiscalyear - :members: - :undoc-members: - :show-inheritance: - -account\_period.tests.test\_account\_period module --------------------------------------------------- - -.. automodule:: odoo.addons.account_period.tests.test_account_period - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: odoo.addons.account_period.tests - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/account_period.tests.util.rst b/doc/account_period.tests.util.rst deleted file mode 100644 --- a/doc/account_period.tests.util.rst +++ /dev/null @@ -1,38 +0,0 @@ -account\_period.tests.util package -================================== - -Submodules ----------- - -account\_period.tests.util.odoo\_tests module ---------------------------------------------- - -.. automodule:: odoo.addons.account_period.tests.util.odoo_tests - :members: - :undoc-members: - :show-inheritance: - -account\_period.tests.util.singleton module -------------------------------------------- - -.. automodule:: odoo.addons.account_period.tests.util.singleton - :members: - :undoc-members: - :show-inheritance: - -account\_period.tests.util.uuidgen module ------------------------------------------ - -.. automodule:: odoo.addons.account_period.tests.util.uuidgen - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: odoo.addons.account_period.tests.util - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/account_period.wizards.rst b/doc/account_period.wizards.rst deleted file mode 100644 --- a/doc/account_period.wizards.rst +++ /dev/null @@ -1,22 +0,0 @@ -account\_period.wizards package -=============================== - -Submodules ----------- - -account\_period.wizards.account\_period\_close module ------------------------------------------------------ - -.. automodule:: odoo.addons.account_period.wizards.account_period_close - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: odoo.addons.account_period.wizards - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/autotodo.py b/doc/autotodo.py --- a/doc/autotodo.py +++ b/doc/autotodo.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2014, 2018 XCG Consulting +# 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 @@ -34,7 +34,7 @@ tags = sys.argv[3].split(",") todolist = {tag: [] for tag in tags} - for root, dirs, files in os.walk(folder): + for root, _dirs, files in os.walk(folder): scan_folder((exts, tags, todolist), root, files) create_autotodo(folder, todolist) @@ -81,7 +81,7 @@ def create_autotodo(folder, todolist): with open("autotodo", "w+") as f: - for tag, info in todolist.items(): + for tag, info in list(todolist.items()): f.write("%s\n%s\n\n" % (tag, "=" * len(tag))) write_info(f, info, folder) @@ -93,7 +93,7 @@ (root, ext) = os.path.splitext(name) if ext in exts: file_info = scan_file(os.path.join(dirname, name), tags) - for tag, info in file_info.items(): + for tag, info in list(file_info.items()): if info: res[tag].extend(info) diff --git a/doc/conf.py b/doc/conf.py --- a/doc/conf.py +++ b/doc/conf.py @@ -1,6 +1,3 @@ -# Accounting periods documentation build configuration file, created by -# sphinx-quickstart on Mon Apr 30 16:15:00 2018. -# # This file is execfile()d with the current directory set to its # containing dir. # @@ -17,6 +14,8 @@ 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. @@ -24,9 +23,6 @@ # -- General configuration ------------------------------------------------ -# If your documentation needs a minimal Sphinx version, state it here. -# needs_sphinx = '1.0' - # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. @@ -36,8 +32,7 @@ "sphinx.ext.intersphinx", "sphinx.ext.todo", "sphinx.ext.coverage", - "sphinx.ext.ifconfig", - "sphinx.ext.viewcode", + "sphinx.ext.graphviz", "sphinxodoo.ext.autodoc", ] @@ -46,12 +41,8 @@ # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: -# source_suffix = ['.rst', '.md'] source_suffix = ".rst" -# The encoding of source files. -# source_encoding = 'utf-8-sig' - # The master toctree document. master_doc = "index" @@ -69,7 +60,7 @@ # General information about the project. project = d["name"] -copyright = "2018, XCG Consulting" +copyright = "2023 XCG Consulting" author = d["author"] module_nospace = project.replace(" ", "") module_description = d.get("summary", "") @@ -82,40 +73,15 @@ # Usually you set "language" from the command line for these cases. language = None -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -# today = '' -# Else, today_fmt is used as the format for a strftime call. -# today_fmt = '%B %d, %Y' +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 reST default role (used for this markup: `text`) to use for all -# documents. -# default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -# add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -# add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -# show_authors = False - # The name of the Pygments (syntax highlighting) style to use. pygments_style = "sphinx" -# A list of ignored prefixes for module index sorting. -# modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -# keep_warnings = False - # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True @@ -126,110 +92,17 @@ # a list of builtin themes. html_theme = "default" -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -# html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# "<project> v<release> documentation". -# html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -# html_logo = None - -# The name of an image file (relative to this directory) to use as a favicon of -# the docs. This file should be a Windows icon file (.ico) being 16x16 or -# 32x32 pixels large. -# html_favicon = None - # 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"] -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -# html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -# html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -# html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -# html_additional_pages = {} - -# If false, no module index is generated. -# html_domain_indices = True - -# If false, no index is generated. -# html_use_index = True - -# If true, the index is split into individual pages for each letter. -# html_split_index = False - -# If true, links to the reST sources are added to the pages. -# html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a <link> tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -# html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -# html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# Now only 'ja' uses this config value -# html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -# html_search_scorer = 'scorer.js' - # Output file base name for HTML help builder. htmlhelp_basename = "%sdoc" % module_nospace # -- Options for LaTeX output --------------------------------------------- -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # 'preamble': '', - # Latex figure (float) alignment - # 'figure_align': 'htbp', -} +latex_elements = {} # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, @@ -244,27 +117,6 @@ ) ] -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# latex_use_parts = False - -# If true, show page references after internal links. -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# latex_appendices = [] - -# If false, no module index is generated. -# latex_domain_indices = True - - # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples @@ -273,10 +125,6 @@ (master_doc, module_lowercase, "%s Documentation" % project, [author], 1) ] -# If true, show URL addresses after external links. -# man_show_urls = False - - # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples @@ -285,29 +133,15 @@ texinfo_documents = [ ( master_doc, - "AccountingPeriods", - u"Accounting periods documentation", + module_nospace, + "%s Documentation" % project, author, - "AccountingPeriods", - """ -Accounting periods -""", + module_nospace, + module_description, "Miscellaneous", ) ] -# Documents to append as an appendix to all manuals. -# texinfo_appendices = [] - -# If false, no module index is generated. -# texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -# texinfo_no_detailmenu = False - # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {"https://docs.python.org/3/": None} @@ -335,7 +169,10 @@ if os.path.isfile(setup_path): c = configparser.ConfigParser() c.read(setup_path) - if not c.has_section("odoo_scripts"): + 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: @@ -343,13 +180,19 @@ else: directory = None -sphinxodoo_addons_path = list() +sphinxodoo_addons_path = [] if c: - addon_dirs = set( - os.path.dirname(path) - for path in c.get("odoo_scripts", "modules").split() - ) + 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) diff --git a/doc/index.rst b/doc/index.rst --- a/doc/index.rst +++ b/doc/index.rst @@ -1,11 +1,10 @@ -.. include:: manifest +.. include:: README.rst Contents: .. toctree:: :maxdepth: 2 - README modules NEWS TODO diff --git a/doc/manifest.py b/doc/manifest.py deleted file mode 100755 --- a/doc/manifest.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python3 -############################################################################### -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2016, 2018 XCG Consulting (http://www.xcg-consulting.fr/) -# -# 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 - -from odoo.modules import load_information_from_description_file - - -def main(): - module = os.path.basename( - os.path.dirname(os.path.dirname(os.path.realpath(__file__))) - ) - d = load_information_from_description_file(module) - with open("manifest", "w") as out: - manifest_content = ( - d["description"] - if "description" in d - else d["summary"] - if "summary" in d - else "" - ) - out.write(manifest_content) - - -if __name__ == "__main__": - main() diff --git a/doc/modules.rst b/doc/modules.rst deleted file mode 100644 --- a/doc/modules.rst +++ /dev/null @@ -1,7 +0,0 @@ -account_period -============== - -.. toctree:: - :maxdepth: 4 - - account_period diff --git a/models/__init__.py b/models/__init__.py --- a/models/__init__.py +++ b/models/__init__.py @@ -1,5 +1,3 @@ -# flake8: noqa - from . import ( account_fiscalyear, account_move, diff --git a/models/account_fiscalyear.py b/models/account_fiscalyear.py --- a/models/account_fiscalyear.py +++ b/models/account_fiscalyear.py @@ -1,7 +1,7 @@ ############################################################################## # # Accounting periods, for Odoo -# Copyright (C) 2018 XCG Consulting <http://odoo.consulting> +# Copyright (C) 2018 XCG Consulting <https://xcg-consulting.fr> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/models/account_move.py b/models/account_move.py --- a/models/account_move.py +++ b/models/account_move.py @@ -1,7 +1,7 @@ ############################################################################## # # Accounting periods, for Odoo -# Copyright (C) 2018 XCG Consulting <http://odoo.consulting> +# Copyright (C) 2018 XCG Consulting <https://xcg-consulting.fr> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/models/account_move_line.py b/models/account_move_line.py --- a/models/account_move_line.py +++ b/models/account_move_line.py @@ -1,7 +1,7 @@ ############################################################################## # # Accounting periods, for Odoo -# Copyright (C) 2018 XCG Consulting <http://odoo.consulting> +# Copyright (C) 2018 XCG Consulting <https://xcg-consulting.fr> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/models/account_period.py b/models/account_period.py --- a/models/account_period.py +++ b/models/account_period.py @@ -1,7 +1,7 @@ ############################################################################## # # Accounting periods, for Odoo -# Copyright (C) 2018 XCG Consulting <http://odoo.consulting> +# Copyright (C) 2018 XCG Consulting <https://xcg-consulting.fr> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/security/record_rules.xml b/security/record_rules.xml --- a/security/record_rules.xml +++ b/security/record_rules.xml @@ -1,10 +1,11 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> - <!-- These come straight from Odoo 8 (named the same & same rules on purpose). --> <record id="fiscal_year_comp_rule" model="ir.rule"> - <field name="domain_force"><![CDATA[ + <field + name="domain_force" + ><![CDATA[ [ '|', ('company_id', '=', False), @@ -17,7 +18,9 @@ </record> <record id="period_comp_rule" model="ir.rule"> - <field name="domain_force"><![CDATA[ + <field + name="domain_force" + ><![CDATA[ [ '|', ('company_id', '=', False), @@ -28,5 +31,4 @@ <field name="model_id" ref="model_account_period" /> <field name="name">Period multi-company</field> </record> - </odoo> diff --git a/tests/__init__.py b/tests/__init__.py --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,3 +1,1 @@ -# flake8: noqa - from . import test_account_fiscalyear, test_account_period diff --git a/tests/test_account_fiscalyear.py b/tests/test_account_fiscalyear.py --- a/tests/test_account_fiscalyear.py +++ b/tests/test_account_fiscalyear.py @@ -1,7 +1,7 @@ ############################################################################## # # Accounting periods, for Odoo -# Copyright (C) 2018 XCG Consulting <http://odoo.consulting> +# Copyright (C) 2018 XCG Consulting <https://xcg-consulting.fr> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/tests/util/odoo_tests.py b/tests/util/odoo_tests.py --- a/tests/util/odoo_tests.py +++ b/tests/util/odoo_tests.py @@ -1,7 +1,7 @@ ############################################################################## # # Accounting periods, for Odoo -# Copyright (C) 2018 XCG Consulting <http://odoo.consulting> +# Copyright (C) 2018 XCG Consulting <https://xcg-consulting.fr> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/views/account_fiscalyear.xml b/views/account_fiscalyear.xml --- a/views/account_fiscalyear.xml +++ b/views/account_fiscalyear.xml @@ -1,16 +1,13 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> - <record id="account_fiscalyear_search" model="ir.ui.view"> <field name="name">account_fiscalyear_search</field> <field name="model">account.fiscalyear</field> <field name="arch" type="xml"> - <search> <field name="name" /> <field name="code" /> </search> - </field> </record> @@ -18,14 +15,12 @@ <field name="name">account_fiscalyear_list</field> <field name="model">account.fiscalyear</field> <field name="arch" type="xml"> - <tree> <field name="name" /> <field name="code" /> <field name="company_id" /> <field name="period_ids" /> </tree> - </field> </record> @@ -33,9 +28,7 @@ <field name="name">account_fiscalyear_form</field> <field name="model">account.fiscalyear</field> <field name="arch" type="xml"> - <form> - <!-- Utility fields. --> <field name="id" invisible="1" /> @@ -49,7 +42,12 @@ </group> <group> - <button string="Create Monthly Periods" name="create_period" colspan="2" type="object"/> + <button + string="Create Monthly Periods" + name="create_period" + colspan="2" + type="object" + /> </group> <group string="Periods"> @@ -66,17 +64,18 @@ </group> </sheet> </form> - </field> </record> <!-- Add action to drive reallocation periods --> <record id="server_action_realloc_period_am" model="ir.actions.server"> - <field name="code"> + <field + name="code" + ><![CDATA[ if records: action = records.action_realloc_period_am() - </field> +]]></field> <field name="model_id" ref="model_account_fiscalyear" /> <field name="name">Realloc Period</field> <field name="state">code</field> @@ -93,7 +92,9 @@ <field name="view_type">form</field> </record> - <menuitem id="account_fiscalyear_menu_command" parent="account.account_account_menu" - action="account_fiscalyear_action" /> - + <menuitem + id="account_fiscalyear_menu_command" + parent="account.account_account_menu" + action="account_fiscalyear_action" + /> </odoo> diff --git a/views/account_move.xml b/views/account_move.xml --- a/views/account_move.xml +++ b/views/account_move.xml @@ -1,6 +1,5 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> - <!-- Add a period & dates onto accounting documents. --> <!-- Inherit from the acc doc form view defined in "account". --> @@ -9,7 +8,6 @@ <field name="model">account.move</field> <field name="inherit_id" ref="account.view_move_form" /> <field name="arch" type="xml"> - <!-- Add fields. --> <xpath expr="//field[@name='date']" position="before"> <field name="period_id" options="{'no_create': 1}" states="posted" /> @@ -17,8 +15,6 @@ <xpath expr="//field[@name='date']" position="after"> <field name="transaction_date" /> </xpath> - </field> </record> - </odoo> diff --git a/views/account_period.xml b/views/account_period.xml --- a/views/account_period.xml +++ b/views/account_period.xml @@ -1,22 +1,25 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> - <record id="account_period_search" model="ir.ui.view"> <field name="name">account_period_search</field> <field name="model">account.period</field> <field name="arch" type="xml"> - <search> <field name="code" /> <separator /> - <filter name="filter_open" string="Open periods" - domain="[('state', '=', 'draft')]" /> - <filter name="filter_closed" string="Closed periods" - domain="[('state', '=', 'done')]" /> + <filter + name="filter_open" + string="Open periods" + domain="[('state', '=', 'draft')]" + /> + <filter + name="filter_closed" + string="Closed periods" + domain="[('state', '=', 'done')]" + /> </search> - </field> </record> @@ -24,7 +27,6 @@ <field name="name">account_period_list</field> <field name="model">account.period</field> <field name="arch" type="xml"> - <tree> <field name="fiscalyear_id" /> <field name="name" /> @@ -35,7 +37,6 @@ <field name="date_cutoff" /> <field name="state" /> </tree> - </field> </record> @@ -43,14 +44,21 @@ <field name="name">account_period_form</field> <field name="model">account.period</field> <field name="arch" type="xml"> - <form> <header> - <button string="Close the period" - name="%(account_period.action_account_period_close)d" - type="action" class="oe_highlight" states="draft" /> - <button string="Re-open the period" name="reopen_period" - type="object" states="done" /> + <button + string="Close the period" + name="%(account_period.action_account_period_close)d" + type="action" + class="oe_highlight" + states="draft" + /> + <button + string="Re-open the period" + name="reopen_period" + type="object" + states="done" + /> <field name="state" widget="statusbar" /> </header> @@ -66,14 +74,15 @@ </group> </sheet> </form> - </field> </record> <!-- Add a menu command to manage accounting period. --> <record id="account_period_action" model="ir.actions.act_window"> - <field name="context"><![CDATA[ + <field + name="context" + ><![CDATA[ {"search_default_filter_open": 1} ]]></field> <field name="name">Periods</field> @@ -81,9 +90,11 @@ <field name="view_mode">tree,form</field> <field name="view_type">form</field> </record> - + <record id="redirect_warning_account_period_action" model="ir.actions.act_window"> - <field name="context"><![CDATA[ + <field + name="context" + ><![CDATA[ {"search_default_filter_open": 1} ]]></field> <field name="name">Periods</field> @@ -91,16 +102,17 @@ <field name="view_type">form</field> <field name="view_mode">tree,form</field> <field name="help" type="html"> - <p class="oe_view_nocontent_create"> - Click to add a fiscal period. - </p><p> - An accounting period typically is a month or a quarter. It + <p class="oe_view_nocontent_create">Click to add a fiscal period.</p> + <p> + An accounting period typically is a month or a quarter. It usually corresponds to the periods of the tax declaration. - </p> + </p> </field> </record> - <menuitem id="account_period_menu_command" parent="account.account_account_menu" - action="account_period_action" /> - + <menuitem + id="account_period_menu_command" + parent="account.account_account_menu" + action="account_period_action" + /> </odoo> diff --git a/wizards/__init__.py b/wizards/__init__.py --- a/wizards/__init__.py +++ b/wizards/__init__.py @@ -1,3 +1,1 @@ -# flake8: noqa - from . import account_period_close diff --git a/wizards/account_period_close.py b/wizards/account_period_close.py --- a/wizards/account_period_close.py +++ b/wizards/account_period_close.py @@ -1,8 +1,7 @@ -# -*- coding: utf-8 -*- ############################################################################## # # Accounting periods, for Odoo -# Copyright (C) 2018 XCG Consulting <http://odoo.consulting> +# Copyright (C) 2018 XCG Consulting <https://xcg-consulting.fr> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/wizards/account_period_close_view.xml b/wizards/account_period_close_view.xml --- a/wizards/account_period_close_view.xml +++ b/wizards/account_period_close_view.xml @@ -1,21 +1,24 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> - <record id="view_account_period_close" model="ir.ui.view"> <field name="name">account.period.close.form</field> <field name="model">account.period.close</field> <field name="arch" type="xml"> <form string="Period closure"> - <label for="validated" string="Please confirm the period closure." /> <group> <field name="validated" /> </group> - + <footer> - <button string="Close the period" name="close" type="object" class="oe_highlight"/> + <button + string="Close the period" + name="close" + type="object" + class="oe_highlight" + /> or - <button string="Cancel" class="oe_link" special="cancel"/> + <button string="Cancel" class="oe_link" special="cancel" /> </footer> </form> </field> @@ -27,8 +30,7 @@ <field name="res_model">account.period.close</field> <field name="view_type">form</field> <field name="view_mode">form</field> - <field name="view_id" ref="view_account_period_close"/> + <field name="view_id" ref="view_account_period_close" /> <field name="target">new</field> </record> - </odoo>