diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6994ef32623bffec84fa06e1bd08ab9fb36dbc91..732d0c4a644eb444d6b4385643ff32fab19fab52 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,8 +6,6 @@ exclude: | ^setup/|/static/description/index\.html$| # We don't want to mess with tool-generated files .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/| - # Maybe reactivate this when all README files include prettier ignore tags? - ^README\.md$| # Library files can have extraneous formatting (even minimized) /static/(src/)?lib/| # Repos using Sphinx to generate docs don't need prettying @@ -28,7 +26,7 @@ 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 @@ -46,12 +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 - additional_dependencies: ["click==8.0.4"] - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.1.2 + rev: v2.6.2 hooks: - id: prettier name: prettier (with plugin-xml) @@ -62,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 @@ -70,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 @@ -92,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 @@ -105,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 @@ -120,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/report/partner_dashboard_dlg.py b/report/partner_dashboard_dlg.py index b030adb321922182b836ae4010485661472b0be4..742436ac018bdd93fd2cad33dc31b0ade9f7881c 100644 --- a/report/partner_dashboard_dlg.py +++ b/report/partner_dashboard_dlg.py @@ -4,11 +4,14 @@ import datetime import json +import logging from psycopg2.extensions import AsIs from odoo import api, fields, models, tools +_logger = logging.getLogger(__name__) + class ScopPartnerDashboardDlg(models.Model): _name = "scop.partner.dashboard.dlg" @@ -19,7 +22,7 @@ class ScopPartnerDashboardDlg(models.Model): # Vue dlg_id = fields.Many2one("res.users", string="Délégué") name = fields.Char() - dash_type = fields.Integer("Type de dashboard") + dash_type = fields.Char("Type de dashboard") nb_prj_info = fields.Integer("Information") nb_prj_pdiag = fields.Integer("Pre-diag") @@ -148,16 +151,20 @@ class ScopPartnerDashboardDlg(models.Model): def _select_coop(self): try: form_scop = self.env.ref("cgscop_partner.form_scop").id - except Exception: + except Exception as e: + _logger.warning(e.__str__()) form_scop = 0 + try: form_scic = self.env.ref("cgscop_partner.form_scic").id - - except Exception: + except Exception as e: + _logger.warning(e.__str__()) form_scic = 0 + try: form_co47 = self.env.ref("cgscop_partner.form_coop47").id - except Exception: + except Exception as e: + _logger.warning(e.__str__()) form_co47 = 0 query = """ @@ -285,6 +292,7 @@ class ScopPartnerDashboardDlg(models.Model): ) AS wRev GROUP BY wrev.id, wrev.dlg_id """ + return query # ------------------------------------------------------ @@ -406,6 +414,7 @@ class ScopPartnerDashboardDlg(models.Model): wrk.dlg_id, wrk.year """ + return query def init(self): @@ -420,8 +429,7 @@ class ScopPartnerDashboardDlg(models.Model): # ------------------------------------------------------ def _compute_graph_values(self): for rec in self: - - if rec.dash_type == 1: + if rec.dash_type == "1": rec.graph_values = json.dumps( [ { @@ -451,7 +459,7 @@ class ScopPartnerDashboardDlg(models.Model): ] ) - if rec.dash_type == 2: + if rec.dash_type == "2": rec.graph_values = json.dumps( [ { @@ -467,7 +475,7 @@ class ScopPartnerDashboardDlg(models.Model): ] ) - if rec.dash_type == 3: + if rec.dash_type == "3": rec.graph_values = json.dumps( [ { @@ -490,7 +498,7 @@ class ScopPartnerDashboardDlg(models.Model): ] ) - if rec.dash_type == 4: + if rec.dash_type == "4": rec.graph_values = json.dumps( [ { diff --git a/report/partner_dashboard_dlg.xml b/report/partner_dashboard_dlg.xml index 1db4fa9e5f50f80204588d895e8069f546cc8e39..76cf132aef7cc4c388b4669d84d1bbbd76cb91cf 100644 --- a/report/partner_dashboard_dlg.xml +++ b/report/partner_dashboard_dlg.xml @@ -32,7 +32,7 @@ <!-- Affiche Dashboard type 1 --> <div class="row" - attrs="{'invisible': [('dash_type', '!=', 1)]}" + attrs="{'invisible': [('dash_type', '!=', '1')]}" > <div class="col-6"> <div class="text-center mb32"> @@ -76,7 +76,7 @@ <!-- Affiche Dashboard type 2 --> <div class="row" - attrs="{'invisible': [('dash_type', '!=', 2)]}" + attrs="{'invisible': [('dash_type', '!=', '2')]}" > <div class="col-6"> <div class="text-center mb32"> @@ -128,7 +128,7 @@ <!-- Affiche Dashboard type 3 --> <div class="row" - attrs="{'invisible': [('dash_type', '!=', 3)]}" + attrs="{'invisible': [('dash_type', '!=', '3')]}" > <div class="col-6"> <div class="text-center mb32"> @@ -170,7 +170,7 @@ <!-- Affiche Dashboard type 4 --> <div class="row" - attrs="{'invisible': [('dash_type', '!=', 4)]}" + attrs="{'invisible': [('dash_type', '!=', '4')]}" > <div class="col-6"> <div class="text-center mb32"> diff --git a/views/res_partner.xml b/views/res_partner.xml index 19eaa17b784f5661a133f1dcfdd66030639db147..85bcd03646595e16a3fc94294e9688cf286d5ab7 100644 --- a/views/res_partner.xml +++ b/views/res_partner.xml @@ -4,19 +4,16 @@ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> <odoo> <data> - <menuitem - id="contacts.menu_contacts" - action="coop_partner_dashboard_ur_act" - /> + <menuitem id="contacts.menu_contacts" action="coop_partner_dashboard_ur_act" /> - <menuitem + <menuitem id="res_partner_menu_dashboard" name="Dashboard" parent="contacts.menu_contacts" sequence="5" /> - <menuitem + <menuitem id="res_partner_menu_dashboard_ur" name="Dashboard union régionale" parent="res_partner_menu_dashboard" @@ -24,7 +21,7 @@ sequence="10" /> - <menuitem + <menuitem id="res_partner_menu_dashboard_dlg" name="Dashboard délégué" parent="res_partner_menu_dashboard"