diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3efb4d9157dc36d84e372eec5fc21e7f4a417a58..4acca684ec8c5cda7b3ecd21b9e568ab03d57e8c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,15 +12,11 @@ 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/| # You don't usually want a bot to modify your legal texts (LICENSE.*|COPYING.*) default_language_version: python: python3 - node: "16.17.0" + node: "14.13.0" repos: - repo: local hooks: @@ -37,38 +33,40 @@ repos: language: fail files: '[a-zA-Z0-9_]*/i18n/en\.po$' - repo: https://github.com/oca/maintainer-tools - rev: f71041f22b8cd68cf7c77b73a14ca8d8cd190a60 + rev: ab1d7f6 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"] - - id: oca-gen-addon-readme + - repo: https://github.com/myint/autoflake + rev: v1.4 + hooks: + - id: autoflake args: - - --addons-dir=. - - --branch=16.0 - - --org-name=lefilament - - --repo-name=template_module - - --if-source-changed - - --keep-source-digest - - repo: https://github.com/OCA/odoo-pre-commit-hooks - rev: v0.0.25 + - --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.3.0 hooks: - - id: oca-checks-odoo-module - - id: oca-checks-po + - id: black - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.7.1 + rev: v2.1.2 hooks: - id: prettier name: prettier (with plugin-xml) additional_dependencies: - - "prettier@2.7.1" - - "@prettier/plugin-xml@2.2.0" + - "prettier@2.1.2" + - "@prettier/plugin-xml@0.12.0" args: - --plugin=@prettier/plugin-xml files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.24.0 + rev: v7.8.1 hooks: - id: eslint verbose: true @@ -76,7 +74,7 @@ repos: - --color - --fix - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v3.2.0 hooks: - id: trailing-whitespace # exclude autogenerated files @@ -97,14 +95,27 @@ repos: - id: check-xml - id: mixed-line-ending args: ["--fix=lf"] - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.3 + - repo: https://github.com/asottile/pyupgrade + rev: v2.7.2 + hooks: + - id: pyupgrade + args: ["--keep-percent-format"] + - repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort + name: isort except __init__.py + args: + - --settings=. + exclude: /__init__\.py$ + - repo: https://github.com/PyCQA/flake8 + rev: 3.8.3 hooks: - - id: ruff - args: [--fix, --exit-non-zero-on-fix] - - id: ruff-format + - id: flake8 + name: flake8 + additional_dependencies: ["flake8-bugbear==20.1.4"] - repo: https://github.com/OCA/pylint-odoo - rev: v8.0.19 + rev: 7.0.2 hooks: - id: pylint_odoo name: pylint with optional checks diff --git a/models/__init__.py b/models/__init__.py index 7f85e14a61f2d97e84a021bbdd170a2ee341f8d9..c9f67d1029451187faac73b30248b565bd1340d9 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -1,4 +1 @@ -# Copyright 2023 Le Filament (https://le-filament.com) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) - from . import acc_operation diff --git a/models/acc_operation.py b/models/acc_operation.py index b9396c5308835289c2539cd8b798904d10e6af75..555bc91a16ba110626ff9ffa6d5b02bbcf27f465 100644 --- a/models/acc_operation.py +++ b/models/acc_operation.py @@ -4,8 +4,7 @@ from datetime import datetime from dateutil.relativedelta import relativedelta - -from odoo import _, fields, models +from odoo import _, models from odoo.exceptions import ValidationError from odoo.tools import date_utils @@ -149,7 +148,7 @@ class AccOperation(models.Model): date_end = last_day_end # month by default else: - date_start = date_utils.start_of(end_month, "month") + date_start = date_utils.start_of(end_month, "month") date_end = end_month return date_start, date_end