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/models/account_move.py b/models/account_move.py index 7c57efa9e66b831792ed992e15e597f6c7fc2872..80e7a5df2bed12321fab085d2d1cc54b9bc0b17b 100644 --- a/models/account_move.py +++ b/models/account_move.py @@ -23,10 +23,7 @@ class ScopAccountMove(models.Model): if res.get("is_contribution"): res["journal_id"] = self.env.company.contribution_journal_id.id else: - if ( - res.get("journal_id") - == self.env.company.contribution_journal_id.id - ): + if res.get("journal_id") == self.env.company.contribution_journal_id.id: res["is_contribution"] = True return res diff --git a/models/account_payment_order.py b/models/account_payment_order.py index e0879193ed7cae446dd134310ee0dfbea92ddb66..5ba2fdcf23950b67445669a1f36b9a5d73219dda 100644 --- a/models/account_payment_order.py +++ b/models/account_payment_order.py @@ -17,7 +17,9 @@ class AccountPaymentOrder(models.Model): attachment_ids = fields.One2many( comodel_name="ir.attachment", compute="_compute_attachment_ids" ) - mandate_validity = fields.Boolean("Mandats valides", compute="_compute_mandate_validity") + mandate_validity = fields.Boolean( + "Mandats valides", compute="_compute_mandate_validity" + ) # ------------------------------------------------------ # Compute fields @@ -43,7 +45,8 @@ class AccountPaymentOrder(models.Model): def _compute_mandate_validity(self): for o in self: validity = o.mapped("payment_line_ids.mandate_id").filtered( - lambda m: m.state != "valid") + lambda m: m.state != "valid" + ) if validity: o.mandate_validity = False else: @@ -81,25 +84,27 @@ class AccountPaymentOrder(models.Model): def view_wrong_iban(self): self.ensure_one() bank_ids = self.mapped("payment_line_ids.partner_bank_id").filtered( - lambda b: b.acc_type != 'iban') + lambda b: b.acc_type != "iban" + ) return { - 'type': 'ir.actions.act_window', - 'name': "Comptes bancaires", - 'res_model': 'res.partner.bank', - 'views': [[False, 'tree'], [False, 'form']], - 'domain': [['id', 'in', bank_ids.ids]], + "type": "ir.actions.act_window", + "name": "Comptes bancaires", + "res_model": "res.partner.bank", + "views": [[False, "tree"], [False, "form"]], + "domain": [["id", "in", bank_ids.ids]], } def view_wrong_mandate(self): self.ensure_one() mandate_ids = self.mapped("payment_line_ids.mandate_id").filtered( - lambda m: m.state != "valid") + lambda m: m.state != "valid" + ) return { - 'type': 'ir.actions.act_window', - 'name': "Mandats non valides", - 'res_model': 'account.banking.mandate', - 'views': [[False, 'tree'], [False, 'form']], - 'domain': [['id', 'in', mandate_ids.ids]], + "type": "ir.actions.act_window", + "name": "Mandats non valides", + "res_model": "account.banking.mandate", + "views": [[False, "tree"], [False, "form"]], + "domain": [["id", "in", mandate_ids.ids]], } # ------------------------------------------------------ @@ -131,3 +136,9 @@ class AccountPaymentOrder(models.Model): def open2generated(self): self.check_sepa_order() return super(AccountPaymentOrder, self).open2generated() + + def _prepare_move(self, bank_lines=None): + res = super()._prepare_move(bank_lines=bank_lines) + res["commercial_partner_id"] = bank_lines[0].partner_id.id + res["partner_id"] = bank_lines[0].partner_id.id + return res diff --git a/report/scop_contribution_report.py b/report/scop_contribution_report.py index bea7834f272ed882a670d524286ca71a639a33d7..7cbfcc5ad78ed5ed5547537333bc25f10ef8cdac 100644 --- a/report/scop_contribution_report.py +++ b/report/scop_contribution_report.py @@ -226,11 +226,7 @@ class ScopContributionReport(models.Model): def get_invoice_contribution(self): invoice_ids = ( - self.env["account.move"] - .sudo() - .search( - self._get_contribution_domain() - ) + self.env["account.move"].sudo().search(self._get_contribution_domain()) ) return invoice_ids diff --git a/views/account_move.xml b/views/account_move.xml index 8cff55479590f3ee4a4fb2186d8a9563aa2a587d..56f133297d5d11b953578aa53bdcae57987224aa 100644 --- a/views/account_move.xml +++ b/views/account_move.xml @@ -233,7 +233,7 @@ <field name="journal_id" /> <field name="amount_total" sum="Total Amount" /> <field name="reversed_entry_id" /> - <field name="reversal_move_id" widget="many2many_tags"/> + <field name="reversal_move_id" widget="many2many_tags" /> <field name="payment_reference" optional="hide" /> <button name="%(account.action_view_account_move_reversal)d" @@ -246,8 +246,22 @@ '&', ('reversal_move_id', '!=', []), ('reversed_entry_id', '=', False), ]}" /> - <field name="state" widget="badge" decoration-success="state == 'posted'" decoration-info="state == 'draft'" optional="show"/> - <field name="payment_state" widget="badge" decoration-danger="payment_state == 'not_paid'" decoration-warning="payment_state in ('partial', 'in_payment')" decoration-success="payment_state in ('paid', 'reversed')" attrs="{'invisible': [('payment_state', 'in', ('invoicing_legacy'))]}" optional="hide" /> + <field + name="state" + widget="badge" + decoration-success="state == 'posted'" + decoration-info="state == 'draft'" + optional="show" + /> + <field + name="payment_state" + widget="badge" + decoration-danger="payment_state == 'not_paid'" + decoration-warning="payment_state in ('partial', 'in_payment')" + decoration-success="payment_state in ('paid', 'reversed')" + attrs="{'invisible': [('payment_state', 'in', ('invoicing_legacy'))]}" + optional="hide" + /> <field name="partner_id" optional="hide" /> <field name="currency_id" invisible="1" /> </tree> diff --git a/wizard/account_payment_line_create.py b/wizard/account_payment_line_create.py index 733a92946cedc31210c6252068847bed2b44aad4..4f6398885fc0659e1a6b8154519e02f0480ead89 100644 --- a/wizard/account_payment_line_create.py +++ b/wizard/account_payment_line_create.py @@ -5,13 +5,10 @@ from odoo import fields, models class AccountPaymentLineCreate(models.TransientModel): - _inherit = 'account.payment.line.create' + _inherit = "account.payment.line.create" start_date = fields.Date(string="Date Mini") - ur_ids = fields.Many2many( - comodel_name="union.regionale", - string="Union Régionale" - ) + ur_ids = fields.Many2many(comodel_name="union.regionale", string="Union Régionale") def _prepare_move_line_domain(self): self.ensure_one()