From d6c7651fd8ce9c33fe460347fc17109a34cd20d4 Mon Sep 17 00:00:00 2001 From: manu Date: Fri, 8 Apr 2022 13:34:25 +0200 Subject: [PATCH] [MIG]account_banking_sepa_direct_debit: Migration to 15.0 [UPD] Update account_banking_sepa_direct_debit.pot [UPD] README.rst --- account_banking_sepa_direct_debit/README.rst | 11 +-- .../__manifest__.py | 12 ++- .../demo/sepa_direct_debit_demo.xml | 84 ++++++++----------- .../account_banking_sepa_direct_debit.pot | 35 +------- .../models/account_banking_mandate.py | 6 +- .../models/account_payment_method.py | 8 +- .../models/account_payment_order.py | 5 +- .../post_install.py | 12 ++- .../readme/CONTRIBUTORS.rst | 1 + .../reports/sepa_direct_debit_mandate.xml | 12 --- .../static/description/index.html | 7 +- .../tests/test_sdd.py | 22 +++-- 12 files changed, 98 insertions(+), 117 deletions(-) diff --git a/account_banking_sepa_direct_debit/README.rst b/account_banking_sepa_direct_debit/README.rst index 2d25e20e5..c2cbcc8f7 100644 --- a/account_banking_sepa_direct_debit/README.rst +++ b/account_banking_sepa_direct_debit/README.rst @@ -14,13 +14,13 @@ Account Banking SEPA Direct Debit :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github - :target: https://github.com/OCA/bank-payment/tree/14.0/account_banking_sepa_direct_debit + :target: https://github.com/OCA/bank-payment/tree/15.0/account_banking_sepa_direct_debit :alt: OCA/bank-payment .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/bank-payment-14-0/bank-payment-14-0-account_banking_sepa_direct_debit + :target: https://translation.odoo-community.org/projects/bank-payment-15-0/bank-payment-15-0-account_banking_sepa_direct_debit :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/173/14.0 + :target: https://runbot.odoo-community.org/runbot/173/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -98,7 +98,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -126,6 +126,7 @@ Contributors * Pedro M. Baeza * Sergio Teruel * Carlos Roca +* Manuel Regidor Maintainers ~~~~~~~~~~~ @@ -140,6 +141,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/bank-payment `_ project on GitHub. +This module is part of the `OCA/bank-payment `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_banking_sepa_direct_debit/__manifest__.py b/account_banking_sepa_direct_debit/__manifest__.py index 93758e4aa..20480430b 100644 --- a/account_banking_sepa_direct_debit/__manifest__.py +++ b/account_banking_sepa_direct_debit/__manifest__.py @@ -5,12 +5,22 @@ { "name": "Account Banking SEPA Direct Debit", "summary": "Create SEPA files for Direct Debit", - "version": "14.0.1.3.1", + "version": "15.0.1.0.0", "license": "AGPL-3", "author": "Akretion, " "Tecnativa, " "Odoo Community Association (OCA)", "website": "https://github.com/OCA/bank-payment", "category": "Banking addons", "depends": ["account_banking_pain_base", "account_banking_mandate"], + "external_dependencies": { + "python": [ + "stdnum", + ], + }, + "assets": { + "web.assets_backend": [ + "/account_banking_sepa_direct_debit/static/src/css/report.css" + ], + }, "data": [ "views/account_banking_mandate_view.xml", "views/res_config_settings.xml", diff --git a/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml b/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml index c22f68416..ec5469e0f 100644 --- a/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml +++ b/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml @@ -1,51 +1,37 @@ - - - - SEPA Direct Debit of customers - - variable - - - - - FR78ZZZ424242 - - - - - sepa - recurrent - first - - valid - - - - - - - - sepa - recurrent - first - - valid - - - - - + + + SEPA Direct Debit of customers + + variable + + + + + FR78ZZZ424242 + + + + + sepa + recurrent + first + + valid + + + + + + + + sepa + recurrent + first + + valid + + + + diff --git a/account_banking_sepa_direct_debit/i18n/account_banking_sepa_direct_debit.pot b/account_banking_sepa_direct_debit/i18n/account_banking_sepa_direct_debit.pot index f6cf4c9c7..8ed55c439 100644 --- a/account_banking_sepa_direct_debit/i18n/account_banking_sepa_direct_debit.pot +++ b/account_banking_sepa_direct_debit/i18n/account_banking_sepa_direct_debit.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -142,7 +142,7 @@ msgstr "" #, python-format msgid "" "Automatically switched from First to Recurring when the debit " -"order %s has" +"order {} has" " been marked as uploaded." msgstr "" @@ -173,13 +173,6 @@ msgstr "" #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate__display_name -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_payment_line__display_name -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_payment_method__display_name -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_payment_mode__display_name -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_payment_order__display_name -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_bank_payment_line__display_name -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_res_company__display_name -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_res_config_settings__display_name msgid "Display Name" msgstr "" @@ -220,36 +213,12 @@ msgstr "" msgid "First" msgstr "" -#. module: account_banking_sepa_direct_debit -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate__id -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_payment_line__id -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_payment_method__id -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_payment_mode__id -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_payment_order__id -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_bank_payment_line__id -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_res_company__id -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_res_config_settings__id -msgid "ID" -msgstr "" - #. module: account_banking_sepa_direct_debit #: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:0 #, python-format msgid "Invalid mandate type in '%s'. Valid ones are 'Recurrent' or 'One-Off'" msgstr "" -#. module: account_banking_sepa_direct_debit -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate____last_update -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_payment_line____last_update -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_payment_method____last_update -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_payment_mode____last_update -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_payment_order____last_update -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_bank_payment_line____last_update -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_res_company____last_update -#: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_res_config_settings____last_update -msgid "Last Modified on" -msgstr "" - #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate__format msgid "Mandate Format" diff --git a/account_banking_sepa_direct_debit/models/account_banking_mandate.py b/account_banking_sepa_direct_debit/models/account_banking_mandate.py index 6b98c7624..9c6ed42b6 100644 --- a/account_banking_sepa_direct_debit/models/account_banking_mandate.py +++ b/account_banking_sepa_direct_debit/models/account_banking_mandate.py @@ -6,7 +6,8 @@ from datetime import datetime from dateutil.relativedelta import relativedelta -from odoo import _, api, exceptions, fields, models +from odoo import _, api, fields, models +from odoo.exceptions import UserError NUMBER_OF_UNUSED_MONTHS_BEFORE_EXPIRY = 36 @@ -39,7 +40,6 @@ class AccountBankingMandate(models.Model): ) scheme = fields.Selection( [("CORE", "Basic (CORE)"), ("B2B", "Enterprise (B2B)")], - string="Scheme", default="CORE", tracking=80, ) @@ -50,7 +50,7 @@ class AccountBankingMandate(models.Model): def _check_recurring_type(self): for mandate in self: if mandate.type == "recurrent" and not mandate.recurrent_sequence_type: - raise exceptions.Warning( + raise UserError( _("The recurrent mandate '%s' must have a sequence type.") % mandate.unique_mandate_reference ) diff --git a/account_banking_sepa_direct_debit/models/account_payment_method.py b/account_banking_sepa_direct_debit/models/account_payment_method.py index ab048504a..0663e9904 100644 --- a/account_banking_sepa_direct_debit/models/account_payment_method.py +++ b/account_banking_sepa_direct_debit/models/account_payment_method.py @@ -1,7 +1,7 @@ # Copyright 2020 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import fields, models +from odoo import api, fields, models class AccountPaymentMethod(models.Model): @@ -33,3 +33,9 @@ class AccountPaymentMethod(models.Model): path = "account_banking_sepa_direct_debit/data/%s.xsd" % self.pain_version return path return super().get_xsd_file_path() + + @api.model + def _get_payment_method_information(self): + res = super()._get_payment_method_information() + res["sepa_direct_debit"] = {"mode": "multi", "domain": [("type", "=", "bank")]} + return res diff --git a/account_banking_sepa_direct_debit/models/account_payment_order.py b/account_banking_sepa_direct_debit/models/account_payment_order.py index 0e0704202..f5a041c49 100644 --- a/account_banking_sepa_direct_debit/models/account_payment_order.py +++ b/account_banking_sepa_direct_debit/models/account_payment_order.py @@ -302,8 +302,7 @@ class AccountPaymentOrder(models.Model): "Automatically switched from First to " "Recurring when the debit order " "%s has been marked as uploaded." - ) - % (order.id, order.name) + "data-oe-id=%d>{} has been marked as uploaded." + ).format(order.id, order.name) ) return res diff --git a/account_banking_sepa_direct_debit/post_install.py b/account_banking_sepa_direct_debit/post_install.py index c6de61867..88b84dad9 100644 --- a/account_banking_sepa_direct_debit/post_install.py +++ b/account_banking_sepa_direct_debit/post_install.py @@ -11,5 +11,15 @@ def update_bank_journals(cr, registry): journals = ajo.search([("type", "=", "bank")]) sdd = env.ref("account_banking_sepa_direct_debit.sepa_direct_debit") if sdd: - journals.write({"inbound_payment_method_ids": [(4, sdd.id)]}) + journals.write( + { + "inbound_payment_method_line_ids": [ + ( + 0, + 0, + {"payment_method_id": sdd.id, "name": "SEPA Direct Debit"}, + ) + ] + } + ) return diff --git a/account_banking_sepa_direct_debit/readme/CONTRIBUTORS.rst b/account_banking_sepa_direct_debit/readme/CONTRIBUTORS.rst index 04a019eaa..a69a2bd73 100644 --- a/account_banking_sepa_direct_debit/readme/CONTRIBUTORS.rst +++ b/account_banking_sepa_direct_debit/readme/CONTRIBUTORS.rst @@ -10,3 +10,4 @@ * Pedro M. Baeza * Sergio Teruel * Carlos Roca +* Manuel Regidor diff --git a/account_banking_sepa_direct_debit/reports/sepa_direct_debit_mandate.xml b/account_banking_sepa_direct_debit/reports/sepa_direct_debit_mandate.xml index 4c37790a7..99cd63a9e 100644 --- a/account_banking_sepa_direct_debit/reports/sepa_direct_debit_mandate.xml +++ b/account_banking_sepa_direct_debit/reports/sepa_direct_debit_mandate.xml @@ -1,17 +1,5 @@ - SEPA Mandate diff --git a/account_banking_sepa_direct_debit/static/description/index.html b/account_banking_sepa_direct_debit/static/description/index.html index d7c504d4e..f34b51789 100644 --- a/account_banking_sepa_direct_debit/static/description/index.html +++ b/account_banking_sepa_direct_debit/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/bank-payment Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/bank-payment Translate me on Weblate Try me on Runbot

