diff --git a/.eslintrc.yml b/.eslintrc.yml index 88f2881b4c128fc4762338a8f420272c44cc29ef..9429bc688aab4993eae460767368f65089afa323 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,9 +1,16 @@ env: browser: true + es6: true # See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449 parserOptions: - ecmaVersion: 2017 + ecmaVersion: 2019 + +overrides: + - files: + - "**/*.esm.js" + parserOptions: + sourceType: module # Globals available in Odoo that shouldn't produce errorings globals: @@ -14,7 +21,7 @@ globals: moment: readonly odoo: readonly openerp: readonly - Promise: 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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cb8b5ef27a4408c9767c962d0f4e70fb99715061..732d0c4a644eb444d6b4385643ff32fab19fab52 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ exclude: | # Files and folders generated by bots, to avoid loops ^setup/|/static/description/index\.html$| # We don't want to mess with tool-generated files - .svg$|/tests/([^/]+/)?cassettes/| + .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/| # Library files can have extraneous formatting (even minimized) /static/(src/)?lib/| # Repos using Sphinx to generate docs don't need prettying @@ -26,10 +26,12 @@ repos: language: fail files: "\\.rej$" - repo: https://github.com/oca/maintainer-tools - rev: ab1d7f6 + rev: 7d8a9f9ad73db0976fb03cbee43d953bc29b89e9 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.4 hooks: @@ -42,11 +44,11 @@ repos: - --remove-duplicate-keys - --remove-unused-variables - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.1.2 + rev: v2.6.2 hooks: - id: prettier name: prettier (with plugin-xml) @@ -57,7 +59,7 @@ repos: - --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: v7.8.1 + rev: v8.15.0 hooks: - id: eslint verbose: true @@ -65,7 +67,7 @@ repos: - --color - --fix - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v4.2.0 hooks: - id: trailing-whitespace # exclude autogenerated files @@ -87,12 +89,12 @@ repos: - id: mixed-line-ending args: ["--fix=lf"] - repo: https://github.com/asottile/pyupgrade - rev: v2.7.2 + rev: v2.32.1 hooks: - id: pyupgrade args: ["--keep-percent-format"] - repo: https://github.com/PyCQA/isort - rev: 5.5.1 + rev: 5.10.1 hooks: - id: isort name: isort except __init__.py @@ -100,13 +102,13 @@ repos: - --settings=. exclude: /__init__\.py$ - repo: https://gitlab.com/PyCQA/flake8 - rev: 3.8.3 + rev: 3.9.2 hooks: - id: flake8 name: flake8 additional_dependencies: ["flake8-bugbear==20.1.4"] - repo: https://github.com/PyCQA/pylint - rev: pylint-2.5.3 + rev: v2.11.1 hooks: - id: pylint name: pylint with optional checks @@ -115,7 +117,7 @@ repos: - --exit-zero verbose: true additional_dependencies: &pylint_deps - - pylint-odoo==3.5.0 + - pylint-odoo==5.0.5 - id: pylint name: pylint with mandatory checks args: diff --git a/.pylintrc b/.pylintrc index c3d0a5c839baeee21312961c56158de4936fdc91..dc6270e15be0c08da00e768a570f27c785d8630e 100644 --- a/.pylintrc +++ b/.pylintrc @@ -73,7 +73,6 @@ enable=anomalous-backslash-in-string, invalid-commit, missing-manifest-dependency, missing-newline-extrafiles, - # missing-readme, no-utf8-coding-comment, odoo-addons-relative-import, old-api7-method-defined, diff --git a/__manifest__.py b/__manifest__.py index bf04c85b3032c9d7f1c57336f70267977b6dea14..05fed293ca8c2a7f30fbf23752caeb2a29c2cfaa 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -6,6 +6,10 @@ "version": "14.0.1.0.0", "license": "AGPL-3", "depends": ["ap_sale_project", "product_category_tax"], + "data": [ + # views + "views/sale_intervention_view.xml", + ], "installable": True, "auto_install": False, } diff --git a/models/__init__.py b/models/__init__.py index 6e64884a9e8d45458bd4ef2f92bed38c6510dace..7e691b33f4f2a14c9880c0364ad52efe399686bc 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -1,5 +1,6 @@ -# Copyright 2021 Le Filament (https://le-filament.com) +# Copyright 2021-2022 Le Filament (https://le-filament.com) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) +from . import sale_intervention from . import sale_project from . import sale_order diff --git a/models/sale_intervention.py b/models/sale_intervention.py new file mode 100644 index 0000000000000000000000000000000000000000..5a255c6537efe23a747a00274c45158d1544efa6 --- /dev/null +++ b/models/sale_intervention.py @@ -0,0 +1,12 @@ +# Copyright 2022 Le Filament (https://le-filament.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class SaleIntervention(models.Model): + _inherit = "sale.intervention" + + # Specific behavior for AP32, in 90% of cases collarette price should be calculated + # based on length and not quantity + collarette_calc = fields.Boolean(default=True) diff --git a/views/sale_intervention_view.xml b/views/sale_intervention_view.xml new file mode 100644 index 0000000000000000000000000000000000000000..d35c6d424843231852ce7a500c115f2c79708d56 --- /dev/null +++ b/views/sale_intervention_view.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- Copyright 2022 Le Filament + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> +<odoo> + <data> + <record id="sale_intervention_with_coll_option_form" model="ir.ui.view"> + <field name="name">sale.intervention.form</field> + <field name="model">sale.intervention</field> + <field name="inherit_id" ref="ap_sale_project.sale_intervention_form" /> + <field name="arch" type="xml"> + <field name="collarette_qty" position="after"> + <field + name="collarette_calc" + attrs="{'invisible': [('is_collarette', '!=', True), ('intervention_uom_name', '!=', 'm')]}" + /> + </field> + </field> + </record> + </data> +</odoo>