# HG changeset patch # User Axel Prel <axel.prel@xcg-consulting.fr> # Date 1730902092 -3600 # Wed Nov 06 15:08:12 2024 +0100 # Branch 18.0 # Node ID 5a1baf89bc2866b34404f18a5ad993d232561310 # Parent 49075acb2151d9ef03852d3c1366166c556ad998 migrate to Odoo 18 diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 --- a/.eslintrc.yml +++ /dev/null @@ -1,187 +0,0 @@ -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/.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/17.0/gitlab-ci.yaml + file: /odoo/18.0/gitlab-ci.yaml diff --git a/.prettierrc.yml b/.prettierrc.yml deleted file mode 100644 --- a/.prettierrc.yml +++ /dev/null @@ -1,8 +0,0 @@ -# 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/NEWS.rst b/NEWS.rst --- a/NEWS.rst +++ b/NEWS.rst @@ -1,7 +1,7 @@ Changelog ========= -17.0.1.0.0 +18.0.1.0.0 ---------- -Migration to Odoo 17. +Migration to Odoo 18. diff --git a/__manifest__.py b/__manifest__.py --- a/__manifest__.py +++ b/__manifest__.py @@ -22,7 +22,7 @@ "name": "Converter", "license": "AGPL-3", "summary": "Convert odoo records to/from plain data structures.", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "category": "Hidden", "author": "XCG Consulting", "website": "https://orbeet.io/", diff --git a/base.py b/base.py --- a/base.py +++ b/base.py @@ -178,8 +178,8 @@ self.from_odoo_arg_count = len(sig.parameters) if self.from_odoo_arg_count not in (1, 2): raise ValueError( - "Computed 'from_odoo' callback must have 1 or 2 args: got %s" - % self.from_odoo_arg_count + "Computed 'from_odoo' callback must have 1 or 2 args:", + " got {self.from_odoo_arg_count}", ) def odoo_to_message( diff --git a/doc/autotodo.py b/doc/autotodo.py --- a/doc/autotodo.py +++ b/doc/autotodo.py @@ -55,7 +55,7 @@ path = i[0] line = i[1] lines = (line - 3, min(line + 4, path_file_length[path])) - class_name = ":class:`%s`" % os.path.basename(os.path.splitext(path)[0]) + class_name = f":class:`{os.path.basename(os.path.splitext(path)[0])}`" f.write( "{}\n" "{}\n\n" diff --git a/doc/conf.py b/doc/conf.py --- a/doc/conf.py +++ b/doc/conf.py @@ -8,15 +8,11 @@ # serve to show the default. import ast -import configparser import os import sys from importlib.metadata import PackageNotFoundError from importlib.metadata import version as import_version -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. @@ -35,7 +31,6 @@ "sphinx.ext.coverage", "sphinx.ext.graphviz", "sphinx.ext.viewcode", - "sphinxodooautodoc.ext.autodoc", ] # Add any paths that contain templates here, relative to this directory. @@ -105,7 +100,7 @@ html_static_path = ["_static"] # Output file base name for HTML help builder. -htmlhelp_basename = "%sdoc" % module_nospace +htmlhelp_basename = f"{module_nospace}doc" # -- Options for LaTeX output --------------------------------------------- @@ -117,8 +112,8 @@ latex_documents = [ ( master_doc, - "%s.tex" % module_nospace, - "%s Documentation" % project, + f"{module_nospace}.tex", + f"{project} Documentation", author, "manual", ) @@ -128,7 +123,7 @@ # 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)] +man_pages = [(master_doc, module_lowercase, f"{project} Documentation", [author], 1)] # -- Options for Texinfo output ------------------------------------------- @@ -139,60 +134,10 @@ ( master_doc, module_nospace, - "%s Documentation" % project, + f"{project} Documentation", author, module_nospace, module_description, "Miscellaneous", ) ] - - -# -- Options for sphinx-odoo-autodoc extension ---------------------------- - -# 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__))) -) -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__)) -) -# 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")) -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(directory) - else: - c = None - if not c: - if os.path.dirname(directory) != directory: - directory = os.path.dirname(directory) - else: - directory = None - -sphinxodooautodoc_addons_path = [] - -if c: - addon_dirs = set(os.path.dirname(path) for path in c.modules) - - for line in addon_dirs: - sphinxodooautodoc_addons_path.append(os.path.join(directory, line)) -else: - # add this directory top dir - 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(","): - sphinxodooautodoc_addons_path.append(addon_path) diff --git a/doc/index.rst b/doc/index.rst --- a/doc/index.rst +++ b/doc/index.rst @@ -1,8 +1,8 @@ .. |coverage| image:: .badges/coverage.svg - :target: https://orus.io/xcg/odoo-modules/converter/-/pipelines?ref=branch/17.0 + :target: https://orus.io/xcg/odoo-modules/converter/-/pipelines?ref=branch/18.0 :alt: Coverage report .. |pylint| image:: .badges/pylint.svg - :target: https://orus.io/xcg/odoo-modules/converter/-/pipelines?ref=branch/17.0 + :target: https://orus.io/xcg/odoo-modules/converter/-/pipelines?ref=branch/18.0 :alt: pylint score |coverage| |pylint| diff --git a/doc/converter.models.rst b/doc/odoo.addons.converter.models.rst rename from doc/converter.models.rst rename to doc/odoo.addons.converter.models.rst diff --git a/doc/converter.rst b/doc/odoo.addons.converter.rst rename from doc/converter.rst rename to doc/odoo.addons.converter.rst --- a/doc/converter.rst +++ b/doc/odoo.addons.converter.rst @@ -7,8 +7,8 @@ .. toctree:: :maxdepth: 4 - converter.models - converter.tests + odoo.addons.converter.models + odoo.addons.converter.tests Submodules ---------- diff --git a/doc/converter.tests.rst b/doc/odoo.addons.converter.tests.rst rename from doc/converter.tests.rst rename to doc/odoo.addons.converter.tests.rst --- a/doc/converter.tests.rst +++ b/doc/odoo.addons.converter.tests.rst @@ -12,10 +12,10 @@ :undoc-members: :show-inheritance: -odoo.addons.converter.tests.test\_converters module ---------------------------------------------------- +odoo.addons.converter.tests.test\_odoo.addons.converters module +--------------------------------------------------------------- -.. automodule:: odoo.addons.converter.tests.test_converters +.. automodule:: odoo.addons.converter.tests.test_odoo.addons.converters :members: :undoc-members: :show-inheritance: diff --git a/doc/modules.rst b/doc/odoo.addons.modules.rst rename from doc/modules.rst rename to doc/odoo.addons.modules.rst --- a/doc/modules.rst +++ b/doc/odoo.addons.modules.rst @@ -4,4 +4,4 @@ .. toctree:: :maxdepth: 4 - converter + odoo.addons.converter diff --git a/eslint.config.cjs b/eslint.config.cjs new file mode 100644 --- /dev/null +++ b/eslint.config.cjs @@ -0,0 +1,204 @@ +jsdoc = require("eslint-plugin-jsdoc"); + +const config = [ + { + plugins: { + jsdoc, + }, + languageOptions: { + globals: { + _: "readonly", + $: "readonly", + fuzzy: "readonly", + jQuery: "readonly", + moment: "readonly", + odoo: "readonly", + openerp: "readonly", + owl: "readonly", + luxon: "readonly", + }, + ecmaVersion: 2024, + sourceType: "script", + }, + 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", + "jsdoc/check-tag-names": "warn", + "jsdoc/check-types": "warn", + "jsdoc/require-param-description": "off", + "jsdoc/require-return": "off", + "jsdoc/require-return-description": "off", + "jsdoc/require-return-type": "off", + "valid-typeof": "warn", + yoda: "warn", + }, + settings: { + jsdoc: { + tagNamePreference: { + arg: "param", + argument: "param", + augments: "extends", + constructor: "class", + exception: "throws", + func: "function", + method: "function", + prop: "property", + return: "returns", + virtual: "abstract", + yield: "yields", + }, + preferredTypes: { + array: "Array", + bool: "Boolean", + boolean: "Boolean", + number: "Number", + object: "Object", + str: "String", + string: "String", + }, + }, + }, + }, + { + files: ["**/*.esm.js"], + languageOptions: { + ecmaVersion: 2024, + sourceType: "module", + }, + }, +]; + +module.exports = config; diff --git a/i18n/fr.po b/i18n/fr.po --- a/i18n/fr.po +++ b/i18n/fr.po @@ -4,10 +4,10 @@ # Axel Prel <axel.prel@xcg-consulting.fr>, 2024. msgid "" msgstr "" -"Project-Id-Version: Odoo Server 17.0\n" +"Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-08 09:14+0000\n" -"PO-Revision-Date: 2024-10-08 11:16+0200\n" +"PO-Revision-Date: 2024-11-07 09:11+0000\n" "Last-Translator: Axel PREL <axel.prel@xcg-consulting.fr>\n" "Language-Team: XCG Consulting\n" "Language: fr\n" diff --git a/prettier.config.cjs b/prettier.config.cjs new file mode 100644 --- /dev/null +++ b/prettier.config.cjs @@ -0,0 +1,12 @@ +/** @type {import('prettier').Config} */ + +const config = { + bracketSpacing: false, + printWidth: 88, + proseWrap: "always", + semi: true, + trailingComma: "es5", + xmlWhitespaceSensitivity: "ignore", +}; + +module.exports = config; diff --git a/pyproject.toml b/pyproject.toml --- a/pyproject.toml +++ b/pyproject.toml @@ -2,27 +2,27 @@ name = "odoo-addon-converter" dynamic = ["version"] readme = "README.rst" -requires-python = "~=3.10" +requires-python = "~=3.11" license = { file = "LICENSE", name = "GNU Affero General Public License v3" } keywords = ["odoo"] authors = [{ name = "XCG Consulting" }] classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Framework :: Odoo", - "Framework :: Odoo :: 17.0", + "Framework :: Odoo :: 18.0", "License :: OSI Approved :: GNU Affero General Public License v3" ] -dependencies = ["odoo==17.0.*", "fastjsonschema"] +dependencies = ["odoo==18.0.*", "fastjsonschema"] [project.optional-dependencies] -doc = ["sphinx", "sphinx-odoo-autodoc"] +doc = ["sphinx"] test = [] [project.urls] repository = "https://orus.io/xcg/odoo-modules/converter" -changelog = "https://orus.io/xcg/odoo-modules/converter/-/blob/branch/17.0/NEWS.rst" +changelog = "https://orus.io/xcg/odoo-modules/converter/-/blob/branch/18.0/NEWS.rst" [build-system] requires = ["hatchling >=1.19", "hatch-vcs"] @@ -32,11 +32,11 @@ exclude = [ "/doc/", "/.editorconfig", - "/.eslintrc.yml", - ".gitlab-ci.yml", + "/eslint.config.cjs", + "/.gitlab-ci.yml", "/.hgignore", "/.hgtags", - "/.prettierrc.yml", + "/prettier.config.cjs", "/.yamllint.yaml" ]