From 90c280c0b09a9cd5957e78c9259645fd2f68dc77 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 9 Feb 2023 09:33:00 +0100 Subject: [PATCH] [FIX] account_banking_sepa_*: Remove post-installs From this version, Odoo already includes code on the account.payment.method creation for adding such method to each journal: https://github.com/odoo/odoo/blob/a93ed75cb80f16f/addons/account/models/account_payment_method.py#L24-L38 so we don't need to explicitly create them for the new payment methods we are adding in these modules. TT41146 --- account_banking_sepa_direct_debit/__init__.py | 1 - .../__manifest__.py | 1 - .../post_install.py | 24 ------------------- 3 files changed, 26 deletions(-) delete mode 100644 account_banking_sepa_direct_debit/post_install.py diff --git a/account_banking_sepa_direct_debit/__init__.py b/account_banking_sepa_direct_debit/__init__.py index ec29ab8d6..aee8895e7 100644 --- a/account_banking_sepa_direct_debit/__init__.py +++ b/account_banking_sepa_direct_debit/__init__.py @@ -1,3 +1,2 @@ from . import models from . import wizards -from .post_install import update_bank_journals diff --git a/account_banking_sepa_direct_debit/__manifest__.py b/account_banking_sepa_direct_debit/__manifest__.py index ca7aede18..3733272de 100644 --- a/account_banking_sepa_direct_debit/__manifest__.py +++ b/account_banking_sepa_direct_debit/__manifest__.py @@ -33,6 +33,5 @@ "views/report_sepa_direct_debit_mandate.xml", ], "demo": ["demo/sepa_direct_debit_demo.xml"], - "post_init_hook": "update_bank_journals", "installable": True, } diff --git a/account_banking_sepa_direct_debit/post_install.py b/account_banking_sepa_direct_debit/post_install.py deleted file mode 100644 index 663c0cabd..000000000 --- a/account_banking_sepa_direct_debit/post_install.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2016 Akretion (Alexis de Lattre ) -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from odoo import SUPERUSER_ID, api - - -def update_bank_journals(cr, registry): - env = api.Environment(cr, SUPERUSER_ID, {}) - ajo = env["account.journal"] - journals = ajo.search([("type", "=", "bank")]) - sdd = env.ref("account_banking_sepa_direct_debit.sepa_direct_debit") - if sdd: - journals.write( - { - "inbound_payment_method_line_ids": [ - ( - 0, - 0, - {"payment_method_id": sdd.id, "name": "SEPA Direct Debit"}, - ) - ] - } - ) - return