# HG changeset patch # User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr> # Date 1680163056 -7200 # Thu Mar 30 09:57:36 2023 +0200 # Branch 16.0 # Node ID 99a6559b5971377bac61dadc359457ce7a71a612 # Parent 76b180030261f0b742ce5bc4841c8eab88c01f19 🎉 Migration to odoo 16 diff --git a/.editorconfig b/.editorconfig --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,5 @@ # Configuration for known file extensions -[*.{css,js,json,less,md,py,rst,sass,scss,xml,yaml,yml}] +[*.{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 @@ -7,11 +7,11 @@ insert_final_newline = true trim_trailing_whitespace = true -[*.{json,yml,yaml,rst,md}] +[*.{json,yml,yaml,rst,markdown,md,toml}] indent_size = 2 -# Do not configure editor for libs and autogenerated content -[{*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst}] +# Do not configure editor for libs +[*/static/{lib,src/lib}/**] charset = unset end_of_line = unset indent_size = unset 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/.hgconf b/.hgconf deleted file mode 100644 --- a/.hgconf +++ /dev/null @@ -1,4 +0,0 @@ -[base_context] -pulluri = https://orus.io/xcg/odoo-modules/base_context -layout = ../base_context -track = 15.0.1.0.0 diff --git a/NEWS.rst b/NEWS.rst --- a/NEWS.rst +++ b/NEWS.rst @@ -1,12 +1,7 @@ Changelog ========= -15.0.1.0.1 +16.0.1.0.0 ---------- -Pylint fix. - -15.0.1.0.0 ----------- - -Port to Odoo 15 from 13.0.3.0.0. +Migration. diff --git a/README.rst b/README.rst --- a/README.rst +++ b/README.rst @@ -2,18 +2,16 @@ Xbus Emitter for Odoo ===================== -.. Update the path to the module bellow and to the branch .. |coverage| image:: .badges/coverage.svg - :target: https://orus.io/xcg/odoo-modules/xbus_emitter/-/pipelines?ref=branch/15.0 + :target: https://orus.io/xcg/odoo-modules/xbus_emitter/-/pipelines?ref=branch/16.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/xbus_emitter/-/pipelines?ref=branch/15.0 + :target: https://orus.io/xcg/odoo-modules/xbus_emitter/-/pipelines?ref=branch/16.0 :alt: pylint score -.. Update the badge bellow depending on status .. |maturity| image:: .badges/maturity.svg :target: https://odoo-community.org/page/development-status - :alt: Alpha + :alt: Beta .. |license| image:: .badges/licence-AGPL--3-blue.svg :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 diff --git a/__init__.py b/__init__.py --- a/__init__.py +++ b/__init__.py @@ -1,1 +1,1 @@ -from . import models # noqa: F401 +from . import models diff --git a/__manifest__.py b/__manifest__.py --- a/__manifest__.py +++ b/__manifest__.py @@ -21,10 +21,10 @@ "name": "Xbus Emitter", "license": "AGPL-3", "summary": "Emit messages from Odoo to Xbus", - "version": "15.0.1.0.1", + "version": "16.0.1.0.0", "category": "Technical", "author": "XCG Consulting", - "website": "https://odoo.consulting/", + "website": "https://orbeet.io/", "depends": ["base", "web", "base_context"], "data": [ "security/ir.model.access.csv", diff --git a/models/__init__.py b/models/__init__.py --- a/models/__init__.py +++ b/models/__init__.py @@ -1,1 +1,1 @@ -from . import ir_autovacuum, xbus_emitter, xbus_emitter_job # noqa: F401 +from . import ir_autovacuum, xbus_emitter, xbus_emitter_job diff --git a/pyproject.toml b/pyproject.toml --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,46 @@ +[project] +name = "odoo-addon-xbus_emitter" +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.*", "odoo-addon-base_context >=16.0.1.0.0,<16.0.2"] + +[project.optional-dependencies] +doc = ["sphinx", "sphinx-odoo-autodoc"] +test = ["mock"] + +[project.urls] +repository = "https://orus.io/xcg/odoo-modules/xbus_emitter" +changelog = "https://orus.io/xcg/odoo-modules/xbus_emitter/-/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.xbus_emitter" = "." } + +[tool.setuptools.package-data] +"*" = ["*"] + +[tool.setuptools_scm] + +[tool.black] +target = 3.10 + [tool.isort] -py_version = 39 +py_version = 310 profile = "black" known_odoo = ['odoo'] known_odoo_addons = ['odoo.addons'] @@ -12,6 +53,3 @@ 'FIRSTPARTY', 'LOCALFOLDER' ] - -[tool.black] -target = 3.9 diff --git a/static/src/js/debug_manager_xbus.js b/static/src/js/debug_manager_xbus.js --- a/static/src/js/debug_manager_xbus.js +++ b/static/src/js/debug_manager_xbus.js @@ -1,6 +1,6 @@ /* Xbus emitter for Odoo -Copyright (C) 2020 XCG Consulting <http://odoo.consulting> +Copyright (C) 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 diff --git a/tests/__init__.py b/tests/__init__.py --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,1 +1,1 @@ -from . import test_export, test_xbus_emitter, test_xbus_emitter_job # noqa: F401 +from . import test_export, test_xbus_emitter, test_xbus_emitter_job diff --git a/tests/test_export.py b/tests/test_export.py --- a/tests/test_export.py +++ b/tests/test_export.py @@ -52,10 +52,14 @@ def test_export_float_field(self): record = self.env["res.partner"].create({"name": "my name"}) - self.assertEqual({"credit_limit": 0.0}, export(record, {"credit_limit": {}})) - record.credit_limit = 4.5 + self.assertEqual( + {"partner_latitude": 0.0}, export(record, {"partner_latitude": {}}) + ) + record.partner_latitude = 48.86830 - self.assertEqual({"credit_limit": 4.5}, export(record, {"credit_limit": {}})) + self.assertEqual( + {"partner_latitude": 48.86830}, export(record, {"partner_latitude": {}}) + ) def test_export_selection_field(self): record = self.env["res.partner"].create({"name": "my name"}) diff --git a/tests/test_xbus_emitter.py b/tests/test_xbus_emitter.py --- a/tests/test_xbus_emitter.py +++ b/tests/test_xbus_emitter.py @@ -1,7 +1,7 @@ ############################################################################## # # Xbus emitter for Odoo -# Copyright (C) 2015, 2022 XCG Consulting <https://xcg-consulting.fr/> +# Copyright (C) 2015, 2022, 2023 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 @@ -18,7 +18,7 @@ # ############################################################################## -import mock # Odoo req. +import mock from odoo.tests import TransactionCase diff --git a/tests/test_xbus_emitter_job.py b/tests/test_xbus_emitter_job.py --- a/tests/test_xbus_emitter_job.py +++ b/tests/test_xbus_emitter_job.py @@ -1,7 +1,7 @@ ############################################################################## # # Xbus emitter for Odoo -# Copyright (C) 2015 XCG Consulting <http://odoo.consulting> +# Copyright (C) 2015 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