From 4a0f9eb33e0bf69dcdd46defbcd861f1805fbb0d 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 --- .../__init__.py | 1 - .../__manifest__.py | 1 - .../post_install.py | 24 ------------------- account_banking_sepa_direct_debit/__init__.py | 1 - .../__manifest__.py | 1 - .../post_install.py | 24 ------------------- 6 files changed, 52 deletions(-) delete mode 100644 account_banking_sepa_credit_transfer/post_install.py delete mode 100644 account_banking_sepa_direct_debit/post_install.py diff --git a/account_banking_sepa_credit_transfer/__init__.py b/account_banking_sepa_credit_transfer/__init__.py index e2b93a535..0650744f6 100644 --- a/account_banking_sepa_credit_transfer/__init__.py +++ b/account_banking_sepa_credit_transfer/__init__.py @@ -1,2 +1 @@ from . import models -from .post_install import update_bank_journals diff --git a/account_banking_sepa_credit_transfer/__manifest__.py b/account_banking_sepa_credit_transfer/__manifest__.py index f849519be..bcd9fc3f6 100644 --- a/account_banking_sepa_credit_transfer/__manifest__.py +++ b/account_banking_sepa_credit_transfer/__manifest__.py @@ -14,6 +14,5 @@ "depends": ["account_banking_pain_base"], "data": ["data/account_payment_method.xml"], "demo": ["demo/sepa_credit_transfer_demo.xml"], - "post_init_hook": "update_bank_journals", "installable": True, } diff --git a/account_banking_sepa_credit_transfer/post_install.py b/account_banking_sepa_credit_transfer/post_install.py deleted file mode 100644 index fe9cf853f..000000000 --- a/account_banking_sepa_credit_transfer/post_install.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2016-2020 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")]) - sct = env.ref("account_banking_sepa_credit_transfer.sepa_credit_transfer") - if sct: - journals.write( - { - "outbound_payment_method_line_ids": [ - ( - 0, - 0, - {"payment_method_id": sct.id, "name": "SEPA Direct Credit"}, - ) - ] - } - ) - return 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 e62396ab9..35f3bcd21 100644 --- a/account_banking_sepa_direct_debit/__manifest__.py +++ b/account_banking_sepa_direct_debit/__manifest__.py @@ -32,6 +32,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