From a9a91c0dff30372eca3967e43ed98c9fe3d1dcb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com> Date: Mon, 30 Sep 2024 10:30:56 +0200 Subject: [PATCH] [MIG] version 17.0 --- .eslintrc.yml | 3 +- .gitignore | 11 +++++ .pre-commit-config.yaml | 66 +++++++++++++-------------- .pylintrc | 12 ++--- .pylintrc-mandatory | 12 ++--- .ruff.toml | 30 ++++++++++++ __manifest__.py | 3 +- controllers/main.py | 2 +- datas/export_journal_datas.xml | 2 +- models/account_move_line.py | 2 +- models/export_journal_field.py | 2 +- models/export_journal_type.py | 2 +- views/export_journal_type.xml | 2 +- wizard/__init__.py | 2 - wizard/export_journal_wizard.py | 10 ++-- wizard/export_journal_wizard_view.xml | 2 + 16 files changed, 102 insertions(+), 61 deletions(-) create mode 100644 .ruff.toml diff --git a/.eslintrc.yml b/.eslintrc.yml index 9429bc6..0b38203 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -4,7 +4,7 @@ env: # See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449 parserOptions: - ecmaVersion: 2019 + ecmaVersion: 2022 overrides: - files: @@ -22,6 +22,7 @@ globals: odoo: readonly openerp: readonly owl: readonly + luxon: 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 diff --git a/.gitignore b/.gitignore index 9c283fd..c9f4238 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ __pycache__/ *.py[cod] /.venv /.pytest_cache +/.ruff_cache # C extensions *.so @@ -23,6 +24,16 @@ var/ .installed.cfg *.egg *.eggs +.copier-answers.yml + +# Debian packages +*.deb + +# Redhat packages +*.rpm + +# MacOS packages +*.dmg # Installer logs pip-log.txt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c575299..f58f2c6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,12 @@ exclude: | /static/(src/)?lib/| # Repos using Sphinx to generate docs don't need prettying ^docs/_templates/.*\.html$| + # Don't bother non-technical authors with formatting issues in docs + readme/.*\.(rst|md)$| + # Ignore build and dist directories in addons + /build/|/dist/| + # Ignore test files in addons + /tests/samples/.*| # You don't usually want a bot to modify your legal texts (LICENSE.*|COPYING.*) default_language_version: @@ -31,29 +37,34 @@ repos: name: en.po files cannot exist entry: found a en.po file language: fail - files: '[a-zA-Z0-9_]*/i18n/en\.po$' + files: + '[a-zA-Z0-9_]*/i18n/en\.po$' + # - repo: https://github.com/sbidoul/whool + # rev: v0.5 + # hooks: + # - id: whool-init - repo: https://github.com/oca/maintainer-tools - rev: 4cd2b852214dead80822e93e6749b16f2785b2fe + rev: d5fab7ee87fceee858a3d01048c78a548974d935 hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons - id: oca-fix-manifest-website args: ["https://le-filament.com"] - - repo: https://github.com/myint/autoflake - rev: v1.6.1 - hooks: - - id: autoflake + - id: oca-gen-addon-readme args: - - --expand-star-imports - - --ignore-init-module-imports - - --in-place - - --remove-all-unused-imports - - --remove-duplicate-keys - - --remove-unused-variables - - repo: https://github.com/psf/black - rev: 22.8.0 + - --addons-dir=. + - --branch=17.0 + - --org-name=lefilament + - --repo-name=template_module + - --if-source-changed + - --keep-source-digest + - --convert-fragments-to-markdown + # - id: oca-gen-external-dependencies + - repo: https://github.com/OCA/odoo-pre-commit-hooks + rev: v0.0.25 hooks: - - id: black + - id: oca-checks-odoo-module + - id: oca-checks-po - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.7.1 hooks: @@ -95,27 +106,14 @@ repos: - id: check-xml - id: mixed-line-ending args: ["--fix=lf"] - - repo: https://github.com/asottile/pyupgrade - rev: v2.38.2 - hooks: - - id: pyupgrade - args: ["--keep-percent-format"] - - repo: https://github.com/PyCQA/isort - rev: 5.10.1 - hooks: - - id: isort - name: isort except __init__.py - args: - - --settings=. - exclude: /__init__\.py$ - - repo: https://gitlab.com/PyCQA/flake8 - rev: 3.9.2 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.3 hooks: - - id: flake8 - name: flake8 - additional_dependencies: ["flake8-bugbear==21.9.2"] + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format - repo: https://github.com/OCA/pylint-odoo - rev: 7.0.2 + rev: v9.0.4 hooks: - id: pylint_odoo name: pylint with optional checks diff --git a/.pylintrc b/.pylintrc index 71c476d..4fb9ba5 100644 --- a/.pylintrc +++ b/.pylintrc @@ -5,12 +5,12 @@ load-plugins=pylint_odoo score=n [ODOOLINT] -readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst" -manifest_required_authors=Le Filament -manifest_required_keys=license -manifest_deprecated_keys=description,active -license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3 -valid_odoo_versions=16.0 +readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst" +manifest-required-authors=Le Filament +manifest-required-keys=license +manifest-deprecated-keys=description,active +license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3 +valid-odoo-versions=17.0 [MESSAGES CONTROL] disable=all diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory index ed2c217..42885e9 100644 --- a/.pylintrc-mandatory +++ b/.pylintrc-mandatory @@ -4,12 +4,12 @@ load-plugins=pylint_odoo score=n [ODOOLINT] -readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst" -manifest_required_authors=Le Filament -manifest_required_keys=license -manifest_deprecated_keys=description,active -license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3 -valid_odoo_versions=16.0 +readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst" +manifest-required-authors=Le Filament +manifest-required-keys=license +manifest-deprecated-keys=description,active +license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3 +valid-odoo-versions=17.0 [MESSAGES CONTROL] disable=all diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 0000000..0240c75 --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,30 @@ + +target-version = "py310" +fix = true + +[lint] +extend-select = [ + "B", + "C90", + "E501", # line too long (default 88) + "I", # isort + "UP", # pyupgrade +] +exclude = ["setup/*"] + +[format] +exclude = ["setup/*"] + +[per-file-ignores] +"__init__.py" = ["F401", "I001"] # ignore unused and unsorted imports in __init__.py +"__manifest__.py" = ["B018"] # useless expression + +[isort] +section-order = ["future", "standard-library", "third-party", "odoo", "odoo-addons", "first-party", "local-folder"] + +[isort.sections] +"odoo" = ["odoo"] +"odoo-addons" = ["odoo.addons"] + +[mccabe] +max-complexity = 16 diff --git a/__manifest__.py b/__manifest__.py index 76e418f..18a32aa 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -2,11 +2,10 @@ "name": "Export Journal Tool", "summary": "Export des journaux", "author": "Le Filament", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "license": "AGPL-3", "category": "Accounting/Accounting", "depends": ["account"], - "qweb": [], "data": [ "security/ir.model.access.csv", "datas/export_journal_datas.xml", diff --git a/controllers/main.py b/controllers/main.py index b748ace..949be63 100644 --- a/controllers/main.py +++ b/controllers/main.py @@ -1,4 +1,4 @@ -# Copyright 2020-2022 Le Filament (<https://le-filament.com>) +# Copyright 2020- Le Filament (https://le-filament.com) # License AGPL-3 or later (http://www.gnu.org/licenses/agpl.html). import csv diff --git a/datas/export_journal_datas.xml b/datas/export_journal_datas.xml index db2e489..e69eefe 100644 --- a/datas/export_journal_datas.xml +++ b/datas/export_journal_datas.xml @@ -1,5 +1,5 @@ <?xml version="1.0" ?> -<!-- Copyright 2017-2022 Le Filament (<https://le-filament.com>) +<!-- Copyright 2017- Le Filament (https://le-filament.com) License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> <odoo noupdate="1"> <!-- Journal Type --> diff --git a/models/account_move_line.py b/models/account_move_line.py index eae5eb8..c59d449 100644 --- a/models/account_move_line.py +++ b/models/account_move_line.py @@ -1,4 +1,4 @@ -# Copyright 2020-2022 Le Filament (<https://le-filament.com>) +# Copyright 2020- Le Filament (https://le-filament.com) # License AGPL-3 or later (http://www.gnu.org/licenses/agpl.html). from odoo import fields, models diff --git a/models/export_journal_field.py b/models/export_journal_field.py index 652f408..151cadc 100644 --- a/models/export_journal_field.py +++ b/models/export_journal_field.py @@ -1,4 +1,4 @@ -# Copyright 2020-2022 Le Filament (<https://le-filament.com>) +# Copyright 2020- Le Filament (https://le-filament.com) # License AGPL-3 or later (http://www.gnu.org/licenses/agpl.html). from odoo import fields, models diff --git a/models/export_journal_type.py b/models/export_journal_type.py index 6f2d9a2..b8a33ce 100644 --- a/models/export_journal_type.py +++ b/models/export_journal_type.py @@ -1,4 +1,4 @@ -# Copyright 2020-2022 Le Filament (<https://le-filament.com>) +# Copyright 2020- Le Filament (https://le-filament.com) # License AGPL-3 or later (http://www.gnu.org/licenses/agpl.html). from odoo import fields, models diff --git a/views/export_journal_type.xml b/views/export_journal_type.xml index 0ee90a4..9029451 100644 --- a/views/export_journal_type.xml +++ b/views/export_journal_type.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright 2020-2022 Le Filament (<https://le-filament.com>) +<!-- Copyright 2020- Le Filament (https://le-filament.com) License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> <odoo> <record id="export_journal_type_form_view" model="ir.ui.view"> diff --git a/wizard/__init__.py b/wizard/__init__.py index 3a8abbb..5273fab 100644 --- a/wizard/__init__.py +++ b/wizard/__init__.py @@ -1,3 +1 @@ -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - from . import export_journal_wizard diff --git a/wizard/export_journal_wizard.py b/wizard/export_journal_wizard.py index 0b8ae04..926ab47 100644 --- a/wizard/export_journal_wizard.py +++ b/wizard/export_journal_wizard.py @@ -1,4 +1,4 @@ -# Copyright 2020 Le Filament (<http://www.le-filament.com>) +# Copyright 2020- Le Filament (https://le-filament.com) # License AGPL-3 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models @@ -48,8 +48,10 @@ class ExportJournalWizard(models.TransientModel): """ return { "type": "ir.actions.act_url", - "url": "/web/export_journal?export_format=%s&export=%s&export_type=%s" - % (self.export_format, self.export_id.id, self.export_type) - + "&date_start=%s&date_end=%s" % (self.date_start, self.date_end), + "url": f"/web/export_journal?export_format={self.export_format}" + + f"&export={self.export_id.id}" + + f"&export_type={self.export_type}" + + f"&date_start={self.date_start}" + + f"&date_end={self.date_end}", "target": "new", } diff --git a/wizard/export_journal_wizard_view.xml b/wizard/export_journal_wizard_view.xml index 11cf2b5..27613a7 100644 --- a/wizard/export_journal_wizard_view.xml +++ b/wizard/export_journal_wizard_view.xml @@ -1,4 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> +<!-- Copyright 2020- Le Filament (https://le-filament.com) + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> <odoo> <record id="data_export_view_form" model="ir.ui.view"> <field name="name">invoice.line.export.form</field> -- GitLab