diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8a5999af4419f630dda23d9366b51967b8322ed3..732d0c4a644eb444d6b4385643ff32fab19fab52 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,10 +6,8 @@ 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/| + /static/(src/)?lib/| # Repos using Sphinx to generate docs don't need prettying ^docs/_templates/.*\.html$| # You don't usually want a bot to modify your legal texts @@ -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,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) @@ -61,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 @@ -69,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 @@ -91,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 @@ -104,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 @@ -119,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/controllers/main.py b/controllers/main.py index 73666b7da0ef0231c71c6ad31731f9cd42a38e6b..dd0aed478087a3122b18814da9fd2b9fcd509c81 100644 --- a/controllers/main.py +++ b/controllers/main.py @@ -51,16 +51,10 @@ class ExportJournalCg(http.Controller): # Journaux des UR et Fédé # TODO: vérifier l'export des comptes de banque en sortie pour UR et Fédé - journal_fede_com_id = company_id.journal_fede_com_id - journal_fede_cae_id = company_id.journal_fede_cae_id - journal_ur_hdf_id = company_id.journal_ur_hdf_id - journal_ur_med_id = company_id.journal_ur_med_id - journal_ids = [ - journal_fede_com_id.id, - journal_fede_cae_id.id, - journal_ur_hdf_id.id, - journal_ur_med_id.id, - ] + # journal_fede_com_id = company_id.journal_fede_com_id + # journal_fede_cae_id = company_id.journal_fede_cae_id + # journal_ur_hdf_id = company_id.journal_ur_hdf_id + # journal_ur_med_id = company_id.journal_ur_med_id product_adhesion_id = company_id.product_adhesion_id journal_adhesion_id = company_id.journal_adhesion_id @@ -181,7 +175,7 @@ class ExportJournalCg(http.Controller): else: journal = "EF" if line.account_id == default_receivable_account_id: - account = ("4112" + line.partner_id.ur_id.code_ur) + account = "4112" + line.partner_id.ur_id.code_ur adh_account = self._get_partner_number(line.partner_id) else: account = line.account_id.code @@ -222,7 +216,8 @@ class ExportJournalCg(http.Controller): ): # Sanitize N° Bordereau reconciled_inv_ids = line.full_reconcile_id.reconciled_line_ids.mapped( - "move_id").filtered(lambda i: i.is_contribution) + "move_id" + ).filtered(lambda i: i.is_contribution) if line.move_id.bordereau_id.name: inv_num = line.move_id.bordereau_id.name elif reconciled_inv_ids: diff --git a/models/scop_bordereau_cg.py b/models/scop_bordereau_cg.py index fbe8ec40734eefb30cbe6d93326cbcbf0f406016..d69707b8d283c7001b5f125d84b1c2cf15e9ede5 100644 --- a/models/scop_bordereau_cg.py +++ b/models/scop_bordereau_cg.py @@ -372,8 +372,11 @@ class Bordereau(models.Model): ) detail = "<table class='o_group o_inner_group'>" for contrib in contribs: - amount_cg = str("{:,.2f}".format( - contrib.get("amount_total_signed"))).replace(",", " ").replace(".", ",") + amount_cg = ( + str("{:,.2f}".format(contrib.get("amount_total_signed"))) + .replace(",", " ") + .replace(".", ",") + ) detail += ( "<tr><td class='o_td_label font-weight-bold'>{}</td>" "<td style='width: 100%;'>{} €" @@ -390,8 +393,11 @@ class Bordereau(models.Model): ), 2, ) - str_amount = str( - "{:,.2f}".format(amount_echeance)).replace(",", " ").replace(".", ",") + str_amount = ( + str("{:,.2f}".format(amount_echeance)) + .replace(",", " ") + .replace(".", ",") + ) detail += ( "<tr><td class='o_td_label font-weight-bold'>Trimestre {}</td>" "<td style='width: 100%;'>{} €" @@ -556,7 +562,9 @@ class Bordereau(models.Model): """ :return: Ouvre la vue des cotisations liées au bordereau """ - tree_view_id = self.env.ref("cgscop_cotisation.account_move_tree_scop_inherited").id + tree_view_id = self.env.ref( + "cgscop_cotisation.account_move_tree_scop_inherited" + ).id form_view_id = self.env.ref( "cgscop_cotisation_cg.invoice_form_scop_cg_inherited" ).id diff --git a/models/scop_cotisation_cg.py b/models/scop_cotisation_cg.py index a1990201acbe8155859208ff92a445c45a1a7d45..84ddfebe8e12b05719cebd6f3ef3bf552a5b71e9 100644 --- a/models/scop_cotisation_cg.py +++ b/models/scop_cotisation_cg.py @@ -763,13 +763,14 @@ class ScopCotisation(models.Model): if last_liasse.year > 0: # Filtre les liasses de la dernière année disponible last_liasse_all = liasse_ids.filtered( - lambda l: l.year == last_liasse.year) + lambda l: l.year == last_liasse.year + ) # Si une seule liasse de cette année => on retourne cette liasse if len(last_liasse_all) == 1: return last_liasse # Priorité ensuite sur les liasses type LM - elif last_liasse_all.filtered(lambda l: l.type_id == 'lm'): - return last_liasse_all.filtered(lambda l: l.type_id == 'lm')[0] + elif last_liasse_all.filtered(lambda l: l.type_id == "lm"): + return last_liasse_all.filtered(lambda l: l.type_id == "lm")[0] else: return last_liasse # Sinon on retourne la première liasse diff --git a/views/scop_bordereau_cg.xml b/views/scop_bordereau_cg.xml index 395b546ee8cc971b00a2544a312973f9cbd07d95..366c5dc2b65913c708504d14098bee80a6c43619 100644 --- a/views/scop_bordereau_cg.xml +++ b/views/scop_bordereau_cg.xml @@ -190,10 +190,7 @@ name="date_cotisation" attrs="{'readonly':[('state','!=','new')]}" /> - <field - name="payment_mode_id" - readonly="1" - /> + <field name="payment_mode_id" readonly="1" /> <hr /> <field name="nb_quarter" @@ -280,7 +277,12 @@ string="Montant dû" sum="Total" /> - <field name="state" widget="badge" decoration-success="state == 'posted'" decoration-info="state == 'draft'" /> + <field + name="state" + widget="badge" + decoration-success="state == 'posted'" + decoration-info="state == 'draft'" + /> <field name="payment_state" widget="badge" diff --git a/wizard/scop_bordereau_refund_wizard.py b/wizard/scop_bordereau_refund_wizard.py index 1fbd0fbd790104460f3a29d99fd940c07ffa94a4..4dbd2dd844f474eccc92218b3231ecd0e0d3a786 100644 --- a/wizard/scop_bordereau_refund_wizard.py +++ b/wizard/scop_bordereau_refund_wizard.py @@ -176,7 +176,9 @@ class ScopBordereauRefundWizard(models.TransientModel): for quarter_id in self.quarter_ids: date_due = self.bordereau_id.invoice_ids.filtered( - lambda i: i.cotiz_quarter == str(quarter_id.quarter) and i.move_type == "out_invoice")[0].invoice_date_due + lambda i: i.cotiz_quarter == str(quarter_id.quarter) + and i.move_type == "out_invoice" + )[0].invoice_date_due self.env["account.move"].create( { "partner_id": partner_id.id, diff --git a/wizard/scop_cotisation_cg_wizard.py b/wizard/scop_cotisation_cg_wizard.py index ad9a77002c6e45335f30b01fd221571cfa34287c..c49c7451e6943e3d7169b56680a4b95a350c4867 100644 --- a/wizard/scop_cotisation_cg_wizard.py +++ b/wizard/scop_cotisation_cg_wizard.py @@ -18,8 +18,11 @@ class ScopCotisationWizard(models.TransientModel): @api.model def _default_year(self): - return self.env["scop.cotisation.cg"].browse( - self.env.context.get("active_id")).year + return ( + self.env["scop.cotisation.cg"] + .browse(self.env.context.get("active_id")) + .year + ) year = fields.Char(string="Année", required=True, default=_default_year) cotisation_cg_id = fields.Many2one( @@ -52,7 +55,7 @@ class ScopCotisationWizard(models.TransientModel): @api.onchange("type", "date_start", "date_limit") def onchange_domain_partner_ids(self): if self.type == "selected": - invoiced_members = self.cotisation_cg_id.bordereau_ids.mapped('partner_id') + invoiced_members = self.cotisation_cg_id.bordereau_ids.mapped("partner_id") domain = [ ("is_cooperative", "=", True), ("type", "!=", "facility"), @@ -63,11 +66,7 @@ class ScopCotisationWizard(models.TransientModel): if self.date_start: domain.append(("member_start", ">=", self.date_start)) - res = { - "domain": { - "partner_ids": domain - } - } + res = {"domain": {"partner_ids": domain}} return res # ------------------------------------------------------