Create SEPA files for Direct Debit

Module to export direct debit payment orders in SEPA XML file format.

SEPA PAIN (PAyment INitiation) is the new european standard for @@ -444,7 +444,7 @@ you created during the configuration step.

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -472,6 +472,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Carlos Roca
  • +
  • Manuel Regidor <manuel.regidor@sygel.es>
  • @@ -481,7 +482,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    -

    This module is part of the OCA/bank-payment project on GitHub.

    +

    This module is part of the OCA/bank-payment project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/account_banking_sepa_direct_debit/tests/test_sdd.py b/account_banking_sepa_direct_debit/tests/test_sdd.py index 3800cd9cd..dc9d8575c 100644 --- a/account_banking_sepa_direct_debit/tests/test_sdd.py +++ b/account_banking_sepa_direct_debit/tests/test_sdd.py @@ -7,11 +7,11 @@ import base64 from lxml import etree from odoo import fields -from odoo.tests.common import SavepointCase +from odoo.tests.common import TransactionCase from odoo.tools import float_compare -class TestSDDBase(SavepointCase): +class TestSDDBase(TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() @@ -89,6 +89,18 @@ class TestSDDBase(SavepointCase): "code": "BNKFC", "bank_account_id": cls.company_bank.id, "bank_id": cls.company_bank.bank_id.id, + "inbound_payment_method_line_ids": [ + ( + 0, + 0, + { + "payment_method_id": cls.env.ref( + "account_banking_sepa_direct_debit.sepa_direct_debit" + ).id, + "payment_account_id": cls.account_expense_company_B.id, + }, + ) + ], } ) # update payment mode @@ -194,8 +206,7 @@ class TestSDDBase(SavepointCase): "code": "AJ-PURC", "type": "purchase", "company_id": cls.company_B.id, - "payment_debit_account_id": cls.account_expense_company_B.id, - "payment_credit_account_id": cls.account_expense_company_B.id, + "default_account_id": cls.account_expense_company_B.id, } ) cls.journal_sale_company_B = cls.env["account.journal"].create( @@ -204,8 +215,7 @@ class TestSDDBase(SavepointCase): "code": "AJ-SALE", "type": "sale", "company_id": cls.company_B.id, - "payment_debit_account_id": cls.account_income_company_B.id, - "payment_credit_account_id": cls.account_income_company_B.id, + "default_account_id": cls.account_income_company_B.id, } ) cls.journal_general_company_B = cls.env["account.journal"].create(