# HG changeset patch # User Moctar Diallo <moctar.diallo@xcg.africa> # Date 1683626644 0 # Tue May 09 10:04:04 2023 +0000 # Branch 16.0 # Node ID 9b807ed3d96710c4bd984786df6b4ab65f1728da # Parent c318f48511dfc47b9010a7c162d7a83434097c75 Port to 16.0 diff --git a/.badges/maturity.svg b/.badges/maturity.svg --- a/.badges/maturity.svg +++ b/.badges/maturity.svg @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8" ?> -<svg xmlns="http://www.w3.org/2000/svg" width="177" height="20"> +<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="177" height="20" rx="3" fill="#fff" /> + <rect width="103" height="20" rx="3" fill="#fff" /> </mask> <g mask="url(#anybadge_1)"> <path fill="#555" d="M0 0h61v20H0z" /> - <path fill="#4c1" d="M61 0h116v20H61z" /> - <path fill="url(#b)" d="M0 0h177v20H0z" /> + <path fill="#e05d44" d="M61 0h42v20H61z" /> + <path fill="url(#b)" d="M0 0h103v20H0z" /> </g> <g fill="#fff" @@ -27,7 +27,7 @@ font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11" > - <text x="120.0" y="15" fill="#010101" fill-opacity=".3">Production/Stable</text> - <text x="119.0" y="14">Production/Stable</text> + <text x="83.0" y="15" fill="#010101" fill-opacity=".3">Alpha</text> + <text x="82.0" y="14">Alpha</text> </g> </svg> diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,187 @@ +env: + browser: true + es6: true + +# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449 +parserOptions: + ecmaVersion: 2019 + +overrides: + - files: + - "**/*.esm.js" + parserOptions: + sourceType: module + +# Globals available in Odoo that shouldn't produce errorings +globals: + _: readonly + $: readonly + fuzzy: readonly + jQuery: readonly + moment: readonly + odoo: readonly + openerp: readonly + owl: readonly + +# Styling is handled by Prettier, so we only need to enable AST rules; +# see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890 +rules: + accessor-pairs: warn + array-callback-return: warn + callback-return: warn + capitalized-comments: + - warn + - always + - ignoreConsecutiveComments: true + ignoreInlineComments: true + complexity: + - warn + - 15 + constructor-super: warn + dot-notation: warn + eqeqeq: warn + global-require: warn + handle-callback-err: warn + id-blacklist: warn + id-match: warn + init-declarations: error + max-depth: warn + max-nested-callbacks: warn + max-statements-per-line: warn + no-alert: warn + no-array-constructor: warn + no-caller: warn + no-case-declarations: warn + no-class-assign: warn + no-cond-assign: error + no-const-assign: error + no-constant-condition: warn + no-control-regex: warn + no-debugger: error + no-delete-var: warn + no-div-regex: warn + no-dupe-args: error + no-dupe-class-members: error + no-dupe-keys: error + no-duplicate-case: error + no-duplicate-imports: error + no-else-return: warn + no-empty-character-class: warn + no-empty-function: error + no-empty-pattern: error + no-empty: warn + no-eq-null: error + no-eval: error + no-ex-assign: error + no-extend-native: warn + no-extra-bind: warn + no-extra-boolean-cast: warn + no-extra-label: warn + no-fallthrough: warn + no-func-assign: error + no-global-assign: error + no-implicit-coercion: + - warn + - allow: ["~"] + no-implicit-globals: warn + no-implied-eval: warn + no-inline-comments: warn + no-inner-declarations: warn + no-invalid-regexp: warn + no-irregular-whitespace: warn + no-iterator: warn + no-label-var: warn + no-labels: warn + no-lone-blocks: warn + no-lonely-if: error + no-mixed-requires: error + no-multi-str: warn + no-native-reassign: error + no-negated-condition: warn + no-negated-in-lhs: error + no-new-func: warn + no-new-object: warn + no-new-require: warn + no-new-symbol: warn + no-new-wrappers: warn + no-new: warn + no-obj-calls: warn + no-octal-escape: warn + no-octal: warn + no-param-reassign: warn + no-path-concat: warn + no-process-env: warn + no-process-exit: warn + no-proto: warn + no-prototype-builtins: warn + no-redeclare: warn + no-regex-spaces: warn + no-restricted-globals: warn + no-restricted-imports: warn + no-restricted-modules: warn + no-restricted-syntax: warn + no-return-assign: error + no-script-url: warn + no-self-assign: warn + no-self-compare: warn + no-sequences: warn + no-shadow-restricted-names: warn + no-shadow: warn + no-sparse-arrays: warn + no-sync: warn + no-this-before-super: warn + no-throw-literal: warn + no-undef-init: warn + no-undef: error + no-unmodified-loop-condition: warn + no-unneeded-ternary: error + no-unreachable: error + no-unsafe-finally: error + no-unused-expressions: error + no-unused-labels: error + no-unused-vars: error + no-use-before-define: error + no-useless-call: warn + no-useless-computed-key: warn + no-useless-concat: warn + no-useless-constructor: warn + no-useless-escape: warn + no-useless-rename: warn + no-void: warn + no-with: warn + operator-assignment: [error, always] + prefer-const: warn + radix: warn + require-yield: warn + sort-imports: warn + spaced-comment: [error, always] + strict: [error, function] + use-isnan: error + valid-jsdoc: + - warn + - prefer: + arg: param + argument: param + augments: extends + constructor: class + exception: throws + func: function + method: function + prop: property + return: returns + virtual: abstract + yield: yields + preferType: + array: Array + bool: Boolean + boolean: Boolean + number: Number + object: Object + str: String + string: String + requireParamDescription: false + requireReturn: false + requireReturnDescription: false + requireReturnType: false + valid-typeof: warn + yoda: warn diff --git a/.flake8 b/.flake8 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,5 @@ [flake8] max-line-length = 88 +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/15.0/gitlab-ci.yaml + file: /odoo/16.0/gitlab-ci.yaml diff --git a/NEWS.rst b/NEWS.rst --- a/NEWS.rst +++ b/NEWS.rst @@ -1,6 +1,11 @@ Changelog ========= +16.0.1.0.0 +---------- + +* Port to 16.0 + 15.0.1.0.1 ---------- diff --git a/README.rst b/README.rst --- a/README.rst +++ b/README.rst @@ -3,10 +3,10 @@ ========== .. |coverage| image:: .badges/coverage.svg - :target: https://orus.io/xcg/odoo-modules/icuformat/-/pipelines?ref=branch/15.0 + :target: https://orus.io/xcg/odoo-modules/icuformat/-/pipelines?ref=branch/16.0 :alt: Coverage report .. |pylint| image:: .badges/pylint.svg - :target: https://orus.io/xcg/odoo-modules/icuformat/-/pipelines?ref=branch/15.0 + :target: https://orus.io/xcg/odoo-modules/icuformat/-/pipelines?ref=branch/16.0 :alt: pylint score .. Update the badge below depending on status .. |maturity| image:: .badges/maturity.svg diff --git a/__manifest__.py b/__manifest__.py --- a/__manifest__.py +++ b/__manifest__.py @@ -21,7 +21,7 @@ { "name": "ICU Format", "summary": "Format message using ICU", - "version": "15.0.1.0.1", + "version": "16.0.1.0.0", "category": "Technical", "author": "XCG Consulting", "website": "https://odoo.consulting/", diff --git a/doc/autotodo.py b/doc/autotodo.py --- a/doc/autotodo.py +++ b/doc/autotodo.py @@ -99,8 +99,8 @@ res[tag].extend(info) -def scan_file(filename, tags) -> tuple[dict[str, tuple[str, int, str]], int]: - res = {tag: [] for tag in tags} +def scan_file(filename, tags) -> tuple[dict[str, list[tuple[str, int, str]]], int]: + res: dict[str, list[tuple[str, int, str]]] = {tag: [] for tag in tags} line_num: int = 0 with open(filename, "r") as f: for line_num, line in enumerate(f): diff --git a/doc/conf.py b/doc/conf.py --- a/doc/conf.py +++ b/doc/conf.py @@ -11,6 +11,7 @@ import configparser import os import sys +from importlib.metadata import PackageNotFoundError, version from odoo_scripts.config import Configuration @@ -34,7 +35,7 @@ "sphinx.ext.coverage", "sphinx.ext.graphviz", "sphinx.ext.viewcode", - "sphinxodoo.ext.autodoc", + "sphinxodooautodoc.ext.autodoc", ] # Add any paths that contain templates here, relative to this directory. @@ -50,18 +51,24 @@ # 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. -# + +# The full version, including alpha/beta/rc tags. +try: + # TEMPLATE Update with the name of the project as defined in pyproject.toml + release = version("odoo-addon-icuformat") + # The short X.Y version. + version = ".".join(release.split(".")[:2]) +except PackageNotFoundError: + # No version number if not installed + pass + 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, 2022 XCG Consulting" +copyright = "2021, 2022, 2023 XCG Consulting" author = d["author"] module_nospace = project.replace(" ", "") module_description = d.get("summary", "") @@ -145,18 +152,20 @@ intersphinx_mapping = {"https://docs.python.org/3/": None} -# -# odoo-sphinx-autodoc -# +# -- Options for sphinx-odoo-autodoc extension ---------------------------- -# sphinxodoo_addons : List of addons name to load (if empty, no addon will be loaded) +# sphinxodooautodoc_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 +sphinxodooautodoc_addons = [this_module] +# sphinxodooautodoc_root_path : Path of the Odoo root directory +sphinxodooautodoc_root_path = os.path.dirname( + os.path.dirname(os.path.abspath(odoo.__file__)) +) +# TODO devrait ne rien contenir si tout est bien installé comme voulu.tp +# sphinxodooautodoc_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")) @@ -176,17 +185,19 @@ else: directory = None -sphinxodoo_addons_path = list() +sphinxodooautodoc_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)) + sphinxodooautodoc_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")))) + sphinxodooautodoc_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) + sphinxodooautodoc_addons_path.append(addon_path) diff --git a/doc/modules.rst b/doc/modules.rst --- a/doc/modules.rst +++ b/doc/modules.rst @@ -1,7 +1,7 @@ -icuformat -========= +odoo_module +=========== .. toctree:: :maxdepth: 4 - icuformat + odoo_module diff --git a/pyproject.toml b/pyproject.toml --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,46 @@ +[project] +# TEMPLATE update this value +name = "odoo-addon-icuformat" +dynamic = ["version"] +readme = "README.rst" +requires-python = "~=3.10.0" +license = { file = "LICENSE", name = "GNU Affero General Public License v3" } +keywords = ["odoo"] +authors = [{ name = "XCG Consulting" }] +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Framework :: Odoo", + "Framework :: Odoo :: 16.0", + "License :: OSI Approved :: GNU Affero General Public License v3" +] +dependencies = ["odoo==16.0.*", "PyICU"] + +[project.optional-dependencies] +doc = ["sphinx", "sphinx-odoo-autodoc"] +test = [] + +[project.urls] +# TEMPLATE update these values +repository = "https://orus.io/xcg/template/icuformat" +changelog = "https://orus.io/xcg/template/icuformat/-/blob/branch/16.0/NEWS.rst" + +[build-system] +requires = ["setuptools >=64.0.0", "wheel", "setuptools_scm[toml] >=6.2"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +# When using this template, update this value +package-dir = { "odoo.addons.icuformat" = "." } + +[tool.setuptools.package-data] +"*" = ["*"] + +[tool.setuptools_scm] + +[tool.black] +target = 3.10 + [tool.isort] py_version = 310 profile = "black" @@ -12,6 +55,3 @@ 'FIRSTPARTY', 'LOCALFOLDER' ] - -[tool.black] -target = 3.10